mpz_powm_ui () for 5.1.2

Marco Bodrato bodrato at
Wed Mar 8 03:57:38 UTC 2017


Il 2017-03-08 02:17 shen lixing ha scritto:
> I installed MinGW, then  'mingw-get install mingw32-gmp' , got the gmp
> 5.1.2 properly.

The last release of the library is 6.1.2 .

>     unsigned long long c = 10307e7 - 1;  // change c,start point

>       mpz_set_ui(b,c);
>       mpz_mul_ui(b,b,c);
>       mpz_powm_ui(d,a,c-1,b );

Look carefully at the documentation of the three mpz*_ui functions you 
They take an _unsigned long_ as their _ui argument.
You pass an _unsigned long long_ variable, the compiler implicitly 

Does "mingw32" means unsigned long is a 32-bit type?
You should use an mpz variable to store values exceeding 2^32...



More information about the gmp-bugs mailing list