mini-gmp: mpz_congruent_p and mpz_probab_prime_p

bodrato at bodrato at
Thu Mar 6 17:50:43 UTC 2014


Il Mer, 5 Marzo 2014 6:07 pm, Niels Möller ha scritto:
>> May I suggest to change the second comparison to mpz_cmp_ui (y, 1) <= 0?
> Hmm, why? y == 0 can happen if n divides a power of a (the base for the
> test), in which case n is composite (except in corner cases, see below),
> and in which case the test will eventually fail without explicitly
> checking for y == 0.

I agree with your analysis: with the suggested change the same answer is
given. Earlier, at no extra cost, I say.
The same comment applies to the current implementation in the main library.



More information about the gmp-devel mailing list