Seth Troisi <brain...@gmail.com> writes: > Trying to sum up the proposals for how this api should work, > > 1. add mpz_prevprime(rop, op) or mpz_precprime(rop, op) > 2. change mpz_nextprime(-10) => -7 (instead of 2) > 3. add mpz_nextprime_seq(a, b) => next prime a + k*b with k >= 1 > > Considerations > 1. on negative number return X? > Should prevprime return "input had correct sign"? should nextprime? > 2. this is an incompatible change for the interface (but probably not one > many people depenedend on) > 3. a bigger change than other two proposals. > > --- > > Personally I'm a fan of number 1. because I can clearly see the steps > needed.
To me, 1 seems like a good improvement. It can be generalized to 3 later. For return value, I'd prefer int mpz_prevprime(mpz_ptr p, mpz_srcptr n); with return value 0, and p unchanged, if there is no (positive) prime < n, otherwise 1, or possibly 2 for definitely, rather than probably, prime. And I think it's too unconventional to include negatives in the set of prime numbers. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale government surveillance. _______________________________________________ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel