[Gmp-commit] /var/hg/gmp: 2 new changesets
mercurial at gmplib.org
mercurial at gmplib.org
Tue Mar 24 16:50:26 UTC 2020
details: /var/hg/gmp/rev/250143eef914
changeset: 18061:250143eef914
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Tue Mar 24 17:49:46 2020 +0100
description:
mpz/nextprime.c: Update some comments.
details: /var/hg/gmp/rev/9cabe848100d
changeset: 18062:9cabe848100d
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Tue Mar 24 17:50:16 2020 +0100
description:
tests/devel/primes.c: Update documentation (and remove a small bug).
diffstat:
mpz/nextprime.c | 6 +++++-
tests/devel/primes.c | 9 ++++++---
2 files changed, 11 insertions(+), 4 deletions(-)
diffs (65 lines):
diff -r a7836288d2c0 -r 9cabe848100d mpz/nextprime.c
--- a/mpz/nextprime.c Fri Mar 20 16:19:07 2020 +0100
+++ b/mpz/nextprime.c Tue Mar 24 17:50:16 2020 +0100
@@ -109,7 +109,7 @@
}
else
{
- /* Larger threshold is faster but takes ~O(n/ln(n)) memory.
+ /* Larger threshold is faster but takes (n/ln(n) + n/24) memory.
* For 33,000 bits limitting to 150M is ~12% slower than using the
* optimal 1.5G sieve_limit.
*/
@@ -168,6 +168,10 @@
up to the gap 304599508537+514=304599509051 .
With the current code our limit is 436273009+282=436273291 */
ASSERT (sieve_limit < 436273291);
+ /* THINK: Memory used by both sieve and primegap_tmp is kept
+ allocated, but they may overlap if primegap is filled from
+ larger down to smaller primes...
+ */
/* Needed to avoid assignment of read-only location */
primegap_tmp = TMP_ALLOC_TYPE (prime_limit, unsigned char);
diff -r a7836288d2c0 -r 9cabe848100d tests/devel/primes.c
--- a/tests/devel/primes.c Fri Mar 20 16:19:07 2020 +0100
+++ b/tests/devel/primes.c Tue Mar 24 17:50:16 2020 +0100
@@ -27,10 +27,11 @@
With the parameter "p" (or nothing), tests all numbers. With "c"
only composites are tested.
- ./primes n [n0] <nMax>
+ ./primes n|N [n0] <nMax>
Checks mpz_nextprime() exhaustively, starting from n=n0 up to
- nMax.
+ nMax. With "n", only the sequence of primes is checked, with "N"
+ the function is tested on every number in the interval.
WARNING: The full intervall [0..nMax] is sieved at once, even if
only a piece is needed. This may require a lot of memory!
@@ -234,6 +235,7 @@
if (begin < 2)
{
*(g->_mp_d) = begin;
+ g->_mp_size = begin;
TRACE(printf ("%li ", begin),1);
mpz_nextprime (g, g);
if (mpz_cmp_ui (g, 2) != 0)
@@ -304,6 +306,7 @@
for (;begin < 2; ++begin)
{
*(op->_mp_d) = begin;
+ op->_mp_size = begin;
TRACE(printf ("%li ", begin),1);
mpz_nextprime (g, op);
if (mpz_cmp_ui (g, 2) != 0)
@@ -396,7 +399,7 @@
if (begin >= end)
{
- fprintf (stderr, "usage: primes [n|p|c] [n0] <nMax>\n");
+ fprintf (stderr, "usage: primes [N|n|p|c] [n0] <nMax>\n");
exit (1);
}
More information about the gmp-commit
mailing list