Torbjorn Granlund tg at
Mon Jan 21 18:11:12 CET 2008

nisse at (Niels Möller) writes:

  >   I'm considering simply writing a configure check for the
  >   mpz_millerrabin function, and use it if it is available.

  Do you seen any problem with that? I actually don't do a proper
  configure check now, it seemed simpler to just insert a

  #ifdef __gmpz_millerrabin

  in the code.

I am in general unwilling to make any promises beyond those made in the
manual.  It is already difficult to maintain GMP wrt compatibility, you

There might be a future version of GMP with an incompatible
mpz_millerrabin.  I am not trying to be unhelpful, I am simply trying
to cope with maintaining GMP, and make future versions of GMP as good
as possible.

If you need millerrabin, you might copy the present GMP code (assuming
LGPL is OK for your use), and then perhaps use some nifty, future,
documented GMP pseudo prime testing functions.

  >   I have difficulty imagining any useful changes to the current
  >   interface of this function,
  >     int mpz_millerrabin (mpz_srcptr n, int reps)

  On second thought, for composite input, it might be useful to return
  the witness that exposed the compositeness.

Perhaps that.  Also, one might want to let a function called
mpz_millerrabin perform just that, not also a Fermat test.

I plan defining a new set of prime and pseudo prime testing functions
for GMP 5.  Therefore, mpz_millerrabin is actually likely to change or
perhaps disappear.


More information about the gmp-devel mailing list