gmp integer size limitation

Torbjorn Granlund tg at gmplib.org
Thu Apr 26 21:51:48 CEST 2012


Kate Minola <kate01123 at gmail.com> writes:

  gmp seems to have a limitation on the size of a multiple-precision
  integer.   Is there anything that can be done to remove this
  limitation?  Or are there any plans to remove this limitation?
  
On 32-bit computers, the limit is imposed by the addressable memory.

On 64-bit computers the limit is what you have noticed, 2^37 bits or 16
Gibytes.  Here the problem is that we use a 32-bit limb count in the
mpz_t.  It will probably work to replace the size and alloc fields with
a 64-bit signed integer type, but that would break binary compatibility.
(And I am sure a few laces in the library will fail too, due to typing
errors.)

We have some plans of upping the bound to at least 2^50 bits using some
tricks to keep things compatibile and efficient.  The idea to to replace
the current alloc field of mpz_t with a custom 16-bit float, and use the
freed 16 bits as extra high bits of the size field.

-- 
Torbjörn


More information about the gmp-discuss mailing list