Maximum Size-In-Base of mpz_t

Torbjörn Granlund tg at
Mon Jul 4 15:19:23 UTC 2016

Paul Lou <paul96lou at> writes:

  I was wondering what the maximum size-in-base of mpz_t is.
I am not sure I understand what size-in-base means.

  I've been multiplying large numbers with gmp-6.1.0 and I personally got up
  to ~41,000,000,000 in size of base 10 for mpz_t but could not get up to 82B
  in size of base 10 (there's nothing special about 41B in my case, it's just
  the size in base 10 that I ended up with for my purposes). When I multiply
  two mpz_t's each with 41B in size of base 10, the result is a mpz_t with
  only 29M in size of base 10 which is clearly incorrect. Do you have any
  idea why this is occuring?
  Is this error a result of the physical cap of the sizeinbase function or
  the mpz_t struct? I saw on that
  mpz_t's should support 2^50 limbs, so I would assume that the sizeinbase
  function is not displaying the mpz_t correctly since the mpz_t should be
  able to represent that large of a value.
I think a good source of information is  
(this ought to be clearly documented in the manual).

Your observed limit of 41 billion decimal digits sounds about right.

(We have played with 2^50 bits as a new limit, but that's not code which
we have yet released.)

Please encrypt, key id 0xC8601622

More information about the gmp-discuss mailing list