_mp_alloc vs ALLOC

Pedro Gimeno gmpdevel at formauri.es
Mon Jun 4 21:14:06 CEST 2012

bodrato at mail.dm.unipi.it wrote:

> IIRC someone proposed to change the meaning of the second argument of
> mpz_probab_prime_p. Now it is documented as "reps controls how many
> [Miller-Rabin] tests are done". It should be something like "logprob
> controls the likeliness of a wrong answer, the function will return
> probably prime for a composite with a probability of 1 over 2^logprob".

What I think is unacceptable is that if a composite passes the test, it
also passes the test when invoked a second time because the bases it's
tested against are always the same. That's the why of a version that
accepts a random state. So, a new function is recommendable in any case.
That applies to mpz_millerrabin as well, of course, which is the one
actually doing the PRNG calls.

And while on that subject, there was also a request for a M-R test
function accepting a specific base as parameter:

And a suggestion to return the witness that proved the compositeness:

In that message, Torbjörn also says that it'd be nice for a function
called millerrabin to do a M-R test only, not also a Fermat test.

More information about the gmp-devel mailing list