mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
Improve ptest and builtin help file content
This commit is contained in:
15
CHANGES
15
CHANGES
@@ -20,6 +20,14 @@ The following are the changes from calc version 2.12.6.0 to date:
|
||||
|
||||
https://github.com/lcn2/calc
|
||||
|
||||
NOTE: The calc GitHub repository represents the an active
|
||||
development stream. While an effort will be made to keep
|
||||
the master branch of the calc GitHub repository in working
|
||||
order, that tree may be unstable. Those wishing for more
|
||||
reliable releases use releases found at calc mirror sites:
|
||||
|
||||
http://www.isthe.com/chongo/tech/comp/calc/calc-mirror.html
|
||||
|
||||
Renamed README to README.FIRST. Added README.md for the
|
||||
GitHub repository.
|
||||
|
||||
@@ -34,6 +42,13 @@ The following are the changes from calc version 2.12.6.0 to date:
|
||||
Updated the calc(1) man page and 'help file' to explain about
|
||||
reading from standard input (stdin).
|
||||
|
||||
Added some clarifying remarks for 'help ptest' explaining that
|
||||
the ptest builtin can return 1 is some cases where the test
|
||||
value is a psuedoprime.
|
||||
|
||||
Removed duplicate copyright comments from the help/builtin that
|
||||
is built.
|
||||
|
||||
|
||||
The following are the changes from calc version 2.12.5.4 to 2.12.5.6:
|
||||
|
||||
|
@@ -1923,6 +1923,7 @@ HELP_PASSDOWN= \
|
||||
CP=${CP} \
|
||||
EXT=${EXT} \
|
||||
FMT=${FMT} \
|
||||
GREP=${GREP} \
|
||||
HELPDIR="${HELPDIR}" \
|
||||
ICFLAGS="${ICFLAGS}" \
|
||||
ILDFLAGS="${ILDFLAGS}" \
|
||||
|
@@ -168,6 +168,7 @@ Q=@
|
||||
LCC= cc
|
||||
ICFLAGS=
|
||||
ILDFLAGS=
|
||||
GREP= egrep
|
||||
CHMOD= chmod
|
||||
SED= sed
|
||||
SORT= sort
|
||||
@@ -596,7 +597,7 @@ builtin: builtin.top builtin.end ../func.c funclist.sed
|
||||
-I.. funclist.c -c 2>/dev/null
|
||||
${Q} ${LCC} ${ILDFLAGS} funclist.o -o funclist${EXT}
|
||||
${Q} ${RM} -f builtin
|
||||
${Q} ${CAT} builtin.top > builtin
|
||||
${Q} ${GREP} -v '^#' builtin.top > builtin
|
||||
${Q} ./funclist${EXT} | \
|
||||
${SED} -e 's/^/ /' -e 's/[ ][ ]*$$//' >> builtin
|
||||
${Q} ${CAT} builtin.end >> builtin
|
||||
|
@@ -199,7 +199,7 @@
|
||||
For convenience, any non-integer value is assumed to mean "frac",
|
||||
and any integer >= 2^64 is assumed to mean "exp".
|
||||
|
||||
## Copyright (C) 1999-2007 Landon Curt Noll
|
||||
## Copyright (C) 1999-2017 Landon Curt Noll
|
||||
##
|
||||
## Calc is open software; you can redistribute it and/or modify it under
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
|
22
help/ptest
22
help/ptest
@@ -39,6 +39,14 @@ DESCRIPTION
|
||||
trivial (n is always a strong probable prime for these bases), it
|
||||
is sufficient to consider 1 < b < n - 1.
|
||||
|
||||
Note that if ptest returns 1, this does not mean that n is
|
||||
prime! If n is composit (not prime) and a pseudoprime then
|
||||
ptest may return 1. For this reason, if ptest returns 1, this
|
||||
is not proof that n is prime.
|
||||
|
||||
If ptest returns 0, then this is proof that n is not prime
|
||||
(composit).
|
||||
|
||||
The bases for ptest(n, count, skip) are selected as follows:
|
||||
|
||||
skip = 0: random in [2, n-2]
|
||||
@@ -56,14 +64,14 @@ DESCRIPTION
|
||||
with random base b will return 1 if n is composite is always
|
||||
less than 1/4, so with count = k, the probability is less
|
||||
than 1/4^k. For most values of n the probability is much
|
||||
smaller, possible zero.
|
||||
smaller (possibly zero).
|
||||
|
||||
RUNTIME
|
||||
If n is composite, ptest(n, 1, skip) is usually faster than
|
||||
ptest(n, -1, skip), much faster if n is divisible by a small
|
||||
prime. If n is prime, ptest(n, -1, skip) is usually faster than
|
||||
ptest(n, 1, skip), possibly much faster if n < 2^32, only slightly
|
||||
faster if n > 2^32.
|
||||
If n is composite, ptest(n, 1, skip) (where skip > 0) is usually
|
||||
faster than ptest(n, -1, skip), and much faster if n is divisible
|
||||
by a small prime. If n is prime, ptest(n, -1, skip) is usually
|
||||
faster than ptest(n, 1, skip), possibly much faster if n < 2^32,
|
||||
only slightly faster if n > 2^32.
|
||||
|
||||
If n is a large prime (say 50 or more decimal digits), the runtime
|
||||
for ptest(n, count, skip) will usually be roughly K * abs(count) *
|
||||
@@ -129,7 +137,7 @@ SEE ALSO
|
||||
factor, isprime, lfactor, nextcand, nextprime, prevcand, prevprime,
|
||||
pfact, pix
|
||||
|
||||
## Copyright (C) 1999-2006 Landon Curt Noll
|
||||
## Copyright (C) 1999-2006,2017 Landon Curt Noll
|
||||
##
|
||||
## Calc is open software; you can redistribute it and/or modify it under
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
|
Reference in New Issue
Block a user