GNU MultiPrecision Library
The GNU Multiple-Precision Library, also known as 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.
GMP is carefully designed to be as fast as possible, both for small operands and for huge operands. Some important factors behind this speed are:
- Using fullwords as the basic arithmetic type.
- Using different algorithms for different operand sizes. The algorithms that are fastest for really big numbers are seldom fastest for small numbers.
- Highly optimized assembly code for the most important inner loops for a lot of different processors.
GMP aims to be faster than any other bignum library for all operand sizes, and generally seems to be doing a good job at it. Its strength is that it has both a very good set of algorithms and a lot of very well optimized inner loops.
The first GMP release was made in 1991. It is continually developed and maintained, with a new release about once a year. The current release is 4.1.4.
GMP is part of the GNU project, and 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.