Problem with large values in GMP...

wraithx at morpheus.net wraithx at morpheus.net
Sat Mar 26 22:09:34 UTC 2016


On 3/24/2016 12:57 PM, Torbjörn Granlund wrote:
> I don't think it is correct to make these type changes based on
> _LONG_LONG_LIMB. We may want to extend mp_size_t and mp_size_tto to 64
> bits on LLP64 systems and perhaps mp_bitcnt_t to 64 bits on any
> _LONG_LONG_LIMB.
>
> But any such change needs careful testing and code review to make sure
> things work around the new borders (e.g. 2^32 bits and 2^31 limbs).
> Just 'make check' is not an indicator of success.
>
> We plan to collect many changes which break compatibility slightly for
> GMP 7; we already consider changes to at leat mp_bitcnt_t.
>

I only chose _LONG_LONG_LIMB because I knew it would work on my system.  We can 
change it to #if defined(_WIN64) || defined(__WIN64) to make it so that this 
change only applies to 64-bit Windows.

I agree that any change would need careful testing and code review.  What sort 
of testing was used to make sure that the 64-bit capabilities of GMP work 
correctly on 64-bit Linux systems?  I can run those tests on my Win64 computer, 
if you like.

I know 'make check' doesn't indicate that the library will work as expected in 
all possible cases.  But, it does indicate that it succeeded in a variety of 
different test cases.  It is only one data point, and I wanted to share its 
success.  As you say, more testing is needed.

Hopefully your changes for GMP 7 include increasing the capabilities of GMP on 
Win64 systems to be closer, if not identical, to 64-bit Linux systems.  I use 
GMP quite a lot on my Win64 computers and am extremely grateful for this great 
library.  I'm not sure how much I could help, but if you need help with Win64 
development or testing, I could try to help out.

And, now that I've Googled "GMP define 64-bit types" I see that the changes I 
have just suggested were also suggested back in June 2008!  I'm really behind 
the curve here.  For reference, the thread I found starts here:
https://gmplib.org/list-archives/gmp-discuss/2008-June/003243.html
Again, if I can help with creating test cases, running test cases, or help 
test/develop code on my Win64 systems, please let me know.

-David C.


More information about the gmp-discuss mailing list