Problem with large values in GMP...

Vincent Lefevre vincent at
Tue Mar 22 14:45:44 UTC 2016

On 2016-03-17 19:06:58 +0100, Torbjörn Granlund wrote:
> Vincent Lefevre <vincent at> writes:
> On 2016-03-17 18:19:27 +0100, Torbjörn Granlund wrote:
>   > We use "int" for the limb count in mpz_t; code manipulating that should
>   > not try to set values which do not fit.
>   Why an int and not a long?
> Please resend this message in 1991.  :-)

The use of an int should be documented. In the manual:

   Counts of limbs of a multi-precision number represented in the C type
`mp_size_t'.  Currently this is normally a `long', but on some systems
it's an `int' for efficiency, and on some systems it will be `long
long' in the future.

so that one can have the false impression that mp_size_t is also
used internally for the size of an mpz_t. Thus the limitation is
very surprising.

Vincent Lefèvre <vincent at> - Web: <>
100% accessible validated (X)HTML - Blog: <>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

More information about the gmp-discuss mailing list