Maximum Size-In-Base of mpz_t

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


Paul Lou <paul96lou at gmail.com> 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
  https://gmplib.org/list-archives/gmp-discuss/2004-April/001118.html 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
https://gmplib.org/list-archives/gmp-discuss/2012-April/005020.html  
(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.)

-- 
Torbjörn
Please encrypt, key id 0xC8601622


More information about the gmp-discuss mailing list