GMP - Arithmetic without limitations The GNU Multiple Precision Arithmetic Library



Documentation: 4.3.2 HTML | 4.3.2 PDF
5.0.1 HTML | 5.0.1 PDF
Download: gmp-4.3.2.tar.bz2 | Release notes
gmp-5.0.1.tar.bz2 | Release notes
Development: Developers' corner
GMPbench: Results | Download benchmark sources
Fun: Compute billions of digits of Pi using GMP!
How you can help: Donating hardware to GMP
Page contents:
What is GMP?
Function categories
Download
Reporting bugs
Mailing lists
Current release status
Future releases

What is GMP?

GMP is a free library for arbitrary precision arithmetic, operating on signed integers, rational numbers, and floating point numbers. There is no practical limit to the precision except the ones implied by the available memory in the machine GMP runs on. GMP has a rich set of functions, and the functions have a regular interface.

The main target applications for GMP are cryptography applications and research, Internet security applications, algebra systems, computational algebra research, etc.

GMP is carefully designed to be as fast as possible, both for small operands and for huge operands. The speed is achieved by using fullwords as the basic arithmetic type, by using fast algorithms, with highly optimised assembly code for the most common inner loops for a lot of CPUs, and by a general emphasis on speed.

GMP is faster than any other bignum library. The advantage for GMP increases with the operand sizes for many operations, since GMP uses asymptotically faster algorithms.

The first GMP release was made in 1991. It is continually developed and maintained, with a new release about once a year.

GMP is distributed under the GNU LGPL. This license makes the library free to use, share, and improve, and allows you to pass on the result. The license gives freedoms, but also sets firm restrictions on the use with non-free programs.

GMP is part of the GNU project. For more information about the GNU project, please see the official GNU web site.

GMP's main target platforms are Unix-type systems, such as GNU/Linux, Solaris, HP-UX, Mac OS X/Darwin, BSD, AIX, etc. It also is known to work on Windows in both 32-bit and 64-bit mode.

GMP is brought to you by a team listed in the manual.

GMP is carefully developed and maintained, both technically and legally. We of course inspect and test contributed code carefully, but equally importantly we make sure we have the legal right to distribute the contributions, meaning users can safely use GMP. To achieve this, we will ask contributors to sign paperwork where they allow us to distribute their work.


GMP function categories

