gmpy
gmpy copied to clipboard
mpz gives wrong result with very large exponent .
Only the first of these expressions gives the correct result:-
Python 3.4.2 (v3.4.2:ab2c023a9432, Oct 6 2014, 22:16:31) [MSC v.1600 64 bit (AMD64)] on win32
>>> from gmpy2 import mpz, bit_length
>>> bit_length(2 ** 10439860591)
10439860592
>>> bit_length(2 ** mpz(10439860591))
1849926000
>>> bit_length(mpz(2) ** mpz(10439860591))
1849926000
>>> bit_length(mpz(2) ** 10439860591)
1849926000
mp_version() is 'MPIR 2.6.0'.
This is a quirk caused by Windows using 32-bit longs even on a 64-bit platform. I'll try to get it fixed soon.