mp_size_t

Tomás Oliveira e Silva tos at ua.pt
Tue Oct 5 15:57:31 UTC 2021


I very recently did a computation requiring integers of potentially 
extreme large size using gmp 6.2.1.
Unfortunately, the program was terminated early due to overflow in the 
mpz type.

Reading the 6.2.1 documentation (page 18, version 6.2.1) I was expecting 
the number of limbs to be stored in a field of type mp_size_t.
To my surprise that is not so. In gmp.h (and gmp-h.in) both _mp_alloc 
and _mp_size are plain integers (int data type).
That probably makes it much harder for someone without intimate 
knowledge of the inner workings of the library to compile a custom 
version of the library where those fields are longs, and, more 
importantly, to have confidence that the now long sizes are handled 
correctly in all places.

Any ideas about to address this particular problem? For my problem, 
2^{31}-1 limbs are not enough...

-- 
TOS



More information about the gmp-discuss mailing list