encyclopegia.org

GNU Multiple Precision Arithmetic Library

GNU Multiple Precision Arithmetic Library (GMP) is a free library for arbitrary-precision arithmetic, operating on signed integers, rational numbers, and floating-point numbers. There are no practical limits to the precision except the ones implied by the available memory (operands may be of up to 2 32 −1 bits on 32-bit machines and 2 37 bits on 64-bit machines). GMP has a rich set of functions, and the functions have a regular interface. The basic interface is for C, but wrappers exist for other languages, including Ada, C++, C#, Julia, .NET, OCaml, Perl, PHP, Python, R, Ruby, and Rust. Before 2008, Kaffe, a Java virtual machine, used GMP to support Java built-in arbitrary precision arithmetic. Shortly after, GMP support was added to GNU Classpath, as the backends to java.math.BigInteger and java.math.BigDecimal . The main target applications of GMP are cryptography applications and research, Internet security applications, and computer algebra systems. GMP aims to be faster than any other arbitrary-precision arithmetic (big number) library for all operand sizes. Some important factors in doing this are: * Full words are the basic type for all arithmetic. * Different algorithms are used for different operand sizes; algorithms which are more efficient with large numbers are not used when dealing with small numbers.…

GNU Multiple Precision Arithmetic Library (GMP) is a free library for arbitrary-precision arithmetic, operating on signed integers, rational numbers, and floating-point numbers. There are no practical limits to the precision except the ones implied by the available memory (operands may be of up to 2 32 −1 bits on 32-bit machines and 2 37 bits on 64-bit machines). GMP has a rich set of functions, and the functions have a regular interface. The basic interface is for C, but wrappers exist for other languages, including Ada, C++, C#, Julia, .NET, OCaml, Perl, PHP, Python, R, Ruby, and Rust. Before 2008, Kaffe, a Java virtual machine, used GMP to support Java built-in arbitrary precision arithmetic. Shortly after, GMP support was added to GNU Classpath, as the backends to java.math.BigInteger and java.math.BigDecimal . The main target applications of GMP are cryptography applications and research, Internet security applications, and computer algebra systems. GMP aims to be faster than any other arbitrary-precision arithmetic (big number) library for all operand sizes. Some important factors in doing this are: Full words are the basic type for all arithmetic. Different algorithms are used for different operand sizes; algorithms which are more efficient with large numbers are not used when dealing with small numbers. Assembly language (specialized for different processors) is used in the most common inner loops to optimize them as much as possible. The first GMP release was made in 1991. It is constantly developed and maintained. GMP is part of the GNU project (although its website being off gnu.org may cause confusion), and is distributed under the GNU Lesser General Public License (LGPL). GMP is used for integer arithmetic in many computer algebra systems such as Mathematica and Maple. It is also used in the Computational Geometry Algorithms Library (CGAL). GMP is needed to build the GNU Compiler Collection (GCC). include include int main(void) { mpz_t x, y, result; mpz_init_set_str(x, "7612058254738945", 10); mpz_init_set_str(y, "9263591128439081", 10); mpz_init(result); mpz_mul(result, x, y); gmp_printf( " %Zd\n" "*\n" " %Zd\n" "--------------------\n" "%Zd\n", x, y, result ); // free used memory mpz_clear(x); mpz_clear(y); mpz_clear(result); return 0; } This code calculates the value of 7612058254738945 \times 9263591128439081 . Compiling and running this program gives this result. (The -lgmp flag is used if compiling on Unix-type systems.) 7612058254738945 9263591128439081 -------------------- 70514995317761165008628990709545 import ; import std; int main() { mpz_class x("7612058254738945"); mpz_class y("9263591128439081"); mpz_class result = x * y; std::println( " {}\n" "*\n" " {}\n" "--------------------\n" "{}", x.get_str(), y.get_str(), result.get_str() ); return 0; }

References

No reference rows published for this article.

Cite this article

MLA

"GNU Multiple Precision Arithmetic Library." encyclopegia.org, 2026, https://encyclopegia.org/wiki/gnu-multiple-precision-arithmetic-library. Accessed 24 November 2026.

Chicago

"GNU Multiple Precision Arithmetic Library." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/gnu-multiple-precision-arithmetic-library.

APA

encyclopegia.org. (2026). GNU Multiple Precision Arithmetic Library. Retrieved November 24, 2026, from https://encyclopegia.org/wiki/gnu-multiple-precision-arithmetic-library

Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON

Related articles

multiple sclerosis

stub · references available

GNU Manifesto

stub · references available

GNU Free Documentation License

stub · references available

GNU

stub · references available

least common multiple

stub · references available

list of PKP locomotives and multiple units

stub · references available

GNU GRUB

stub · references available
CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1344236344 · 0.5 · snapshot enwiki-001344236344

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.