tg at swox.com
Tue Dec 23 02:47:34 CET 2008
David Harvey <dmharvey at cims.nyu.edu> writes:
mpz_perfect_power_p() can return incorrect answers.
The following code snippet illustrates:
mpz_set_si (x, -64);
printf ("%ld\n", mpz_perfect_power_p (x));
It prints 0, even though -64 = (-4)^3 is a perfect power.
Ouch. I've made am embarrasing logic error. The comments "even
multiplicity with negative" in mpz/perfpow.c indicate the errors.
What really matters is of the exponent is a power of 2.
I need to sleep on this to get it right.
Thanks for the bug report.
More information about the gmp-bugs