There are several categories of functions in GMP:

  1. High-level signed integer arithmetic functions (mpz). There are about 140 arithmetic and logic functions in this category.
  2. High-level rational arithmetic functions (mpq). This category consists of about 35 functions, but all signed integer arithmetic functions can be used too, by applying them to the numerator and denominator separately.
  3. High-level floating-point arithmetic functions (mpf). This is the GMP function category to use if the C type `double' doesn't give enough precision for an application. There are about 65 functions in this category.
  4. C++ class based interface to all of the above. (The C functions and types can of course be used directly from C++ too.)
  5. Low-level positive-integer, hard-to-use, very low overhead functions are found in the mpn category. No memory management is performed; the caller must ensure enough space is available for the results. The set of functions is not regular, nor is the calling interface. These functions accept input arguments in the form of pairs consisting of a pointer to the least significant word, and an integral size telling how many limbs (= words) there are in that argument. The functions in the other categories call mpn for almost all their calculations.
  6. Externally supported: High-level floating-point accurately rounding arithmetic functions (mpfr). See the mpfr site for more information. Starting with GMP 4.2, mpfr is released separately from GMP. (New projects should probably use mpfr instead of mpf.)

Download the latest release of GMP

GMP 4.3.2 lz, 1564372 bytes bz2, 1897483 bytes gz, 2497750 bytes
Sweden, gmplib.org gmp-4.3.2.tar.lz gmp-4.3.2.tar.bz2 gmp-4.3.2.tar.gz
USA, ftp.gnu.org n/a gmp-4.3.2.tar.bz2 gmp-4.3.2.tar.gz

GMP 5.0.1 lz, 1658844 bytes bz2, 2006109 bytes gz, 2631904 bytes
Sweden, gmplib.org gmp-5.0.1.tar.lz gmp-5.0.1.tar.bz2 gmp-5.0.1.tar.gz
USA, ftp.gnu.org n/a gmp-5.0.1.tar.bz2 gmp-5.0.1.tar.gz

To try to verify that the file you have downloaded has not been tampered with, you can check that the GnuPG signature matches the contents of the file. Use your GnuPG software or a key server directly to get the key that was used for creating the signature. These are the properties of the signing key:

Name: Swox AB (Software signing key 2004) <info@swox.com>
Key ID: 0xDB899F46
Key type: 1024 bit DSA
Fingerprint: 73D4 6C36 6746 1E4B D939 7249 5D6D 47DF DB89 9F46

GnuPG signatures: gmp-4.3.2.tar.bz2.sig gmp-4.3.2.tar.gz.sig gmp-5.0.1.tar.bz2.sig gmp-5.0.1.tar.gz.sig

Alternatively, you could check a cryptographic checksum:
SHA1 gmp-4.3.2.tar 00c67a5fe9dc1fd76c1d2b006aea0cb5d06fd241
SHA256 gmp-4.3.2.tar f3a1337fc4f88e9df66d508af89da5afe35c690c4ec0e019c2fc2af6291ac090
SHA1 gmp-5.0.1.tar 4628e42df65ec55b97e3621e62226924ae2011d8
SHA256 gmp-5.0.1.tar 0e60cc2a6bd9737c9359d15e8a835d077d58905f8106ead2268c3a9c0a6f3bec

You may also get the latest code from the open GMP repository.


Reporting bugs in GMP

Please first see the manual on how to report bugs. The proper address for bug reports is gmp-bugs@gmplib.org.

Most problems with compiling GMP these days are due to problems not in GMP, but with the compiler. In the past, system compilers caused the most trouble, but in the last years, gcc has gradually caused more and more trouble. On these pages we don't list compiler problems, just problems with the GMP code itself. To save you some time, we suggest that you cut any compiler error message and paste it into your favourite web search engine before you report problems to the GMP bug report list.


GMP mailing lists

List Subscribe URL Archive URL
gmp-bugs@gmplib.org http://gmplib.org/mailman/listinfo/gmp-bugs http://gmplib.org/list-archives/gmp-bugs/
gmp-announce@gmplib.org http://gmplib.org/mailman/listinfo/gmp-announce http://gmplib.org/list-archives/gmp-announce/
gmp-discuss@gmplib.org http://gmplib.org/mailman/listinfo/gmp-discuss http://gmplib.org/list-archives/gmp-discuss/
gmp-devel@gmplib.org http://gmplib.org/mailman/listinfo/gmp-devel http://gmplib.org/list-archives/gmp-devel/

The gmp-bugs@gmplib.org list is intended for bug reports. Please do not send general questions to that list. Information on how to write useful bug reports is available in the manual. The now obsolete bug report mailing list bug-gmp@gnu.org is archived at the main GNU site.

The gmp-announce@gmplib.org list is where important announcements from the GMP maintainers are made. All GMP users should be on this list. It is really very low volume (around 5 messages per year).

The gmp-discuss@gmplib.org list is intended for discussing GMP issues with other users and developers. This is NOT for bug reports. This is the right place to ask questions, but please check the manual first.

The gmp-devel@gmplib.org list is for the technical discussions between GMP developers, and in general, non-developers will not be allowed to post here. Therefore, this list is moderated.

Note that we perform spam and virus filtering of these lists. The lists have been 100% spam-free during the last years.

You cannot subscribe an AOL address to any GMP mailing list, since AOL blocks our mail server until we register with them as a "bulk mailer", something we will certainly never do.


Status of the current release

The current stable release is 4.3.2, released 2010-01-08.
The current performance release is 5.0.1, released 2010-02-06.

Issues with GMP 5.0.1:

Issues with GMP 4.3.2:

For patches to older GMP versions, please see the Info on older GMP releases.


Future releases

It is not unlikely that we will make a 5.0.2 release at some point. That depends on the need for fixing bugs. Also, we might make a 4.3.3 release if any bugs are discovered in its release series.

A new major release, version 5.1.0, will be made in 2010. Here are some examples of planned improvements:




Please send comments about this page to gmp-discuss@gmplib.org
Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.