largest number

Zimmermann Paul Paul.Zimmermann at
Mon Mar 5 15:27:24 CET 2012

> The upper limit on representable integers in GMP is a function of the
> memory available to your machine. There are no practical intrinsic
> limits with present-day machines. Two hundred million (decimal) digit
> numbers are under a billion bits, which is readily feasible.

this is not completely true. For mpz_t the _mp_size field is an "int", which
has 32 bits on most platforms, and the sign bit is used to represent the sign
of the number. Thus the hard limit is 2^31-1 limbs, which is 2^37-64 bits on a
64-bit platform. In practice it seems the actual limit is a bit smaller, i.e.,
2^37-128 bits. This will take about 16GB memory, which is not uncommon now.

Paul Zimmermann

More information about the gmp-discuss mailing list