summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMarco Bodrato <bodrato@mail.dm.unipi.it>2020-03-24 17:50:16 +0100
committerMarco Bodrato <bodrato@mail.dm.unipi.it>2020-03-24 17:50:16 +0100
commit2a9f310fc3d5e7259fc26cea2727c0ffbc6fec43 (patch)
tree54c1d5a219bee724c0d0aeda1aab9b57d289faf4 /tests
parent0ae7141ee60286ca01fdbd01b21d608029310165 (diff)
downloadgmp-2a9f310fc3d5e7259fc26cea2727c0ffbc6fec43.tar.gz
tests/devel/primes.c: Update documentation (and remove a small bug).
Diffstat (limited to 'tests')
-rw-r--r--tests/devel/primes.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/devel/primes.c b/tests/devel/primes.c
index b5b42a061..241b7ec4a 100644
--- a/tests/devel/primes.c
+++ b/tests/devel/primes.c
@@ -27,10 +27,11 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
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 @@ check_nprime (unsigned long begin, unsigned long end)
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 @@ check_Nprime (unsigned long begin, unsigned long end)
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 @@ main (int argc, char **argv)
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);
}