Possible bug in mini-gmp (gmp-6.0.0)
Torbjörn Granlund
tg at gmplib.org
Thu May 14 19:56:21 UTC 2015
Zach Metzinger <zmetzing at pobox.com> writes:
While trying to generate the value (2^N)-1 for N := {8,512} and using
the mini-gmp library, I did the following:
mpz_init(m);
mpz_set_ui(m, 0);
mpz_setbit(m, n-1);
mpz_sub_ui(m, m, 1);
This produced, in the case of N == 0:
0x81
While the following code:
mpz_set_ui(t0, 1);
mpz_mul_2exp(m, t0, n);
mpz_sub_ui(m, m, 1);
produces the correct result:
0xff
This makes no sense.
You need to send a complete stripped down executable test case.
--
Torbjörn
Please encrypt, key id 0xC8601622
More information about the gmp-bugs
mailing list