mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
Release calc version 2.12.5.5
This commit is contained in:
58
CHANGES
58
CHANGES
@@ -2,6 +2,56 @@ The following are the changes from calc version 2.12.5.4 to date:
|
||||
|
||||
Recompile to match current RHEL7.2 libc and friends.
|
||||
|
||||
Added fix by Alexandre Fedotov <fedotov at mail dot desy dot de>
|
||||
to prepend ${T} in front of the CALCPATH path components
|
||||
${CALC_SHAREDIR} and ${CUSTOMDIR}. Add ${T} in front of ${HELPDIR}
|
||||
and ${CUSTONHELPDIR} when making conf.h.
|
||||
|
||||
Improved the jacobi help page.
|
||||
|
||||
Rewrote gen_v1() in the lucas.cal resource file using the method
|
||||
based on a paper:
|
||||
|
||||
"A note on primality tests for N = h*2^n-1", by Oystein J. Rodseth,
|
||||
Department of Mathematics, University of Bergen, BIT Numerical
|
||||
Mathematics. 34 (3): pp 451-454.
|
||||
|
||||
http://folk.uib.no/nmaoy/papers/luc.pdf
|
||||
|
||||
The improved gen_v1() function is capable of returning a value
|
||||
for all valid values of h and n. As a result, the trial tables
|
||||
used by gen_v1() have been changed to a short list of values
|
||||
to try, in order ot likelyhood of success, before doing an
|
||||
enhaustive search for a v1 value to return.
|
||||
|
||||
Removed lucas_tbl.cal calc resource file. This file was made
|
||||
obsolete by the above rewrite of the lucas.cal resource file.
|
||||
This file will be removed from the local cal directory and
|
||||
from CALC_SHAREDIR during a 'make install', 'make cobber',
|
||||
and 'make uninstall'.
|
||||
|
||||
Renamed gen_u0() to gen_u2() in lucas.cal. Provided a gen_u0()
|
||||
stub function that calls gen_u2() for backward compatibility.
|
||||
|
||||
The old gen_v1() method used by the Amdahl 6 group has been
|
||||
renamed legacy_gen_v1() in lucas.cal. This function is no
|
||||
longer usde by the lucas(h, n) function to test the primality of
|
||||
h*2^n-1. It is preserved in lucas.cal for historical purposes.
|
||||
|
||||
The 'make clobber' rule will attempt to remove all files that
|
||||
start with libcalc and start with libcustcalc.
|
||||
|
||||
The 'man' command is now an alias for the 'help' command.
|
||||
|
||||
Fixed extra /'s that were put into CALCPATH because of ${T}.
|
||||
Fixed extra /'s that were compiled into HELPDIR and CUSTOMHELPDIR.
|
||||
|
||||
The fix in 2.12.5.4 to to prepend ${T} in front of the CALCPATH
|
||||
path components ${CALC_SHAREDIR} and ${CUSTOMDIR} broke the
|
||||
calc rpm build process. The check-buildroot tool discovered
|
||||
that the BUILDROOT directory had been improperly put into various
|
||||
paths and binaries. This has been fixed in 2.12.5.5.
|
||||
|
||||
|
||||
The following are the changes from calc version 2.12.5.3 to 2.12.5.3:
|
||||
|
||||
@@ -7146,7 +7196,7 @@ Following is a list of visible changes to calc from version 1.24.7 to 1.26.1:
|
||||
|
||||
A small bug in the library file regress.cal was fixed.
|
||||
|
||||
## Copyright (C) 2001-2014 Landon Curt Noll
|
||||
## Copyright (C) 2001-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
|
||||
@@ -7162,9 +7212,9 @@ Following is a list of visible changes to calc from version 1.24.7 to 1.26.1:
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## @(#) $Revision: 30.51 $
|
||||
## @(#) $Id: CHANGES,v 30.51 2016/02/22 19:37:21 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/bin/calc/RCS/CHANGES,v $
|
||||
## @(#) $Revision: 30.55 $
|
||||
## @(#) $Id: CHANGES,v 30.55 2017/05/21 02:22:22 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/bin/calc-RHEL7/RCS/CHANGES,v $
|
||||
##
|
||||
## Under source code control: 1993/06/02 18:12:57
|
||||
## File existed as early as: 1989
|
||||
|
61
Makefile
61
Makefile
@@ -23,7 +23,7 @@
|
||||
# READLINE_LIB= -lreadline
|
||||
# READLINE_EXTRAS= -lhistory -lncurses
|
||||
#
|
||||
# Copyright (C) 1999-2014 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 version 2.1 of the GNU Lesser General Public License
|
||||
@@ -39,9 +39,9 @@
|
||||
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
MAKEFILE_REV= $$Revision: 30.86 $$
|
||||
# @(#) $Id: Makefile.ship,v 30.86 2016/02/22 19:38:22 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/bin/calc/RCS/Makefile.ship,v $
|
||||
MAKEFILE_REV= $$Revision: 30.88 $$
|
||||
# @(#) $Id: Makefile.ship,v 30.88 2017/05/21 01:26:42 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/bin/calc-RHEL7/RCS/Makefile.ship,v $
|
||||
#
|
||||
# Under source code control: 1990/02/15 01:48:41
|
||||
# File existed as early as: before 1990
|
||||
@@ -787,13 +787,21 @@ ALLOW_CUSTOM= -DCUSTOM
|
||||
# Select CALCPATH= .;./cal;~/.cal;${CALC_SHAREDIR};${CUSTOMCALDIR} for DJGPP.
|
||||
#
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
ifdef RPM_TOP
|
||||
ifdef ALLOW_CUSTOM
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
CALCPATH= .:./cal:~/.cal:${CALC_SHAREDIR}:${CUSTOMCALDIR}
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
else
|
||||
CALCPATH= .:./cal:~/.cal:${CALC_SHAREDIR}
|
||||
endif
|
||||
else
|
||||
ifdef ALLOW_CUSTOM
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
CALCPATH= .:./cal:~/.cal:${T}${CALC_SHAREDIR}:${T}${CUSTOMCALDIR}
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
else
|
||||
CALCPATH= .:./cal:~/.cal:${T}${CALC_SHAREDIR}
|
||||
endif
|
||||
endif
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
|
||||
# If the $CALCRC environment variable is not defined, then the following
|
||||
@@ -984,7 +992,7 @@ EXT=
|
||||
|
||||
# The default calc versions
|
||||
#
|
||||
VERSION= 2.12.5.4
|
||||
VERSION= 2.12.5.5
|
||||
|
||||
# Names of shared libraries with versions
|
||||
#
|
||||
@@ -1083,7 +1091,7 @@ COMMON_LDFLAGS= ${EXTRA_LDFLAGS}
|
||||
# LIBCALC_SHLIB are flags given to ${CC} to build libcalc shared libraries
|
||||
# LIBCUSTCALC_SHLIB are flags given to ${CC} to build libcustcalc shared lib
|
||||
#
|
||||
# NOTE: The above 4 values are unused if BLD_TYPE= calc-static-only
|
||||
# NOTE: The above 5 values are unused if BLD_TYPE= calc-static-only
|
||||
#
|
||||
# CC_STATIC are flags given to ${CC} to build .o files suitable for static libs
|
||||
# LD_STATIC are common flags given to ${CC} to link with static libraries
|
||||
@@ -1460,10 +1468,10 @@ EXT=.exe
|
||||
TERMCONTROL= -DUSE_WIN32
|
||||
ifdef ALLOW_CUSTOM
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
CALCPATH= .;./cal;~/.cal;${CALC_SHAREDIR};${CUSTOMCALDIR}
|
||||
CALCPATH= .;./cal;~/.cal;${T}${CALC_SHAREDIR};${T}${CUSTOMCALDIR}
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
else
|
||||
CALCPATH= .;./cal;~/.cal;${CALC_SHAREDIR}
|
||||
CALCPATH= .;./cal;~/.cal;${T}${CALC_SHAREDIR}
|
||||
endif
|
||||
CALCRC= ${CALC_SHAREDIR}/startup;~/.calcrc;./.calcinit
|
||||
#
|
||||
@@ -2232,7 +2240,15 @@ conf.h: ${MAKE_FILE}
|
||||
${Q} echo '' >> conf.h
|
||||
${Q} echo '/* the location of the help directory */' >> conf.h
|
||||
${Q} echo '#if !defined(HELPDIR)' >> conf.h
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
ifdef RPM_TOP
|
||||
${Q} echo '#define HELPDIR "${HELPDIR}"' >> conf.h
|
||||
else
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
${Q} echo '#define HELPDIR "${T}${HELPDIR}"' >> conf.h
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
endif
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
${Q} echo '#endif /* HELPDIR */' >> conf.h
|
||||
${Q} echo '' >> conf.h
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
@@ -2240,7 +2256,15 @@ ifdef ALLOW_CUSTOM
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
${Q} echo '/* the location of the custom help directory */' >> conf.h
|
||||
${Q} echo '#if !defined(CUSTOMHELPDIR)' >> conf.h
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
ifdef RPM_TOP
|
||||
${Q} echo '#define CUSTOMHELPDIR "${CUSTOMHELPDIR}"' >> conf.h
|
||||
else
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
${Q} echo '#define CUSTOMHELPDIR "${T}${CUSTOMHELPDIR}"' >> conf.h
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
endif
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
${Q} echo '#endif /* CUSTOMHELPDIR */' >> conf.h
|
||||
${Q} echo '' >> conf.h
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
@@ -4104,6 +4128,13 @@ gdb:
|
||||
#
|
||||
###
|
||||
|
||||
# NOTE: Only the 2 rpm rules should set ${RPM_TOP}!
|
||||
#
|
||||
# When making calc RPM, ${RPM_TOP} will be set to the tree
|
||||
# under which rpm files are built. You should NOT set RPM_TOP
|
||||
# by yourself. Only make rpm and make rpm-preclean should
|
||||
# set this value.
|
||||
|
||||
rpm: clobber rpm-preclean rpm.mk calc.spec.in
|
||||
${V} echo '=-=-=-=-= ${MAKE_FILE} start of $@ rule =-=-=-=-='
|
||||
${MAKE} -f rpm.mk all V=${V} RPM_TOP="${RPM_TOP}"
|
||||
@@ -4259,15 +4290,15 @@ clobber: custom/Makefile clean
|
||||
${RM} -f *.pure_hardlin
|
||||
${RM} -f *.u
|
||||
${RM} -f libcalc.a
|
||||
${RM} -f libcustcalc.a
|
||||
${RM} -f calc.1 calc.usage
|
||||
${RM} -f calc.pixie calc.rf calc.Counts calc.cord
|
||||
${RM} -rf gen_h skel Makefile.bak tmp.patch
|
||||
${RM} -f calc.spec inst_files rpm.mk.patch tmp
|
||||
${RM} -f libcalc${LIB_EXT_VERSION}
|
||||
${RM} -f libcalc*${LIB_EXT}
|
||||
${RM} -f libcalc*
|
||||
${RM} -f libcustcalc${LIB_EXT_VERSION}
|
||||
${RM} -f libcustcalc*${LIB_EXT}
|
||||
${RM} -f libcustcalc.a
|
||||
${RM} -f libcustcalc*
|
||||
${RM} -f calc-static${EXT}
|
||||
${RM} -f ${CALC_STATIC_LIBS}
|
||||
${RM} -f all
|
||||
@@ -4293,6 +4324,10 @@ clobber: custom/Makefile clean
|
||||
-${MAKE} -f ${MAKE_FILE} custom/Makefile
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
${RM} -f .static .dynamic calc-dynamic-only calc-static-only
|
||||
-${Q} if [ -e .DS_Store ]; then \
|
||||
echo ${RM} -rf .DS_Store; \
|
||||
${RM} -rf .DS_Store; \
|
||||
fi
|
||||
${V} echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-='
|
||||
|
||||
# install everything
|
||||
|
@@ -23,7 +23,7 @@
|
||||
# READLINE_LIB= -lreadline
|
||||
# READLINE_EXTRAS= -lhistory -lncurses
|
||||
#
|
||||
# Copyright (C) 1999-2014 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 version 2.1 of the GNU Lesser General Public License
|
||||
@@ -39,9 +39,9 @@
|
||||
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
MAKEFILE_REV= $$Revision: 30.86 $$
|
||||
# @(#) $Id: Makefile.ship,v 30.86 2016/02/22 19:38:22 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/bin/calc/RCS/Makefile.ship,v $
|
||||
MAKEFILE_REV= $$Revision: 30.88 $$
|
||||
# @(#) $Id: Makefile.ship,v 30.88 2017/05/21 01:26:42 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/bin/calc-RHEL7/RCS/Makefile.ship,v $
|
||||
#
|
||||
# Under source code control: 1990/02/15 01:48:41
|
||||
# File existed as early as: before 1990
|
||||
@@ -771,7 +771,7 @@ ALLOW_CUSTOM= -DCUSTOM
|
||||
#
|
||||
# Select CALCPATH= .;./cal;~/.cal;${CALC_SHAREDIR};${CUSTOMCALDIR} for DJGPP.
|
||||
#
|
||||
CALCPATH= .:./cal:~/.cal:${CALC_SHAREDIR}:${CUSTOMCALDIR}
|
||||
CALCPATH= .:./cal:~/.cal:${T}${CALC_SHAREDIR}:${T}${CUSTOMCALDIR}
|
||||
|
||||
# If the $CALCRC environment variable is not defined, then the following
|
||||
# path will be searched for calc resource files.
|
||||
@@ -961,7 +961,7 @@ EXT=
|
||||
|
||||
# The default calc versions
|
||||
#
|
||||
VERSION= 2.12.5.4
|
||||
VERSION= 2.12.5.5
|
||||
|
||||
# Names of shared libraries with versions
|
||||
#
|
||||
@@ -1052,7 +1052,7 @@ COMMON_LDFLAGS= ${EXTRA_LDFLAGS}
|
||||
# LIBCALC_SHLIB are flags given to ${CC} to build libcalc shared libraries
|
||||
# LIBCUSTCALC_SHLIB are flags given to ${CC} to build libcustcalc shared lib
|
||||
#
|
||||
# NOTE: The above 4 values are unused if BLD_TYPE= calc-static-only
|
||||
# NOTE: The above 5 values are unused if BLD_TYPE= calc-static-only
|
||||
#
|
||||
# CC_STATIC are flags given to ${CC} to build .o files suitable for static libs
|
||||
# LD_STATIC are common flags given to ${CC} to link with static libraries
|
||||
@@ -1134,7 +1134,7 @@ CFLAGS= ${ICFLAGS} ${CCOPT}
|
||||
ILDFLAGS= ${COMMON_LDFLAGS} ${LD_STATIC}
|
||||
LDFLAGS= ${LD_DEBUG} ${ILDFLAGS} ${LIBCALC_STATIC} ${LIBCUSTCALC_STATIC}
|
||||
#
|
||||
CALCPATH= .;./cal;~/.cal;${CALC_SHAREDIR};${CUSTOMCALDIR}
|
||||
CALCPATH= .;./cal;~/.cal;${T}${CALC_SHAREDIR};${T}${CUSTOMCALDIR}
|
||||
|
||||
#######################################################################
|
||||
#-=-=-=-=-=- end of target section - only make rules below -=-=-=-=-=-#
|
||||
@@ -1771,12 +1771,12 @@ conf.h: ${MAKE_FILE}
|
||||
${Q} echo '' >> conf.h
|
||||
${Q} echo '/* the location of the help directory */' >> conf.h
|
||||
${Q} echo '#if !defined(HELPDIR)' >> conf.h
|
||||
${Q} echo '#define HELPDIR "${HELPDIR}"' >> conf.h
|
||||
${Q} echo '#define HELPDIR "${T}${HELPDIR}"' >> conf.h
|
||||
${Q} echo '#endif /* HELPDIR */' >> conf.h
|
||||
${Q} echo '' >> conf.h
|
||||
${Q} echo '/* the location of the custom help directory */' >> conf.h
|
||||
${Q} echo '#if !defined(CUSTOMHELPDIR)' >> conf.h
|
||||
${Q} echo '#define CUSTOMHELPDIR "${CUSTOMHELPDIR}"' >> conf.h
|
||||
${Q} echo '#define CUSTOMHELPDIR "${T}${CUSTOMHELPDIR}"' >> conf.h
|
||||
${Q} echo '#endif /* CUSTOMHELPDIR */' >> conf.h
|
||||
${Q} echo '' >> conf.h
|
||||
${Q} echo '/* the default pager to use */' >> conf.h
|
||||
@@ -3599,6 +3599,13 @@ gdb:
|
||||
#
|
||||
###
|
||||
|
||||
# NOTE: Only the 2 rpm rules should set ${RPM_TOP}!
|
||||
#
|
||||
# When making calc RPM, ${RPM_TOP} will be set to the tree
|
||||
# under which rpm files are built. You should NOT set RPM_TOP
|
||||
# by yourself. Only make rpm and make rpm-preclean should
|
||||
# set this value.
|
||||
|
||||
rpm: clobber rpm-preclean rpm.mk calc.spec.in
|
||||
${V} echo '=-=-=-=-= ${MAKE_FILE} start of $@ rule =-=-=-=-='
|
||||
${MAKE} -f rpm.mk all V=${V} RPM_TOP="${RPM_TOP}"
|
||||
@@ -3754,15 +3761,15 @@ clobber: custom/Makefile clean
|
||||
${RM} -f *.pure_hardlin
|
||||
${RM} -f *.u
|
||||
${RM} -f libcalc.a
|
||||
${RM} -f libcustcalc.a
|
||||
${RM} -f calc.1 calc.usage
|
||||
${RM} -f calc.pixie calc.rf calc.Counts calc.cord
|
||||
${RM} -rf gen_h skel Makefile.bak tmp.patch
|
||||
${RM} -f calc.spec inst_files rpm.mk.patch tmp
|
||||
${RM} -f libcalc${LIB_EXT_VERSION}
|
||||
${RM} -f libcalc*${LIB_EXT}
|
||||
${RM} -f libcalc*
|
||||
${RM} -f libcustcalc${LIB_EXT_VERSION}
|
||||
${RM} -f libcustcalc*${LIB_EXT}
|
||||
${RM} -f libcustcalc.a
|
||||
${RM} -f libcustcalc*
|
||||
${RM} -f calc-static${EXT}
|
||||
${RM} -f ${CALC_STATIC_LIBS}
|
||||
${RM} -f all
|
||||
@@ -3783,6 +3790,10 @@ clobber: custom/Makefile clean
|
||||
${RM} -f no_implicit.arg
|
||||
${RM} -f no_implicit.c no_implicit.o no_implicit${EXT}
|
||||
${RM} -f .static .dynamic calc-dynamic-only calc-static-only
|
||||
-${Q} if [ -e .DS_Store ]; then \
|
||||
echo ${RM} -rf .DS_Store; \
|
||||
${RM} -rf .DS_Store; \
|
||||
fi
|
||||
${V} echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-='
|
||||
|
||||
# install everything
|
||||
|
57
cal/Makefile
57
cal/Makefile
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# cal - makefile for calc standard resource files
|
||||
#
|
||||
# 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
|
||||
@@ -18,9 +18,9 @@
|
||||
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# @(#) $Revision: 30.11 $
|
||||
# @(#) $Id: Makefile,v 30.11 2014/09/02 07:14:49 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/bin/calc/cal/RCS/Makefile,v $
|
||||
# @(#) $Revision: 30.12 $
|
||||
# @(#) $Id: Makefile,v 30.12 2017/05/19 16:09:14 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/bin/calc-RHEL7/cal/RCS/Makefile,v $
|
||||
#
|
||||
# Under source code control: 1991/07/21 05:00:54
|
||||
# File existed as early as: 1991
|
||||
@@ -199,7 +199,7 @@ CALC_FILES= README alg_config.cal beer.cal bernoulli.cal \
|
||||
constants.cal deg.cal dms.cal dotest.cal ellip.cal factorial.cal \
|
||||
factorial2.cal gvec.cal hello.cal hms.cal infinities.cal \
|
||||
intfile.cal intnum.cal lambertw.cal linear.cal lnseries.cal \
|
||||
lucas.cal lucas_chk.cal lucas_tbl.cal mersenne.cal mfactor.cal \
|
||||
lucas.cal lucas_chk.cal mersenne.cal mfactor.cal \
|
||||
mod.cal natnumset.cal pell.cal pi.cal pix.cal pollard.cal poly.cal \
|
||||
prompt.cal psqrt.cal qtime.cal quat.cal randbitrun.cal randmprime.cal \
|
||||
randombitrun.cal randomrun.cal randrun.cal regress.cal repeat.cal \
|
||||
@@ -211,6 +211,10 @@ CALC_FILES= README alg_config.cal beer.cal bernoulli.cal \
|
||||
test8400.cal test8500.cal test8600.cal test8900.cal toomcook.cal \
|
||||
unitfrac.cal varargs.cal xx_print.cal zeta2.cal
|
||||
|
||||
# These calc files are now obsolete and are removed by the install rule.
|
||||
#
|
||||
DEAD_CALC_FILES= lucas_tbl.cal
|
||||
|
||||
# These files are found (but not built) in the distribution
|
||||
#
|
||||
DISTLIST= ${CALC_FILES} ${MAKE_FILE}
|
||||
@@ -301,6 +305,23 @@ clean:
|
||||
|
||||
clobber: clean
|
||||
${RM} -f .all
|
||||
-${Q} if [ -e .DS_Store ]; then \
|
||||
echo ${RM} -rf .DS_Store; \
|
||||
${RM} -rf .DS_Store; \
|
||||
fi
|
||||
-${Q} for i in ${DEAD_CALC_FILES} /dev/null; do \
|
||||
if [ "$$i" = "/dev/null" ]; then \
|
||||
continue; \
|
||||
fi; \
|
||||
if [ -e "${T}${CALC_SHAREDIR}/$$i" ]; then \
|
||||
echo "${RM} -f ${T}${CALC_SHAREDIR}/$$i"; \
|
||||
${RM} -f ${T}${CALC_SHAREDIR}/$$i; \
|
||||
fi; \
|
||||
if [ -e "./$$i" ]; then \
|
||||
echo "${RM} -f ./$$i"; \
|
||||
${RM} -f ./$$i; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
# install everything
|
||||
#
|
||||
@@ -333,12 +354,38 @@ install: all
|
||||
echo "installed ${T}${CALC_SHAREDIR}/$$i"; \
|
||||
fi; \
|
||||
done
|
||||
${Q} for i in ${DEAD_CALC_FILES} /dev/null; do \
|
||||
if [ "$$i" = "/dev/null" ]; then \
|
||||
continue; \
|
||||
fi; \
|
||||
if [ -e "${T}${CALC_SHAREDIR}/$$i" ]; then \
|
||||
echo "${RM} -f ${T}${CALC_SHAREDIR}/$$i"; \
|
||||
${RM} -f ${T}${CALC_SHAREDIR}/$$i; \
|
||||
fi; \
|
||||
if [ -e "./$$i" ]; then \
|
||||
echo "${RM} -f ./$$i"; \
|
||||
${RM} -f ./$$i; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
# Try to remove everything that was installed
|
||||
#
|
||||
# NOTE: Keep the uninstall rule in reverse order to the install rule
|
||||
#
|
||||
uninstall:
|
||||
- ${Q} for i in ${DEAD_CALC_FILES} /dev/null; do \
|
||||
if [ "$$i" = "/dev/null" ]; then \
|
||||
continue; \
|
||||
fi; \
|
||||
if [ -e "${T}${CALC_SHAREDIR}/$$i" ]; then \
|
||||
echo "${RM} -f ${T}${CALC_SHAREDIR}/$$i"; \
|
||||
${RM} -f ${T}${CALC_SHAREDIR}/$$i; \
|
||||
fi; \
|
||||
if [ -e "./$$i" ]; then \
|
||||
echo "${RM} -f ./$$i"; \
|
||||
${RM} -f ./$$i; \
|
||||
fi; \
|
||||
done
|
||||
-${Q} for i in ${CALC_FILES} /dev/null; do \
|
||||
if [ "$$i" = "/dev/null" ]; then \
|
||||
continue; \
|
||||
|
38
cal/README
38
cal/README
@@ -14,9 +14,12 @@ For example:
|
||||
|
||||
; read lucas
|
||||
lucas(h,n) defined
|
||||
gen_u2(h,n,v1) defined
|
||||
gen_u0(h,n,v1) defined
|
||||
rodseth_xhn(x,h,n) defined
|
||||
gen_v1(h,n) defined
|
||||
ldebug(funct,str) defined
|
||||
legacy_gen_v1(h,n) defined
|
||||
|
||||
will cause calc to load and execute the 'lucas.cal' resource file.
|
||||
Executing the resource file will cause several functions to be defined.
|
||||
@@ -792,7 +795,27 @@ lucas.cal
|
||||
|
||||
lucas(h, n)
|
||||
|
||||
Perform a primality test of h*2^n-1, with 1<=h<2*n.
|
||||
Perform a primality test of h*2^n-1.
|
||||
|
||||
gen_u2(h, n, v1)
|
||||
|
||||
Generate u(2) for h*2^n-1. This function is used by lucas(h, n),
|
||||
as the first term in the lucas sequence that is needed to
|
||||
prove that h*2^n-1 is prime or not prime.
|
||||
|
||||
NOTE: Some call this term u(0). The function gen_u0(h, n, v1)
|
||||
simply calls gen_u2(h, n, v1) for such people. :-)
|
||||
|
||||
gen_v1(h, v)
|
||||
|
||||
Generate v(1) for h*2^n-1. This function is used by lucas(h, n),
|
||||
via the gen_u2(h, n, v1), to supply the 3rd argument to gen_u2.
|
||||
|
||||
legacy_gen_v1(h, n)
|
||||
|
||||
Generate v(1) for h*2^n-1 using the legacy Amdahl 6 method.
|
||||
This function sometimes returns -1 for a few cases when
|
||||
h is a multiple of 3. This function is NOT used by lucas(h, n).
|
||||
|
||||
|
||||
lucas_chk.cal
|
||||
@@ -805,11 +828,6 @@ lucas_chk.cal
|
||||
Used by regress.cal during the 2100 test set.
|
||||
|
||||
|
||||
lucas_tbl.cal
|
||||
|
||||
Lucasian criteria for primality tables.
|
||||
|
||||
|
||||
mersenne.cal
|
||||
|
||||
mersenne(p)
|
||||
@@ -1798,7 +1816,7 @@ zeta2.cal
|
||||
for information on this special zeta function.
|
||||
|
||||
|
||||
## Copyright (C) 2000,2014 David I. Bell and Landon Curt Noll
|
||||
## Copyright (C) 2000,2014,2017 David I. Bell and Landon Curt Noll
|
||||
##
|
||||
## Primary author: Landon Curt Noll
|
||||
##
|
||||
@@ -1816,9 +1834,9 @@ zeta2.cal
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## @(#) $Revision: 30.9 $
|
||||
## @(#) $Id: README,v 30.9 2014/10/06 08:44:18 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/bin/calc/cal/RCS/README,v $
|
||||
## @(#) $Revision: 30.10 $
|
||||
## @(#) $Id: README,v 30.10 2017/05/19 16:09:14 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/bin/calc-RHEL7/cal/RCS/README,v $
|
||||
##
|
||||
## Under source code control: 1990/02/15 01:50:32
|
||||
## File existed as early as: before 1990
|
||||
|
664
cal/lucas.cal
664
cal/lucas.cal
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* lucas - perform a Lucas primality test on h*2^n-1
|
||||
*
|
||||
* Copyright (C) 1999 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
|
||||
@@ -17,9 +17,9 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.2 $
|
||||
* @(#) $Id: lucas.cal,v 30.2 2013/09/27 08:58:46 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/lucas.cal,v $
|
||||
* @(#) $Revision: 30.4 $
|
||||
* @(#) $Id: lucas.cal,v 30.4 2017/05/20 21:54:16 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc-RHEL7/cal/RCS/lucas.cal,v $
|
||||
*
|
||||
* Under source code control: 1990/05/03 16:49:51
|
||||
* File existed as early as: 1990
|
||||
@@ -28,6 +28,12 @@
|
||||
* Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
*/
|
||||
|
||||
/*
|
||||
* For a general tutorial on how to find a new largest known prime, see:
|
||||
*
|
||||
* http://www.isthe.com/chongo/tech/math/prime/prime-tutorial.pdf
|
||||
*/
|
||||
|
||||
/*
|
||||
* NOTE: This is a standard calc resource file. For information on calc see:
|
||||
*
|
||||
@@ -74,7 +80,12 @@
|
||||
* larger finds. Records were made to be broken after all!
|
||||
*/
|
||||
|
||||
/* ON GAINING A WORLD RECORD:
|
||||
/*
|
||||
* ON GAINING A WORLD RECORD:
|
||||
*
|
||||
* For a general tutorial on how to find a new largest known prime, see:
|
||||
*
|
||||
* http://www.isthe.com/chongo/tech/math/prime/prime-tutorial.pdf
|
||||
*
|
||||
* The routines in calc were designed to be portable, and to work on
|
||||
* numbers of 'sane' size. The Amdahl 6 team used a 'ultra-high speed
|
||||
@@ -83,6 +94,13 @@
|
||||
* The heart of the package was a multiplication and square routine that
|
||||
* was based on the PFA Fast Fourier Transform and on Winograd's radix FFTs.
|
||||
*
|
||||
* NOTE: While the PFA Fast Fourier Transform and Winograd's radix FFTs
|
||||
* might have been optimal for the Amdahl 6 team at the time,
|
||||
* they might not be optimal for your CPU architecture. See
|
||||
* the above mentioned tutorial for information on better
|
||||
* methods of performing multiplications and squares of very
|
||||
* large numbers.
|
||||
*
|
||||
* Having a fast computer, and a good multi-precision package are
|
||||
* critical, but one also needs to know where to look in order to have
|
||||
* a good chance at a record. Knowing what to test is beyond the scope
|
||||
@@ -139,12 +157,10 @@
|
||||
* be the factors of another candidate.
|
||||
*
|
||||
* Finally, one should eliminate all values of 'h*2^n-1' where
|
||||
* 'h*2^n+1' is divisible by a small primes. The ideas behind this
|
||||
* point is beyond the scope of this program.
|
||||
* 'h*2^n+1' is divisible by a small primes.
|
||||
*/
|
||||
|
||||
|
||||
global pprod256; /* product of "primes up to 256" / "primes up to 46" */
|
||||
pprod256 = 0; /* product of "primes up to 256" / "primes up to 46" */
|
||||
|
||||
/*
|
||||
* lucas - lucas primality test on h*2^n-1
|
||||
@@ -171,15 +187,33 @@ global pprod256; /* product of "primes up to 256" / "primes up to 46" */
|
||||
* "Introduction to Analytic Number Theory", by Tom A. Apostol,
|
||||
* Springer-Verlag, 1984, p 188.
|
||||
*
|
||||
* An excellent 5-page paper by Oystein J. Rodseth (we apologize that the
|
||||
* ASCII character set does not allow us to spell his name with the
|
||||
* umlaut marks on the O's):
|
||||
*
|
||||
* NOTE: The original Amdahl 6 method predates the publication of Ref4.
|
||||
* The gen_v1() function used by lucas() uses the Ref4 method.
|
||||
* See the 'Amdahl 6 legacy code' section below for the original
|
||||
* method of generating v(1).
|
||||
*
|
||||
* Ref4:
|
||||
*
|
||||
* "A note on primality tests for N = h*2^n-1", by Oystein J. Rodseth,
|
||||
* Department of Mathematics, University of Bergen, BIT Numerical
|
||||
* Mathematics. 34 (3): pp 451-454.
|
||||
*
|
||||
* http://folk.uib.no/nmaoy/papers/luc.pdf
|
||||
*
|
||||
* This test is performed as follows: (see Ref1, Theorem 5)
|
||||
*
|
||||
* a) generate u(0) (see the function gen_u0() below)
|
||||
* a) generate u(2) (see the function gen_u2() below)
|
||||
* (NOTE: some call this u(0))
|
||||
*
|
||||
* b) generate u(n-2) according to the rule:
|
||||
* b) generate u(n) according to the rule:
|
||||
*
|
||||
* u(i+1) = u(i)^2-2 mod h*2^n-1
|
||||
*
|
||||
* c) h*2^n-1 is prime if and only if u(n-2) == 0 Q.E.D. :-)
|
||||
* c) h*2^n-1 is prime if and only if u(n) == 0 Q.E.D. :-)
|
||||
*
|
||||
* Now the following conditions must be true for the test to work:
|
||||
*
|
||||
@@ -188,7 +222,7 @@ global pprod256; /* product of "primes up to 256" / "primes up to 46" */
|
||||
* h < 2^n
|
||||
* h mod 2 == 1
|
||||
*
|
||||
* A few misc notes:
|
||||
* A few miscellaneous notes:
|
||||
*
|
||||
* In order to reduce the number of tests, as attempt to eliminate
|
||||
* any number that is divisible by a prime less than 257. Valid prime
|
||||
@@ -222,7 +256,7 @@ lucas(h, n)
|
||||
local testval; /* h*2^n-1 */
|
||||
local shiftdown; /* the power of 2 that divides h */
|
||||
local u; /* the u(i) sequence value */
|
||||
local v1; /* the v(1) generator of u(0) */
|
||||
local v1; /* the v(1) generator of u(2) */
|
||||
local i; /* u sequence cycle number */
|
||||
local oldh; /* pre-reduced h */
|
||||
local oldn; /* pre-reduced n */
|
||||
@@ -364,18 +398,17 @@ lucas(h, n)
|
||||
}
|
||||
|
||||
/*
|
||||
* try to compute u(0)
|
||||
* try to compute u(2) (NOTE: some call this u(0))
|
||||
*
|
||||
* We will use gen_v1() to give us a v(1) using the values
|
||||
* of 'h' and 'n'. We will then use gen_u0() to convert
|
||||
* the v(1) into u(0).
|
||||
* of 'h' and 'n'. We will then use gen_u2() to convert
|
||||
* the v(1) into u(2).
|
||||
*
|
||||
* If gen_v1() returns a negative value, then we failed to
|
||||
* generate a test for h*2^n-1. This is because h mod 3 == 0
|
||||
* is hard to do, and in rare cases, exceed the tables found
|
||||
* in this program. We will generate an message and assume
|
||||
* the number is not prime, even though if we had a larger
|
||||
* table, we might have been able to show that it is prime.
|
||||
* generate a test for h*2^n-1. The legacy function,
|
||||
* legacy_gen_v1() used by the Amdahl 6 could have returned
|
||||
* -1. The new gen_v1() based on the method outlined in Ref4
|
||||
* will never return -1.
|
||||
*/
|
||||
v1 = gen_v1(h, n);
|
||||
if (v1 < 0) {
|
||||
@@ -384,10 +417,10 @@ lucas(h, n)
|
||||
ldebug("lucas", "unknown: no v(1)");
|
||||
return -1;
|
||||
}
|
||||
u = gen_u0(h, n, v1);
|
||||
u = gen_u2(h, n, v1);
|
||||
|
||||
/*
|
||||
* compute u(n-2)
|
||||
* compute u(n) (NOTE: some call this u(n-2))
|
||||
*/
|
||||
for (i=3; i <= n; ++i) {
|
||||
/* u = (u^2 - 2) % testval; */
|
||||
@@ -407,11 +440,19 @@ lucas(h, n)
|
||||
}
|
||||
|
||||
/*
|
||||
* gen_u0 - determine the initial Lucas sequence for h*2^n-1
|
||||
* gen_u2 - determine the initial Lucas sequence for h*2^n-1
|
||||
*
|
||||
* Historically many start the Lucas sequence with u(0).
|
||||
* Some, like the author of this code, prefer to start
|
||||
* with U(2). This is so one may say:
|
||||
*
|
||||
* 2^p-1 is prime if u(p) = 0 mod 2^p-1
|
||||
* or:
|
||||
* h*2^p-1 is prime if u(p) = 0 mod h*2^p-1
|
||||
*
|
||||
* According to Ref1, Theorem 5:
|
||||
*
|
||||
* u(0) = alpha^h + alpha^(-h)
|
||||
* u(2) = alpha^h + alpha^(-h) (NOTE: Ref1 calls it u(0))
|
||||
*
|
||||
* Now:
|
||||
*
|
||||
@@ -419,7 +460,7 @@ lucas(h, n)
|
||||
*
|
||||
* Therefore:
|
||||
*
|
||||
* u(0) = v(h)
|
||||
* u(2) = v(h) (NOTE: Ref1 calls it u(0))
|
||||
*
|
||||
* We calculate v(h) as follows: (Ref1, top of page 873)
|
||||
*
|
||||
@@ -447,11 +488,11 @@ lucas(h, n)
|
||||
* v1 - gen_v1(h,n) (see function below)
|
||||
*
|
||||
* returns:
|
||||
* u(0) - initial value for Lucas test on h*2^n-1
|
||||
* -1 - failed to generate u(0)
|
||||
* u(2) - initial value for Lucas test on h*2^n-1
|
||||
* -1 - failed to generate u(2)
|
||||
*/
|
||||
define
|
||||
gen_u0(h, n, v1)
|
||||
gen_u2(h, n, v1)
|
||||
{
|
||||
local shiftdown; /* the power of 2 that divides h */
|
||||
local r; /* low value: v(n) */
|
||||
@@ -500,7 +541,7 @@ gen_u0(h, n, v1)
|
||||
* at least 2 bits long for the loop below to work.
|
||||
*/
|
||||
if (h == 1) {
|
||||
ldebug("gen_u0", "quick h == 1 case");
|
||||
ldebug("gen_u2", "quick h == 1 case");
|
||||
/* return r%(h*2^n-1); */
|
||||
return hnrmod(r, h, n, -1);
|
||||
}
|
||||
@@ -540,21 +581,502 @@ gen_u0(h, n, v1)
|
||||
return r;
|
||||
}
|
||||
|
||||
/*
|
||||
* gen_u0 - determine the initial Lucas sequence for h*2^n-1
|
||||
*
|
||||
* Historically many start the Lucas sequence with u(0).
|
||||
* Some, like the author of this code, prefer to start
|
||||
* with u(2). This is so one may say:
|
||||
*
|
||||
* 2^p-1 is prime if u(p) = 0 mod 2^p-1
|
||||
* or:
|
||||
* h*2^n-1 is prime if U(n) = 0 mod h*2^n-1
|
||||
*
|
||||
* For those using the old code with gen_u0(), we
|
||||
* simply call gen_u2() instead.
|
||||
*
|
||||
* See the function gen_u2() for details.
|
||||
*
|
||||
* input:
|
||||
* h - h as in h*2^n-1
|
||||
* n - n as in h*2^n-1
|
||||
* v1 - gen_v1(h,n) (see function below)
|
||||
*
|
||||
* returns:
|
||||
* u(2) - initial value for Lucas test on h*2^n-1
|
||||
* -1 - failed to generate u(2)
|
||||
*/
|
||||
define
|
||||
gen_u0(h, n, v1)
|
||||
{
|
||||
return gen_u2(h, n, v1);
|
||||
}
|
||||
|
||||
/*
|
||||
* rodseth_xhn - determine if v(1) == x for h*2^n-1
|
||||
*
|
||||
* For a given h*2^n-1, v(1) == x if:
|
||||
*
|
||||
* jacobi(x-2, h*2^n-1) == 1 (Ref4, condition 1) part 1
|
||||
* jacobi(x+2, h*2^n-1) == -1 (Ref4, condition 1) part 2
|
||||
*
|
||||
* Now when x-2 <= 0:
|
||||
*
|
||||
* jacobi(x-2, h*2^n-1) == 0
|
||||
*
|
||||
* because:
|
||||
*
|
||||
* jacobi(x,y) == 0 if x <= 0
|
||||
*
|
||||
* So for (Ref4, condition 1) part 1 to be true:
|
||||
*
|
||||
* x-2 > 0
|
||||
*
|
||||
* And therefore:
|
||||
*
|
||||
* x > 2
|
||||
*
|
||||
* input:
|
||||
* x - potential v(1) value
|
||||
* h - h as in h*2^n-1
|
||||
* n - n as in h*2^n-1
|
||||
*
|
||||
* returns:
|
||||
* 1 if v(1) == x for h*2^n-1
|
||||
* 0 otherwise
|
||||
*/
|
||||
define
|
||||
rodseth_xhn(x, h, n)
|
||||
{
|
||||
local testval; /* h*2^n-1 */
|
||||
|
||||
/*
|
||||
* check arg types
|
||||
*/
|
||||
if (!isint(h)) {
|
||||
quit "bad args: h must be an integer";
|
||||
}
|
||||
if (!isint(n)) {
|
||||
quit "bad args: n must be an integer";
|
||||
}
|
||||
if (!isint(x)) {
|
||||
quit "bad args: x must be an integer";
|
||||
}
|
||||
|
||||
/*
|
||||
* firewall
|
||||
*/
|
||||
if (x <= 2) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for jacobi(x-2, h*2^n-1) == 1 (Ref4, condition 1) part 1
|
||||
*/
|
||||
testval = h*2^n-1;
|
||||
if (jacobi(x-2, testval) != 1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for jacobi(x+2, h*2^n-1) == -1 (Ref4, condition 1) part 2
|
||||
*/
|
||||
if (jacobi(x+2, testval) != -1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* v(1) == x for this h*2^n-1
|
||||
*/
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Trial tables used by gen_v1()
|
||||
*
|
||||
* When h mod 3 == 0, one needs particular values of D, a and b (see gen_v1
|
||||
* documentation) in order to find a value of v(1).
|
||||
* When h mod 3 == 0, according to Ref4 we need to find the first value X where:
|
||||
*
|
||||
* This table defines 'quickmax' possible tests to be taken in ascending
|
||||
* order. The v1_qval[x] refers to a v(1) value from Ref1, Table 1. A
|
||||
* related D value is found in d_qval[x]. All D values expect d_qval[1]
|
||||
* are also taken from Ref1, Table 1. The case of D == 21 as listed in
|
||||
* Ref1, Table 1 can be changed to D == 7 for the sake of the test because
|
||||
* of {note 6}.
|
||||
* jacobi(X-2, h*2^n-1) == 1 (Ref4, condition 1) part 1
|
||||
* jacobi(X+2, h*2^n-1) == -1 (Ref4, condition 1) part 2
|
||||
*
|
||||
* We can show that X > 2. See the comments in the rodseth_xhn(x,h,n) above.
|
||||
*
|
||||
* Some values of X satisfy more often than others. For example a large sample
|
||||
* of odd h, h multiple of 3 and large n (some around 1e4, some near 1e6, others
|
||||
* near 3e7) where the sample size was 66 973 365, here is the count of the
|
||||
* smallest value of X that satisfies conditions in Ref4, condition 1:
|
||||
*
|
||||
* count X
|
||||
* ----------
|
||||
* 26791345 3
|
||||
* 17223016 5
|
||||
* 7829600 9
|
||||
* 6988774 11
|
||||
* 3301093 15
|
||||
* 1517149 17
|
||||
* 910346 21
|
||||
* 711791 29
|
||||
* 573403 20
|
||||
* 390395 27
|
||||
* 288637 35
|
||||
* 149751 36
|
||||
* 107733 39
|
||||
* 58743 41
|
||||
* 35619 45
|
||||
* 25052 32
|
||||
* 17775 51
|
||||
* 13031 44
|
||||
* 7563 56
|
||||
* 7540 49
|
||||
* 7060 59
|
||||
* 4407 57
|
||||
* 2948 65
|
||||
* 2502 55
|
||||
* 2388 69
|
||||
* 2094 71
|
||||
* 689 77
|
||||
* 626 81
|
||||
* 491 66
|
||||
* 426 95
|
||||
* 219 80
|
||||
* 203 67
|
||||
* 185 84
|
||||
* 152 99
|
||||
* 127 72
|
||||
* 102 74
|
||||
* 98 87
|
||||
* 67 90
|
||||
* 55 104
|
||||
* 48 101
|
||||
* 32 105
|
||||
* 17 109
|
||||
* 16 116
|
||||
* 15 111
|
||||
* 13 92
|
||||
* 12 125
|
||||
* 7 129
|
||||
* 3 146
|
||||
* 2 140
|
||||
* 2 120
|
||||
* 1 165
|
||||
* 1 161
|
||||
* 1 155
|
||||
*
|
||||
* The above distribution was found to hold fairly well over many values of
|
||||
* odd h that are a multiple of 3 and for many values of n where h < 2^n.
|
||||
*
|
||||
* Given this information, when odd h is a multiple of 3 we try, in order,
|
||||
* these values of X:
|
||||
*
|
||||
* 3, 5, 9, 11, 15, 17, 21, 29, 20, 27, 35, 36, 39, 41, 45, 32, 51, 44,
|
||||
* 56, 49, 59, 57, 65, 55, 69, 71, 77, 81, 66, 95, 80, 67, 84, 99, 72,
|
||||
* 74, 87, 90, 104, 101, 105, 109, 116, 111, 92
|
||||
*
|
||||
* And stop on the first value of X where:
|
||||
*
|
||||
* jacobi(X-2, h*2^n-1) == 1
|
||||
* jacobi(X+2, h*2^n-1) == -1
|
||||
*
|
||||
* If no value in that list works, we start simple search starting with X = 120
|
||||
* and incrementing by 1 until a value of X is found.
|
||||
*
|
||||
* The x_tbl[] matrix contains those common values of X to try in order.
|
||||
* If all x_tbl_len fail to satisfy Ref4 condition 1, then we begin a
|
||||
* linear search at next_x until we find a proper X value.
|
||||
*
|
||||
* IMPORTANT NOTE: Using this table will not find the smallest possible v(1)
|
||||
* for a given h and n. This is not a problem because using
|
||||
* a larger value of v(1) does not impact the primality test.
|
||||
* Furthermore after lucas(h, n) generates a few u(n) terms,
|
||||
* the values will wrap (due to computing mod h*2^n-1).
|
||||
* Finally on average, about 1/4 of the values of X work as
|
||||
* v(1) for a given n when h is a multiple of 3. Skipping
|
||||
* rarely used v(1) will not doom gen_v1() to a long search.
|
||||
*/
|
||||
x_tbl_len = 45;
|
||||
mat x_tbl[x_tbl_len];
|
||||
x_tbl = {
|
||||
3, 5, 9, 11, 15, 17, 21, 29, 20, 27, 35, 36, 39, 41, 45, 32, 51, 44,
|
||||
56, 49, 59, 57, 65, 55, 69, 71, 77, 81, 66, 95, 80, 67, 84, 99, 72,
|
||||
74, 87, 90, 104, 101, 105, 109, 116, 111, 92
|
||||
};
|
||||
next_x = 120;
|
||||
|
||||
/*
|
||||
* gen_v1 - compute the v(1) for a given h*2^n-1 if we can
|
||||
*
|
||||
* This function assumes:
|
||||
*
|
||||
* n > 2 (n==2 has already been eliminated)
|
||||
* h mod 2 == 1
|
||||
* h < 2^n
|
||||
* h*2^n-1 mod 3 != 0 (h*2^n-1 has no small factors, such as 3)
|
||||
*
|
||||
* The generation of v(1) depends on the value of h. There are two cases
|
||||
* to consider, h mod 3 != 0, and h mod 3 == 0.
|
||||
*
|
||||
***
|
||||
*
|
||||
* Case 1: (h mod 3 != 0)
|
||||
*
|
||||
* This case is easy.
|
||||
*
|
||||
* In Ref1, page 869, one finds that if: (or see Ref2, page 131-132)
|
||||
*
|
||||
* h mod 6 == +/-1
|
||||
* h*2^n-1 mod 3 != 0
|
||||
*
|
||||
* which translates, gives the functions assumptions, into the condition:
|
||||
*
|
||||
* h mod 3 != 0
|
||||
*
|
||||
* If this case condition is true, then:
|
||||
*
|
||||
* u(2) = (2+sqrt(3))^h + (2-sqrt(3))^h (see Ref1, page 869)
|
||||
* = (2+sqrt(3))^h + (2+sqrt(3))^(-h) (NOTE: some call this u(2))
|
||||
*
|
||||
* and since Ref1, Theorem 5 states:
|
||||
*
|
||||
* u(2) = alpha^h + alpha^(-h) (NOTE: some call this u(2))
|
||||
* r = abs(2^2 - 1^2*3) = 1
|
||||
*
|
||||
* and the bottom of Ref1, page 872 states:
|
||||
*
|
||||
* v(x) = alpha^x + alpha^(-x)
|
||||
*
|
||||
* If we let:
|
||||
*
|
||||
* alpha = (2+sqrt(3))
|
||||
*
|
||||
* then
|
||||
*
|
||||
* u(2) = v(h) (NOTE: some call this u(2))
|
||||
*
|
||||
* so we simply return
|
||||
*
|
||||
* v(1) = alpha^1 + alpha^(-1)
|
||||
* = (2+sqrt(3)) + (2-sqrt(3))
|
||||
* = 4
|
||||
*
|
||||
***
|
||||
*
|
||||
* Case 2: (h mod 3 == 0)
|
||||
*
|
||||
* For the case where h is a multiple of 3, we turn to Ref4.
|
||||
*
|
||||
* The central theorem on page 3 of that paper states that
|
||||
* we may set v(1) to the first value X that satisfies:
|
||||
*
|
||||
* jacobi(X-2, h*2^n-1) == 1 (Ref4, condition 1)
|
||||
* jacobi(X+2, h*2^n-1) == -1 (Ref4, condition 1)
|
||||
*
|
||||
* NOTE: Ref4 uses P, which we shall refer to as X.
|
||||
* Ref4 uses N, which we shall refer to as h*2^n-1.
|
||||
*
|
||||
* NOTE: Ref4 uses the term Legendre-Jacobi symbol, which
|
||||
* we shall refer to as the Jacobi symbol.
|
||||
*
|
||||
* Before we address the two conditions, we need some background information
|
||||
* on two symbols, Legendre and Jacobi. In Ref 2, pp 278, 284-285, we find
|
||||
* the following definitions of jacobi(a,b) and L(a,p):
|
||||
*
|
||||
* The Legendre symbol L(a,p) takes the value:
|
||||
*
|
||||
* L(a,p) == 1 => a is a quadratic residue of p
|
||||
* L(a,p) == -1 => a is NOT a quadratic residue of p
|
||||
*
|
||||
* when:
|
||||
*
|
||||
* p is prime
|
||||
* p mod 2 == 1
|
||||
* gcd(a,p) == 1
|
||||
*
|
||||
* The value a is a quadratic residue of b if there exists some integer z
|
||||
* such that:
|
||||
*
|
||||
* z^2 mod b == a
|
||||
*
|
||||
* The Jacobi symbol jacobi(a,b) takes the value:
|
||||
*
|
||||
* jacobi(a,b) == 1 => b is not prime,
|
||||
* or a is a quadratic residue of b
|
||||
* jacobi(a,b) == -1 => a is NOT a quadratic residue of b
|
||||
*
|
||||
* when
|
||||
*
|
||||
* b mod 2 == 1
|
||||
* gcd(a,b) == 1
|
||||
*
|
||||
* It is worth noting for the Legendre symbol, in order for L(X+/-2,
|
||||
* h*2^n-1) to be defined, we must ensure that neither X-2 nor X+2 are
|
||||
* factors of h*2^n-1. This is done by pre-screening h*2^n-1 to not
|
||||
* have small factors and keeping X+2 less than that small factor
|
||||
* limit. It is worth noting that in lucas(h, n), we first verify
|
||||
* that h*2^n-1 does not have a factor < 257 before performing the
|
||||
* primality test. So while X+/-2 < 257, we know that
|
||||
* gcd(X+/-2, h*2^n-1) == 1.
|
||||
*
|
||||
* Returning to the testing of conditions in Ref4, condition 1:
|
||||
*
|
||||
* jacobi(X-2, h*2^n-1) == 1
|
||||
* jacobi(X+2, h*2^n-1) == -1
|
||||
*
|
||||
* When such an X is found, we set:
|
||||
*
|
||||
* v(1) = X
|
||||
*
|
||||
***
|
||||
*
|
||||
* In conclusion, we can compute v,(1) by attempting to do the following:
|
||||
*
|
||||
* h mod 3 != 0
|
||||
*
|
||||
* we return:
|
||||
*
|
||||
* v(1) == 4
|
||||
*
|
||||
* h mod 3 == 0
|
||||
*
|
||||
* we return:
|
||||
*
|
||||
* v(1) = X
|
||||
*
|
||||
* where X > 2 in a integer such that:
|
||||
*
|
||||
* jacobi(X-2, h*2^n-1) == 1
|
||||
* jacobi(X+2, h*2^n-1) == -1
|
||||
*
|
||||
***
|
||||
*
|
||||
* input:
|
||||
* h h as in h*2^n-1
|
||||
* n n as in h*2^n-1
|
||||
*
|
||||
* output:
|
||||
* returns v(1), or -1 is there is no quick way
|
||||
*/
|
||||
define
|
||||
gen_v1(h, n)
|
||||
{
|
||||
local x; /* potential v(1) to test */
|
||||
local i; /* x_tbl index */
|
||||
|
||||
/*
|
||||
* check arg types
|
||||
*/
|
||||
if (!isint(h)) {
|
||||
quit "bad args: h must be an integer";
|
||||
}
|
||||
if (!isint(n)) {
|
||||
quit "bad args: n must be an integer";
|
||||
}
|
||||
|
||||
/*
|
||||
* check for Case 1: (h mod 3 != 0)
|
||||
*/
|
||||
if (h % 3 != 0) {
|
||||
/* v(1) is easy to compute */
|
||||
return 4;
|
||||
}
|
||||
|
||||
/*
|
||||
* What follow is Case 2: (h mod 3 == 0)
|
||||
*/
|
||||
|
||||
/*
|
||||
* We will look for x that satisfies conditions in Ref4, condition 1:
|
||||
*
|
||||
* jacobi(X-2, h*2^n-1) == 1 part 1
|
||||
* jacobi(X+2, h*2^n-1) == -1 part 2
|
||||
*/
|
||||
for (i=0; i < x_tbl_len; ++i) {
|
||||
|
||||
/*
|
||||
* test Ref4 condition 1:
|
||||
*/
|
||||
x = x_tbl[i];
|
||||
if (rodseth_xhn(x, h, n) == 1) {
|
||||
|
||||
/*
|
||||
* found a x that satisfies Ref4 condition 1
|
||||
*/
|
||||
ldebug("gen_v1", "h= " + str(h) + " n= " + str(n) +
|
||||
" v1= " + str(x) + " using tbl[ " +
|
||||
str(i) + " ]");
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* We are in that rare case (about 1 in 2 300 000) where none of the
|
||||
* common X values satisfy Ref4 condition 1. We start a linear search
|
||||
* at next_x from here on.
|
||||
*
|
||||
* However, we also need to keep in mind that when x+2 >= 257, we
|
||||
* need to verify that gcd(x-2, h*2^n-1) == 1 and
|
||||
* and to verify that gcd(x+2, h*2^n-1) == 1.
|
||||
*/
|
||||
x = next_x;
|
||||
while (rodseth_xhn(x, h, n) != 1) {
|
||||
++x;
|
||||
}
|
||||
/* finally found a v(1) value */
|
||||
ldebug("gen_v1", "h= " + str(h) + " n= " + str(n) +
|
||||
" v1= " + str(x) + " beyond tbl");
|
||||
return x;
|
||||
}
|
||||
|
||||
/*
|
||||
* ldebug - print a debug statement
|
||||
*
|
||||
* input:
|
||||
* funct name of calling function
|
||||
* str string to print
|
||||
*/
|
||||
define
|
||||
ldebug(funct, str)
|
||||
{
|
||||
if (config("resource_debug") & 8) {
|
||||
print "DEBUG:", funct:":", str;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
************************
|
||||
* Amdahl 6 legacy code *
|
||||
************************
|
||||
*
|
||||
* NOTE: What follows is legacy code based on the method used by the
|
||||
* Amdahl 6 group:
|
||||
*
|
||||
* John Brown, Landon Curt Noll, Bodo Parady, Gene Smith,
|
||||
* Joel Smith and Sergio Zarantonello
|
||||
*
|
||||
* This method generated v(1) for nearly all values, except for a
|
||||
* few rare cases when h mod 3 == 0. The code is NOT used by lucas.cal
|
||||
* above. The gen_v1() function above is based on an improved method
|
||||
* outlined in Ref4. That method generated v(1) for all h.
|
||||
*
|
||||
* The code below is kept for historical purposes only. The functions
|
||||
* and global variables of the Amdahl 6 legacy code all begin with legacy_.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Trial tables used by legacy_gen_v1()
|
||||
*
|
||||
* When h mod 3 == 0, one needs particular values of D, a and b (see
|
||||
* legacy_gen_v1 documentation) in order to find a value of v(1).
|
||||
*
|
||||
* This table defines 'legacy_quickmax' possible tests to be taken in ascending
|
||||
* order. The legacy_v1_qval[x] refers to a v(1) value from Ref1, Table 1. A
|
||||
* related D value is found in legacy_d_qval[x]. All D values expect
|
||||
* legacy_d_qval[1] are also taken from Ref1, Table 1. The case of D == 21 as
|
||||
* listed in Ref1, Table 1 can be changed to D == 7 for the sake of the test
|
||||
* because of {note 6}.
|
||||
*
|
||||
* It should be noted that the D values all satisfy the selection values
|
||||
* as outlined in the gen_v1() function comments. That is:
|
||||
* as outlined in the legacy_gen_v1() function comments. That is:
|
||||
*
|
||||
* D == P*(2^f)*(3^g)
|
||||
*
|
||||
@@ -571,20 +1093,20 @@ gen_u0(h, n, v1)
|
||||
* where Q == 1. No further processing is needed to compute v(1) when r
|
||||
* is of this form.
|
||||
*/
|
||||
quickmax = 8;
|
||||
mat d_qval[quickmax];
|
||||
mat v1_qval[quickmax];
|
||||
d_qval[0] = 5; v1_qval[0] = 3; /* a=1 b=1 r=4 */
|
||||
d_qval[1] = 7; v1_qval[1] = 5; /* a=3 b=1 r=12 D=21 */
|
||||
d_qval[2] = 13; v1_qval[2] = 11; /* a=3 b=1 r=4 */
|
||||
d_qval[3] = 11; v1_qval[3] = 20; /* a=3 b=1 r=2 */
|
||||
d_qval[4] = 29; v1_qval[4] = 27; /* a=5 b=1 r=4 */
|
||||
d_qval[5] = 53; v1_qval[5] = 51; /* a=53 b=1 r=4 */
|
||||
d_qval[6] = 17; v1_qval[6] = 66; /* a=17 b=1 r=1 */
|
||||
d_qval[7] = 19; v1_qval[7] = 74; /* a=38 b=1 r=2 */
|
||||
legacy_quickmax = 8;
|
||||
mat legacy_d_qval[legacy_quickmax];
|
||||
mat legacy_v1_qval[legacy_quickmax];
|
||||
legacy_d_qval[0] = 5; legacy_v1_qval[0] = 3; /* a=1 b=1 r=4 */
|
||||
legacy_d_qval[1] = 7; legacy_v1_qval[1] = 5; /* a=3 b=1 r=12 D=21 */
|
||||
legacy_d_qval[2] = 13; legacy_v1_qval[2] = 11; /* a=3 b=1 r=4 */
|
||||
legacy_d_qval[3] = 11; legacy_v1_qval[3] = 20; /* a=3 b=1 r=2 */
|
||||
legacy_d_qval[4] = 29; legacy_v1_qval[4] = 27; /* a=5 b=1 r=4 */
|
||||
legacy_d_qval[5] = 53; legacy_v1_qval[5] = 51; /* a=53 b=1 r=4 */
|
||||
legacy_d_qval[6] = 17; legacy_v1_qval[6] = 66; /* a=17 b=1 r=1 */
|
||||
legacy_d_qval[7] = 19; legacy_v1_qval[7] = 74; /* a=38 b=1 r=2 */
|
||||
|
||||
/*
|
||||
* gen_v1 - compute the v(1) for a given h*2^n-1 if we can
|
||||
* legacy_gen_v1 - compute the v(1) for a given h*2^n-1 if we can
|
||||
*
|
||||
* This function assumes:
|
||||
*
|
||||
@@ -613,12 +1135,12 @@ d_qval[7] = 19; v1_qval[7] = 74; /* a=38 b=1 r=2 */
|
||||
*
|
||||
* If this case condition is true, then:
|
||||
*
|
||||
* u(0) = (2+sqrt(3))^h + (2-sqrt(3))^h (see Ref1, page 869)
|
||||
* = (2+sqrt(3))^h + (2+sqrt(3))^(-h)
|
||||
* u(2) = (2+sqrt(3))^h + (2-sqrt(3))^h (see Ref1, page 869)
|
||||
* = (2+sqrt(3))^h + (2+sqrt(3))^(-h) (some call this u(0))
|
||||
*
|
||||
* and since Ref1, Theorem 5 states:
|
||||
*
|
||||
* u(0) = alpha^h + alpha^(-h)
|
||||
* u(2) = alpha^h + alpha^(-h)
|
||||
* r = abs(2^2 - 1^2*3) = 1
|
||||
*
|
||||
* and the bottom of Ref1, page 872 states:
|
||||
@@ -631,7 +1153,7 @@ d_qval[7] = 19; v1_qval[7] = 74; /* a=38 b=1 r=2 */
|
||||
*
|
||||
* then
|
||||
*
|
||||
* u(0) = v(h)
|
||||
* u(2) = v(h)
|
||||
*
|
||||
* so we simply return
|
||||
*
|
||||
@@ -666,7 +1188,7 @@ d_qval[7] = 19; v1_qval[7] = 74; /* a=38 b=1 r=2 */
|
||||
*
|
||||
* where L(x,y) is the Legendre symbol (see below), then:
|
||||
*
|
||||
* u(0) = alpha^h + alpha^(-h)
|
||||
* u(2) = alpha^h + alpha^(-h)
|
||||
*
|
||||
* The bottom of Ref1, page 872 states:
|
||||
*
|
||||
@@ -674,7 +1196,7 @@ d_qval[7] = 19; v1_qval[7] = 74; /* a=38 b=1 r=2 */
|
||||
*
|
||||
* thus since:
|
||||
*
|
||||
* u(0) = v(h)
|
||||
* u(2) = v(h)
|
||||
*
|
||||
* so we want to return:
|
||||
*
|
||||
@@ -929,7 +1451,7 @@ d_qval[7] = 19; v1_qval[7] = 74; /* a=38 b=1 r=2 */
|
||||
* returns v(1), or -1 is there is no quick way
|
||||
*/
|
||||
define
|
||||
gen_v1(h, n)
|
||||
legacy_gen_v1(h, n)
|
||||
{
|
||||
local d; /* the 'D' value to try */
|
||||
local val_mod; /* h*2^n-1 mod 'D' */
|
||||
@@ -947,10 +1469,10 @@ gen_v1(h, n)
|
||||
* We will try all 'D' values until we find a proper v(1)
|
||||
* or run out of 'D' values.
|
||||
*/
|
||||
for (i=0; i < quickmax; ++i) {
|
||||
for (i=0; i < legacy_quickmax; ++i) {
|
||||
|
||||
/* grab our 'D' value */
|
||||
d = d_qval[i];
|
||||
d = legacy_d_qval[i];
|
||||
|
||||
/* compute h*2^n-1 mod 'D' quickly */
|
||||
val_mod = (h*pmod(2,n%(d-1),d)-1) % d;
|
||||
@@ -965,13 +1487,13 @@ gen_v1(h, n)
|
||||
/* D mod 4 == 1, so check for J(D, h*2^n-1) == -1 */
|
||||
if (jacobi(val_mod, d) == -1) {
|
||||
/* it worked, return the related v(1) value */
|
||||
return v1_qval[i];
|
||||
return legacy_v1_qval[i];
|
||||
}
|
||||
} else {
|
||||
/* D mod 4 == -1, so check for J(D, h*2^n-1) == 1 */
|
||||
if (jacobi(val_mod, d) == 1) {
|
||||
/* it worked, return the related v(1) value */
|
||||
return v1_qval[i];
|
||||
return legacy_v1_qval[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1029,19 +1551,3 @@ gen_v1(h, n)
|
||||
/* no quick and dirty v(1), so return -1 */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* ldebug - print a debug statement
|
||||
*
|
||||
* input:
|
||||
* funct name of calling function
|
||||
* str string to print
|
||||
*/
|
||||
define
|
||||
ldebug(funct, str)
|
||||
{
|
||||
if (config("resource_debug") & 8) {
|
||||
print "DEBUG:", funct:":", str;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@@ -1,165 +0,0 @@
|
||||
/*
|
||||
* lucas_tbl - lucasian criteria for primality tables
|
||||
*
|
||||
* Copyright (C) 1999 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
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* Calc is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
||||
* Public License for more details.
|
||||
*
|
||||
* A copy of version 2.1 of the GNU Lesser General Public License is
|
||||
* distributed with calc under the filename COPYING-LGPL. You should have
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.1 $
|
||||
* @(#) $Id: lucas_tbl.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/lucas_tbl.cal,v $
|
||||
*
|
||||
* Under source code control: 1991/01/26 02:43:43
|
||||
* File existed as early as: 1991
|
||||
*
|
||||
* chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
* Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
*/
|
||||
|
||||
/*
|
||||
* Lucasian criteria for primality
|
||||
*
|
||||
* The following table is taken from:
|
||||
*
|
||||
* "Lucasian Criteria for the Primality of N=h*2^n-1", by Hans Riesel,
|
||||
* Mathematics of Computation, Vol 23 #108, p 872.
|
||||
*
|
||||
* The index of the *_val[] arrays correspond to the v(1) values found
|
||||
* in the table. That is, for v(1) == x:
|
||||
*
|
||||
* D == d_val[x]
|
||||
* a == a_val[x]
|
||||
* b == b_val[x]
|
||||
* r == r_val[x] (r == abs(a^2 - b^2*D))
|
||||
*
|
||||
*
|
||||
* Note that when *_val[i] is not a number, the related v(1) value
|
||||
* is not found in Table 1.
|
||||
*/
|
||||
|
||||
|
||||
trymax = 100;
|
||||
mat d_val[trymax+1];
|
||||
mat a_val[trymax+1];
|
||||
mat b_val[trymax+1];
|
||||
mat r_val[trymax+1];
|
||||
/* v1= 0 INVALID */
|
||||
/* v1= 1 INVALID */
|
||||
/* v1= 2 INVALID */
|
||||
d_val[ 3]= 5; a_val[ 3]= 1; b_val[ 3]=1; r_val[ 3]=4;
|
||||
d_val[ 4]= 3; a_val[ 4]= 1; b_val[ 4]=1; r_val[ 4]=2;
|
||||
d_val[ 5]= 21; a_val[ 5]= 3; b_val[ 5]=1; r_val[ 5]=12;
|
||||
d_val[ 6]= 2; a_val[ 6]= 1; b_val[ 6]=1; r_val[ 6]=1;
|
||||
/* v1= 7 INVALID */
|
||||
d_val[ 8]= 15; a_val[ 8]= 3; b_val[ 8]=1; r_val[ 8]=6;
|
||||
d_val[ 9]= 77; a_val[ 9]= 7; b_val[ 9]=1; r_val[ 9]=28;
|
||||
d_val[10]= 6; a_val[10]= 2; b_val[10]=1; r_val[10]=2;
|
||||
d_val[11]= 13; a_val[11]= 3; b_val[11]=1; r_val[11]=4;
|
||||
d_val[12]= 35; a_val[12]= 5; b_val[12]=1; r_val[12]=10;
|
||||
d_val[13]= 165; a_val[13]=11; b_val[13]=1; r_val[13]=44;
|
||||
/* v1=14 INVALID */
|
||||
d_val[15]= 221; a_val[15]=13; b_val[15]=1; r_val[15]=52;
|
||||
d_val[16]= 7; a_val[16]= 3; b_val[16]=1; r_val[16]=2;
|
||||
d_val[17]= 285; a_val[17]=15; b_val[17]=1; r_val[17]=60;
|
||||
/* v1=18 INVALID */
|
||||
d_val[19]= 357; a_val[19]=17; b_val[19]=1; r_val[19]=68;
|
||||
d_val[20]= 11; a_val[20]= 3; b_val[20]=1; r_val[20]=2;
|
||||
d_val[21]= 437; a_val[21]=19; b_val[21]=1; r_val[21]=76;
|
||||
d_val[22]= 30; a_val[22]= 5; b_val[22]=1; r_val[22]=5;
|
||||
/* v1=23 INVALID */
|
||||
d_val[24]= 143; a_val[24]=11; b_val[24]=1; r_val[24]=22;
|
||||
d_val[25]= 69; a_val[25]= 9; b_val[25]=1; r_val[25]=12;
|
||||
d_val[26]= 42; a_val[26]= 6; b_val[26]=1; r_val[26]=6;
|
||||
d_val[27]= 29; a_val[27]= 5; b_val[27]=1; r_val[27]=4;
|
||||
d_val[28]= 195; a_val[28]=13; b_val[28]=1; r_val[28]=26;
|
||||
d_val[29]= 93; a_val[29]= 9; b_val[29]=1; r_val[29]=12;
|
||||
d_val[30]= 14; a_val[30]= 4; b_val[30]=1; r_val[30]=2;
|
||||
d_val[31]= 957; a_val[31]=29; b_val[31]=1; r_val[31]=116;
|
||||
d_val[32]= 255; a_val[32]=15; b_val[32]=1; r_val[32]=30;
|
||||
d_val[33]=1085; a_val[33]=31; b_val[33]=1; r_val[33]=124;
|
||||
/* v1=34 INVALID */
|
||||
d_val[35]=1221; a_val[35]=33; b_val[35]=1; r_val[35]=132;
|
||||
d_val[36]= 323; a_val[36]=17; b_val[36]=1; r_val[36]=34;
|
||||
d_val[37]=1365; a_val[37]=35; b_val[37]=1; r_val[37]=140;
|
||||
d_val[38]= 10; a_val[38]= 3; b_val[38]=1; r_val[38]=1;
|
||||
d_val[39]=1517; a_val[39]=37; b_val[39]=1; r_val[39]=148;
|
||||
d_val[40]= 399; a_val[40]=19; b_val[40]=1; r_val[40]=38;
|
||||
d_val[41]=1677; a_val[41]=39; b_val[41]=1; r_val[41]=156;
|
||||
d_val[42]= 110; a_val[42]=10; b_val[42]=1; r_val[42]=10;
|
||||
d_val[43]= 205; a_val[43]=15; b_val[43]=1; r_val[43]=20;
|
||||
d_val[44]= 483; a_val[44]=21; b_val[44]=1; r_val[44]=42;
|
||||
d_val[45]=2021; a_val[45]=43; b_val[45]=1; r_val[45]=172;
|
||||
d_val[46]= 33; a_val[46]= 6; b_val[46]=1; r_val[46]=3;
|
||||
/* v1=47 INVALID */
|
||||
d_val[48]= 23; a_val[48]= 5; b_val[48]=1; r_val[48]=2;
|
||||
d_val[49]=2397; a_val[49]=47; b_val[49]=1; r_val[49]=188;
|
||||
d_val[50]= 39; a_val[50]= 6; b_val[50]=1; r_val[50]=3;
|
||||
d_val[51]= 53; a_val[51]= 7; b_val[51]=1; r_val[51]=4;
|
||||
/* v1=52 INVALID */
|
||||
d_val[53]=2805; a_val[53]=51; b_val[53]=1; r_val[53]=204;
|
||||
d_val[54]= 182; a_val[54]=13; b_val[54]=1; r_val[54]=13;
|
||||
d_val[55]=3021; a_val[55]=53; b_val[55]=1; r_val[55]=212;
|
||||
d_val[56]= 87; a_val[56]= 9; b_val[56]=1; r_val[56]=6;
|
||||
d_val[57]=3245; a_val[57]=55; b_val[57]=1; r_val[57]=220;
|
||||
d_val[58]= 210; a_val[58]=14; b_val[58]=1; r_val[58]=14;
|
||||
d_val[59]=3477; a_val[59]=57; b_val[59]=1; r_val[59]=228;
|
||||
d_val[60]= 899; a_val[60]=29; b_val[60]=1; r_val[60]=58;
|
||||
d_val[61]= 413; a_val[61]=21; b_val[61]=1; r_val[61]=28;
|
||||
/* v1=62 INVALID */
|
||||
d_val[63]=3965; a_val[63]=61; b_val[63]=1; r_val[63]=244;
|
||||
d_val[64]=1023; a_val[64]=31; b_val[64]=1; r_val[64]=62;
|
||||
d_val[65]= 469; a_val[65]=21; b_val[65]=1; r_val[65]=28;
|
||||
d_val[66]= 17; a_val[66]= 4; b_val[66]=1; r_val[66]=1;
|
||||
d_val[67]=4485; a_val[67]=65; b_val[67]=1; r_val[67]=260;
|
||||
d_val[68]=1155; a_val[68]=33; b_val[68]=1; r_val[68]=66;
|
||||
d_val[69]=4757; a_val[69]=67; b_val[69]=1; r_val[69]=268;
|
||||
d_val[70]= 34; a_val[70]= 6; b_val[70]=1; r_val[70]=2;
|
||||
d_val[71]=5037; a_val[71]=69; b_val[71]=1; r_val[71]=276;
|
||||
d_val[72]=1295; a_val[72]=35; b_val[72]=1; r_val[72]=70;
|
||||
d_val[73]= 213; a_val[73]=15; b_val[73]=1; r_val[73]=12;
|
||||
d_val[74]= 38; a_val[74]= 6; b_val[74]=1; r_val[74]=2;
|
||||
d_val[75]=5621; a_val[75]=73; b_val[75]=1; r_val[75]=292;
|
||||
d_val[76]=1443; a_val[76]=37; b_val[76]=1; r_val[76]=74;
|
||||
d_val[77]= 237; a_val[77]=15; b_val[77]=1; r_val[77]=12;
|
||||
d_val[78]= 95; a_val[78]=10; b_val[78]=1; r_val[78]=5;
|
||||
/* v1=79 INVALID */
|
||||
d_val[80]=1599; a_val[80]=39; b_val[80]=1; r_val[80]=78;
|
||||
d_val[81]=6557; a_val[81]=79; b_val[81]=1; r_val[81]=316;
|
||||
d_val[82]= 105; a_val[82]=10; b_val[82]=1; r_val[82]=5;
|
||||
d_val[83]= 85; a_val[83]= 9; b_val[83]=1; r_val[83]=4;
|
||||
d_val[84]=1763; a_val[84]=41; b_val[84]=1; r_val[84]=82;
|
||||
d_val[85]=7221; a_val[85]=83; b_val[85]=1; r_val[85]=332;
|
||||
d_val[86]= 462; a_val[86]=21; b_val[86]=1; r_val[86]=21;
|
||||
d_val[87]=7565; a_val[87]=85; b_val[87]=1; r_val[87]=340;
|
||||
d_val[88]= 215; a_val[88]=15; b_val[88]=1; r_val[88]=10;
|
||||
d_val[89]=7917; a_val[89]=87; b_val[89]=1; r_val[89]=348;
|
||||
d_val[90]= 506; a_val[90]=22; b_val[90]=1; r_val[90]=22;
|
||||
d_val[91]=8277; a_val[91]=89; b_val[91]=1; r_val[91]=356;
|
||||
d_val[92]= 235; a_val[92]=15; b_val[92]=1; r_val[92]=10;
|
||||
d_val[93]=8645; a_val[93]=91; b_val[93]=1; r_val[93]=364;
|
||||
d_val[94]= 138; a_val[94]=12; b_val[94]=1; r_val[94]=6;
|
||||
d_val[95]=9021; a_val[95]=93; b_val[95]=1; r_val[95]=372;
|
||||
d_val[96]= 47; a_val[96]= 7; b_val[96]=1; r_val[96]=2;
|
||||
d_val[97]=1045; a_val[97]=33; b_val[97]=1; r_val[97]=44;
|
||||
/* v1=98 INVALID */
|
||||
d_val[99]=9797; a_val[99]=97; b_val[99]=1; r_val[99]=388;
|
||||
d_val[100]= 51; a_val[100]= 7; b_val[100]=1; r_val[100]=2;
|
||||
|
||||
if (config("resource_debug") & 3) {
|
||||
print "d_val[100] defined";
|
||||
print "a_val[100] defined";
|
||||
print "b_val[100] defined";
|
||||
print "r_val[100] defined";
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* regress - calc regression and correctness test suite
|
||||
*
|
||||
* Copyright (C) 1999-2006 David I. Bell and Landon Curt Noll
|
||||
* Copyright (C) 1999-2017 David I. Bell and 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
|
||||
@@ -17,9 +17,9 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.13 $
|
||||
* @(#) $Id: regress.cal,v 30.13 2016/02/06 08:39:35 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/regress.cal,v $
|
||||
* @(#) $Revision: 30.14 $
|
||||
* @(#) $Id: regress.cal,v 30.14 2017/05/19 16:09:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc-RHEL7/cal/RCS/regress.cal,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:50:36
|
||||
* File existed as early as: before 1990
|
||||
@@ -8068,7 +8068,6 @@ return test_functions2();
|
||||
* hello.cal - designed to go into an infinite loop
|
||||
* lucal.cal - already read by this file
|
||||
* lucas_chk.cal - already read by this file
|
||||
* lucas_tbl.cal - duplicatres code already read by another file
|
||||
* regress.cal - this file
|
||||
* surd.cal - already read by this file
|
||||
* test9999.cal - files of this form are already read by this file
|
||||
@@ -8141,8 +8140,6 @@ read -once intfile;
|
||||
print '9830: read -once intfile';
|
||||
read -once lucas;
|
||||
print '9831: read -once lucas';
|
||||
read -once lucas_tbl;
|
||||
print '9832: read -once lucas_tbl';
|
||||
read -once natnumset;
|
||||
print '9833: read -once natnumset';
|
||||
read -once repeat;
|
||||
|
14
codegen.c
14
codegen.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* codegen - module to generate opcodes from the input tokens
|
||||
*
|
||||
* Copyright (C) 1999-2007 David I. Bell and Ernest Bowen
|
||||
* Copyright (C) 1999-2007,2017 David I. Bell and Ernest Bowen
|
||||
*
|
||||
* Primary author: David I. Bell
|
||||
*
|
||||
@@ -19,9 +19,9 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.4 $
|
||||
* @(#) $Id: codegen.c,v 30.4 2013/08/11 08:41:38 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/codegen.c,v $
|
||||
* @(#) $Revision: 30.5 $
|
||||
* @(#) $Id: codegen.c,v 30.5 2017/05/19 16:09:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc-RHEL7/RCS/codegen.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:13
|
||||
* File existed as early as: before 1990
|
||||
@@ -148,7 +148,11 @@ getcommands(BOOL toplevel)
|
||||
case 1:
|
||||
case -1:
|
||||
if(i == 1) {
|
||||
strcpy(name, DEFAULTCALCHELP);
|
||||
strncpy(name,
|
||||
DEFAULTCALCHELP,
|
||||
MAXCMD);
|
||||
/* paranoia */
|
||||
name[MAXCMD] = '\0';
|
||||
givehelp(name);
|
||||
}
|
||||
break;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# cscript - makefile for calc shell script files
|
||||
#
|
||||
# Copyright (C) 1999-2006,2014 Landon Curt Noll
|
||||
# Copyright (C) 1999-2006,2014,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
|
||||
@@ -17,9 +17,9 @@
|
||||
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# @(#) $Revision: 30.9 $
|
||||
# @(#) $Id: Makefile,v 30.9 2014/09/02 07:14:49 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/bin/calc/cscript/RCS/Makefile,v $
|
||||
# @(#) $Revision: 30.10 $
|
||||
# @(#) $Id: Makefile,v 30.10 2017/05/19 16:09:14 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/bin/calc-RHEL7/cscript/RCS/Makefile,v $
|
||||
#
|
||||
# Under source code control: 1999/11/29 11:10:26
|
||||
# File existed as early as: 1999
|
||||
@@ -371,6 +371,10 @@ clean:
|
||||
clobber: clean
|
||||
${RM} -f .all
|
||||
${RM} -f ${TARGETS}
|
||||
-${Q} if [ -e .DS_Store ]; then \
|
||||
echo ${RM} -rf .DS_Store; \
|
||||
${RM} -rf .DS_Store; \
|
||||
fi
|
||||
|
||||
# install everything
|
||||
#
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# custom - makefile for calc custom routines
|
||||
#
|
||||
# Copyright (C) 1999-2006,2014 Landon Curt Noll
|
||||
# Copyright (C) 1999-2006,2014,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
|
||||
@@ -18,9 +18,9 @@
|
||||
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# @(#) $Revision: 30.41 $
|
||||
# @(#) $Id: Makefile.head,v 30.41 2016/02/22 19:38:22 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/bin/calc/custom/RCS/Makefile.head,v $
|
||||
# @(#) $Revision: 30.42 $
|
||||
# @(#) $Id: Makefile.head,v 30.42 2017/05/19 16:09:14 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/bin/calc-RHEL7/custom/RCS/Makefile.head,v $
|
||||
#
|
||||
# Under source code control: 1997/03/09 02:28:54
|
||||
# File existed as early as: 1997
|
||||
@@ -352,7 +352,7 @@ EXT=
|
||||
|
||||
# The default calc versions
|
||||
#
|
||||
VERSION= 2.12.5.4
|
||||
VERSION= 2.12.5.5
|
||||
|
||||
# Names of shared libraries with versions
|
||||
#
|
||||
@@ -458,7 +458,7 @@ LDFLAGS= ${LD_DEBUG} ${ILDFLAGS}
|
||||
# LIBCALC_SHLIB are flags given to ${CC} to build libcalc shared libraries
|
||||
# LIBCUSTCALC_SHLIB are flags given to ${CC} to build libcustcalc shared lib
|
||||
#
|
||||
# NOTE: The above 4 values are unused if BLD_TYPE= calc-static-only
|
||||
# NOTE: The above 5 values are unused if BLD_TYPE= calc-static-only
|
||||
#
|
||||
# CC_STATIC are flags given to ${CC} to build .o files suitable for static libs
|
||||
# LD_STATIC are common flags given to ${CC} to link with static libraries
|
||||
@@ -835,10 +835,10 @@ EXT=.exe
|
||||
TERMCONTROL= -DUSE_WIN32
|
||||
ifdef ALLOW_CUSTOM
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
CALCPATH= .;./cal;~/.cal;${CALC_SHAREDIR};${CUSTOMCALDIR}
|
||||
CALCPATH= .;./cal;~/.cal;${T}${CALC_SHAREDIR};${T}${CUSTOMCALDIR}
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
else
|
||||
CALCPATH= .;./cal;~/.cal;${CALC_SHAREDIR}
|
||||
CALCPATH= .;./cal;~/.cal;${T}${CALC_SHAREDIR}
|
||||
endif
|
||||
CALCRC= ${CALC_SHAREDIR}/startup;~/.calcrc;./.calcinit
|
||||
#
|
||||
@@ -1236,12 +1236,16 @@ clobber: clean
|
||||
${RM} -f .all ${MAKE_FILE}.tmp ${MAKE_FILE}.bak
|
||||
${RM} -f libcustcalc${LIB_EXT_VERSION}
|
||||
${RM} -f libcustcalc${LIB_EXT}
|
||||
${RM} -f libcustcalc.*.dylib
|
||||
${RM} -f libcustcalc.a
|
||||
${RM} -f libcustcalc*
|
||||
${V} echo remove files that are obsolete
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
${RM} -f Makefile.simple
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
-${Q} if [ -e .DS_Store ]; then \
|
||||
echo ${RM} -rf .DS_Store; \
|
||||
${RM} -rf .DS_Store; \
|
||||
fi
|
||||
|
||||
# install everything
|
||||
#
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# custom - makefile for calc custom routines
|
||||
#
|
||||
# Copyright (C) 1999-2006,2014 Landon Curt Noll
|
||||
# Copyright (C) 1999-2006,2014,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
|
||||
@@ -18,9 +18,9 @@
|
||||
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# @(#) $Revision: 30.41 $
|
||||
# @(#) $Id: Makefile.head,v 30.41 2016/02/22 19:38:22 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/bin/calc/custom/RCS/Makefile.head,v $
|
||||
# @(#) $Revision: 30.42 $
|
||||
# @(#) $Id: Makefile.head,v 30.42 2017/05/19 16:09:14 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/bin/calc-RHEL7/custom/RCS/Makefile.head,v $
|
||||
#
|
||||
# Under source code control: 1997/03/09 02:28:54
|
||||
# File existed as early as: 1997
|
||||
@@ -352,7 +352,7 @@ EXT=
|
||||
|
||||
# The default calc versions
|
||||
#
|
||||
VERSION= 2.12.5.4
|
||||
VERSION= 2.12.5.5
|
||||
|
||||
# Names of shared libraries with versions
|
||||
#
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# custom - makefile for calc custom routines
|
||||
#
|
||||
# Copyright (C) 1999-2006,2014 Landon Curt Noll
|
||||
# Copyright (C) 1999-2006,2014,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
|
||||
@@ -18,9 +18,9 @@
|
||||
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# @(#) $Revision: 30.41 $
|
||||
# @(#) $Id: Makefile.head,v 30.41 2016/02/22 19:38:22 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/bin/calc/custom/RCS/Makefile.head,v $
|
||||
# @(#) $Revision: 30.42 $
|
||||
# @(#) $Id: Makefile.head,v 30.42 2017/05/19 16:09:14 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/bin/calc-RHEL7/custom/RCS/Makefile.head,v $
|
||||
#
|
||||
# Under source code control: 1997/03/09 02:28:54
|
||||
# File existed as early as: 1997
|
||||
@@ -337,7 +337,7 @@ EXT=
|
||||
|
||||
# The default calc versions
|
||||
#
|
||||
VERSION= 2.12.5.4
|
||||
VERSION= 2.12.5.5
|
||||
|
||||
# Names of shared libraries with versions
|
||||
#
|
||||
@@ -418,7 +418,7 @@ COMMON_LDFLAGS= ${EXTRA_LDFLAGS}
|
||||
# LIBCALC_SHLIB are flags given to ${CC} to build libcalc shared libraries
|
||||
# LIBCUSTCALC_SHLIB are flags given to ${CC} to build libcustcalc shared lib
|
||||
#
|
||||
# NOTE: The above 4 values are unused if BLD_TYPE= calc-static-only
|
||||
# NOTE: The above 5 values are unused if BLD_TYPE= calc-static-only
|
||||
#
|
||||
# CC_STATIC are flags given to ${CC} to build .o files suitable for static libs
|
||||
# LD_STATIC are common flags given to ${CC} to link with static libraries
|
||||
@@ -500,7 +500,7 @@ CFLAGS= ${ICFLAGS} ${CCOPT}
|
||||
ILDFLAGS= ${COMMON_LDFLAGS} ${LD_STATIC}
|
||||
LDFLAGS= ${LD_DEBUG} ${ILDFLAGS} ${LIBCALC_STATIC} ${LIBCUSTCALC_STATIC}
|
||||
#
|
||||
CALCPATH= .;./cal;~/.cal;${CALC_SHAREDIR};${CUSTOMCALDIR}
|
||||
CALCPATH= .;./cal;~/.cal;${T}${CALC_SHAREDIR};${T}${CUSTOMCALDIR}
|
||||
|
||||
#######################################################################
|
||||
#-=-=-=-=-=- end of target section - only make rules below -=-=-=-=-=-#
|
||||
@@ -786,9 +786,13 @@ clobber: clean
|
||||
${RM} -f .all ${MAKE_FILE}.tmp ${MAKE_FILE}.bak
|
||||
${RM} -f libcustcalc${LIB_EXT_VERSION}
|
||||
${RM} -f libcustcalc${LIB_EXT}
|
||||
${RM} -f libcustcalc.*.dylib
|
||||
${RM} -f libcustcalc.a
|
||||
${RM} -f libcustcalc*
|
||||
${V} echo remove files that are obsolete
|
||||
-${Q} if [ -e .DS_Store ]; then \
|
||||
echo ${RM} -rf .DS_Store; \
|
||||
${RM} -rf .DS_Store; \
|
||||
fi
|
||||
|
||||
# install everything
|
||||
#
|
||||
|
@@ -290,12 +290,16 @@ clobber: clean
|
||||
${RM} -f .all ${MAKE_FILE}.tmp ${MAKE_FILE}.bak
|
||||
${RM} -f libcustcalc${LIB_EXT_VERSION}
|
||||
${RM} -f libcustcalc${LIB_EXT}
|
||||
${RM} -f libcustcalc.*.dylib
|
||||
${RM} -f libcustcalc.a
|
||||
${RM} -f libcustcalc*
|
||||
${V} echo remove files that are obsolete
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
${RM} -f Makefile.simple
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
-${Q} if [ -e .DS_Store ]; then \
|
||||
echo ${RM} -rf .DS_Store; \
|
||||
${RM} -rf .DS_Store; \
|
||||
fi
|
||||
|
||||
# install everything
|
||||
#
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# help - makefile for calc help files
|
||||
#
|
||||
# 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
|
||||
@@ -18,9 +18,9 @@
|
||||
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# @(#) $Revision: 30.10 $
|
||||
# @(#) $Id: Makefile,v 30.10 2014/09/02 07:15:58 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/bin/calc/help/RCS/Makefile,v $
|
||||
# @(#) $Revision: 30.11 $
|
||||
# @(#) $Id: Makefile,v 30.11 2017/05/19 16:09:14 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/bin/calc-RHEL7/help/RCS/Makefile,v $
|
||||
#
|
||||
# Under source code control: 1991/07/23 06:47:57
|
||||
# File existed as early as: 1991
|
||||
@@ -204,7 +204,7 @@ EXT=
|
||||
STD_HELP_FILES_1= intro overview help
|
||||
STD_HELP_FILES_2= assoc
|
||||
|
||||
BLT_HELP_FILES_3= builtin
|
||||
BLT_HELP_FILES_3= builtin man
|
||||
|
||||
STD_HELP_FILES_4= command config custom define environment expression
|
||||
|
||||
@@ -283,36 +283,35 @@ BLT_HELP_FILES= ${BLT_HELP_FILES_3} ${BLT_HELP_FILES_5} \
|
||||
# to keep this list in nice sorted order and to check that these
|
||||
# non-special help files are under RCS control.
|
||||
#
|
||||
DETAIL_HELP= abs access acos acosh acot acoth acsc acsch address \
|
||||
agd append appr arg argv arrow asec asech asin asinh assign atan \
|
||||
atan2 atanh avg base base2 bernoulli bit blk blkcpy blkfree blocks \
|
||||
bround btrunc calc_tty calclevel calcpath catalan ceil cfappr cfsim \
|
||||
char cmdbuf cmp comb conj cos cosh cot coth count cp csc csch ctime \
|
||||
delete den dereference det digit digits display dp epsilon errcount \
|
||||
errmax errno error estr euler eval exp fact factor fclose fcnt \
|
||||
feof ferror fflush fgetc fgetfield fgetfile fgetline fgets fgetstr \
|
||||
fib files floor fopen forall fpathopen fprintf fputc fputs fputstr \
|
||||
frac free freebernoulli freeeuler freeglobals freeredc freestatics \
|
||||
frem freopen fscan fscanf fseek fsize ftell gcd gcdrem gd getenv \
|
||||
hash head highbit hmean hnrmod hypot ilog ilog10 ilog2 im indices \
|
||||
inputlevel insert int inverse iroot isalnum isalpha isassoc isatty \
|
||||
isblk iscntrl isconfig isdefined isdigit iserror iseven isfile \
|
||||
isgraph ishash isident isint islist islower ismat ismult isnull \
|
||||
isnum isobj isobjtype isodd isprime isprint isptr ispunct isqrt \
|
||||
isrand israndom isreal isrel issimple isspace issq isstr istype \
|
||||
isupper isxdigit jacobi join lcm lcmfact lfactor ln log lowbit ltol \
|
||||
makelist matdim matfill matmax matmin matsum mattrace mattrans max \
|
||||
memsize meq min minv mmin mne mod modify name near newerror nextcand \
|
||||
nextprime norm null num oldvalue ord param perm pfact pi pix places \
|
||||
pmod polar poly pop popcnt pound power prevcand prevprime printf \
|
||||
prompt protect ptest push putenv quo quomod rand randbit random \
|
||||
randombit randperm rcin rcmul rcout rcpow rcsq re remove reverse \
|
||||
rewind rm root round rsearch runtime saveval scale scan scanf \
|
||||
search sec sech seed segment select sgn sha1 sin sinh size sizeof \
|
||||
sleep sort sqrt srand srandom ssq stoponerror str strcasecmp strcat \
|
||||
strcmp strcpy strerror strlen strncasecmp strncmp strncpy strpos \
|
||||
strprintf strscan strscanf strtolower strtoupper substr sum swap \
|
||||
system systime tail tan tanh test time trunc usertime version xor
|
||||
DETAIL_HELP= abs access acos acosh acot acoth acsc acsch address agd \
|
||||
append appr arg argv arrow asec asech asin asinh assign atan atan2 \
|
||||
atanh avg base base2 bernoulli bit blk blkcpy blkfree blocks bround \
|
||||
btrunc calc_tty calclevel calcpath catalan ceil cfappr cfsim char \
|
||||
cmdbuf cmp comb conj cos cosh cot coth count cp csc csch ctime delete \
|
||||
den dereference det digit digits display dp epsilon errcount errmax \
|
||||
errno error estr euler eval exp fact factor fclose fcnt feof ferror \
|
||||
fflush fgetc fgetfield fgetfile fgetline fgets fgetstr fib files floor \
|
||||
fopen forall fpathopen fprintf fputc fputs fputstr frac free \
|
||||
freebernoulli freeeuler freeglobals freeredc freestatics frem freopen \
|
||||
fscan fscanf fseek fsize ftell gcd gcdrem gd getenv hash head highbit \
|
||||
hmean hnrmod hypot ilog ilog10 ilog2 im indices inputlevel insert int \
|
||||
inverse iroot isalnum isalpha isassoc isatty isblk iscntrl isconfig \
|
||||
isdefined isdigit iserror iseven isfile isgraph ishash isident isint \
|
||||
islist islower ismat ismult isnull isnum isobj isobjtype isodd isprime \
|
||||
isprint isptr ispunct isqrt isrand israndom isreal isrel issimple \
|
||||
isspace issq isstr istype isupper isxdigit jacobi join lcm lcmfact \
|
||||
lfactor ln log lowbit ltol makelist matdim matfill matmax matmin \
|
||||
matsum mattrace mattrans max memsize meq min minv mmin mne mod modify \
|
||||
name near newerror nextcand nextprime norm null num oldvalue ord param \
|
||||
perm pfact pi pix places pmod polar poly pop popcnt pound power \
|
||||
prevcand prevprime printf prompt protect ptest push putenv quo quomod \
|
||||
rand randbit random randombit randperm rcin rcmul rcout rcpow rcsq re \
|
||||
remove reverse rewind rm root round rsearch runtime saveval scale scan \
|
||||
scanf search sec sech seed segment select sgn sha1 sin sinh size \
|
||||
sizeof sleep sort sqrt srand srandom ssq stoponerror str strcasecmp \
|
||||
strcat strcmp strcpy strerror strlen strncasecmp strncmp strncpy \
|
||||
strpos strprintf strscan strscanf strtolower strtoupper substr sum \
|
||||
swap system systime tail tan tanh test time trunc usertime version xor
|
||||
|
||||
# This list is of files that are clones of DETAIL_HELP files. They are
|
||||
# built from DETAIL_HELP files.
|
||||
@@ -473,6 +472,18 @@ copy: blkcpy
|
||||
${TRUE}; \
|
||||
fi
|
||||
|
||||
man: help
|
||||
${RM} -f $@
|
||||
${CP} help $@
|
||||
${CHMOD} 0444 $@
|
||||
-@if [ -z "${Q}" ]; then \
|
||||
echo ''; \
|
||||
echo '=-=-= skipping the ${CAT} of help/$@ =-=-='; \
|
||||
echo ''; \
|
||||
else \
|
||||
${TRUE}; \
|
||||
fi
|
||||
|
||||
COPYING: ../COPYING
|
||||
${RM} -f $@
|
||||
${CP} ../COPYING $@
|
||||
@@ -698,6 +709,10 @@ clean:
|
||||
clobber: clean
|
||||
${RM} -f ${BLT_HELP_FILES} full .all calc
|
||||
${RM} -f ${SINGULAR_FILES} ${DETAIL_CLONE}
|
||||
-${Q} if [ -e .DS_Store ]; then \
|
||||
echo ${RM} -rf .DS_Store; \
|
||||
${RM} -rf .DS_Store; \
|
||||
fi
|
||||
|
||||
# install everything
|
||||
#
|
||||
|
16
help/help
16
help/help
@@ -115,7 +115,15 @@ as the same effect as:
|
||||
|
||||
custom("help", "anything");
|
||||
|
||||
## Copyright (C) 1999-2007 Landon Curt Noll
|
||||
The man command is an alias for the help command. For example:
|
||||
|
||||
man sin
|
||||
|
||||
Any help file that the help command is able to display may be
|
||||
displayed by the man command. The man command may only display
|
||||
calc help files.
|
||||
|
||||
## Copyright (C) 1999-2007,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
|
||||
@@ -131,9 +139,9 @@ as the same effect as:
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## @(#) $Revision: 30.1 $
|
||||
## @(#) $Id: help,v 30.1 2007/03/16 11:10:42 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/bin/calc/help/RCS/help,v $
|
||||
## @(#) $Revision: 30.2 $
|
||||
## @(#) $Id: help,v 30.2 2017/05/19 16:09:14 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/bin/calc-RHEL7/help/RCS/help,v $
|
||||
##
|
||||
## Under source code control: 1991/07/21 04:37:20
|
||||
## File existed as early as: 1991
|
||||
|
205
help/jacobi
205
help/jacobi
@@ -11,39 +11,186 @@ TYPES
|
||||
return 1, -1, or 0
|
||||
|
||||
DESCRIPTION
|
||||
If y is a positive odd prime and x is an integer not divisible
|
||||
by y, jacobi(x,y) returns the Legendre symbol function, usually
|
||||
denoted by (x/y) as if x/y were a fraction; this has the value
|
||||
1 or -1 according as x is or is not a quadratic residue modulo y.
|
||||
x is a quadratic residue modulo y if for some integer u,
|
||||
x = u^2 (mod y); if for all integers u, x != u^2 (mod y), x
|
||||
is said to be a quadratic nonresidue modulo y.
|
||||
The jacobi builtin function of calc returns the value of the
|
||||
Jacobi symbol.
|
||||
|
||||
If y is a positive odd prime and x is divisible by y, jacobi(x,y)
|
||||
returns the value 1. (This differs from the zero value usually
|
||||
given in number theory books for (x/y) when x and y
|
||||
are not relatively prime.)
|
||||
assigned to (x/y) O
|
||||
If y is an odd prime, then the Legendre symbol (x/y) returns:
|
||||
|
||||
If y is an odd positive integer equal to p_1 * p_2 * ... * p_k,
|
||||
where the p_i are primes, not necessarily distinct, the
|
||||
jacobi symbol function is given by
|
||||
(x/y) == 0 x is divisible by y (0 == x % y)
|
||||
(x/y) == 1 if x is a quadratic residue modulo y
|
||||
(x/y) == -1 if x is not a quadratic residue modulo y
|
||||
|
||||
jacobi(x,y) = (x/p_1) * (x/p_2) * ... * (x/p_k).
|
||||
Legendre symbol often denoted as (x/y) as if x/y were a fraction.
|
||||
|
||||
where the functions on the right are Legendre symbol functions.
|
||||
If there exists an integer u such that:
|
||||
|
||||
This is also often usually by (x/y).
|
||||
x == u^2 modulo y (i.e., x == u^2 % y)
|
||||
|
||||
If jacobi(x,y) = -1, then x is a quadratic nonresidue modulo y.
|
||||
Equivalently, if x is a quadratic residue modulo y, then
|
||||
jacobi(x,y) = 1.
|
||||
then x is a quadratic residue modulo y. However, if for all integers u:
|
||||
|
||||
If jacobi(x,y) = 1 and y is composite, x may be either a quadratic
|
||||
residue or a quadratic nonresidue modulo y.
|
||||
x != u^2 modulo y (i.e., x != u^2 % y)
|
||||
|
||||
If y is even or negative, jacobi(x,y) as defined by calc returns
|
||||
the value 0.
|
||||
x is said to be a quadratic non-residue modulo y.
|
||||
|
||||
When y is prime, Jacobi symbol is the same as the Legendre symbol.
|
||||
That is, Jacobi symbol satisfies the same rules as the Legendre symbol.
|
||||
Therefore, when y is an odd prime:
|
||||
|
||||
jacobi(x,y) == 0 x is divisible by y (x == 0 % y)
|
||||
jacobi(x,y) == 1 if x is a quadratic residue modulo y
|
||||
jacobi(x,y) == -1 if x is a quadratic non-residue modulo y
|
||||
|
||||
When y is even or y <= 0:
|
||||
|
||||
jacobi(x,y) == 0
|
||||
|
||||
When y is not prime, we may express y as the product of primes:
|
||||
|
||||
y == p0^a0 * p1^a1 * .. * pn^an
|
||||
|
||||
When y is odd and NOT prime, then:
|
||||
|
||||
jacobi(x,y) == (x/p0)^a0 * (x/p1)^a1 * .. * (x/pn)^an
|
||||
|
||||
where (x/y) is Legendre symbol.
|
||||
|
||||
If x is a quadratic residue modulo y, then jacobi(x,y) == 1.
|
||||
|
||||
If jacobi(x,y) == 1 and y is composite (y is not prime), x may
|
||||
be either a quadratic residue or a quadratic non-residue modulo y.
|
||||
|
||||
If y is even or negative, jacobi(x,y) as defined by calc, returns 0.
|
||||
|
||||
Jacobi symbol details
|
||||
---------------------
|
||||
|
||||
In the rest of this section we present for the curious, some
|
||||
rules related to the jacobi symbol. Most of these rules are
|
||||
used internally by calc to evaluate the jacobi symbol.
|
||||
|
||||
In this section, a and b are positive odd integers.
|
||||
In this section, x and y are any integers.
|
||||
|
||||
We have these identities:
|
||||
|
||||
jacobi(x,y) == 0 if x <= 0
|
||||
jacobi(x,y) == 0 if y <= 0
|
||||
jacobi(x,y) == 0 if y is even
|
||||
|
||||
jacobi(x,b) == 0 if gcd(x,b) > 1
|
||||
|
||||
jacobi(0,b) == 0
|
||||
jacobi(1,b) == 1
|
||||
|
||||
jacobi(x,b) == jacobi(y,b) if x == y % b
|
||||
|
||||
jacobi(a,b) == jacobi(2*a,b) if b == 1 % 8 OR b == 7 % 8
|
||||
jacobi(a,b) == -jacobi(2*a,b) if b != 1 & 8 AND b != 7 % 8
|
||||
|
||||
jacobi(a,b) == jacobi(b,a) if a == 3 % 4 AND b == 3 % 4
|
||||
jacobi(a,b) == -jacobi(b,a) if a != 3 % 4 OR b != 3 % 4
|
||||
|
||||
jacobi(-1,b) == 1 if b == 1 % 4
|
||||
jacobi(-1,b) == -1 if b == 3 % 4
|
||||
|
||||
jacobi(x,b) * jacobi(y,b) == jacobi(x*y,b)
|
||||
jacobi(x,a) * jacobi(x,b) == jacobi(x,a*b)
|
||||
|
||||
Technically the Jacobi symbol jacobi(x,y) is not defined when
|
||||
x == 0, x < 0, y is even, y == 0, and when y < 0. So by convention:
|
||||
|
||||
jacobi(x,y) == 0 if x <= 0
|
||||
jacobi(x,y) == 0 if y <= 0
|
||||
jacobi(x,y) == 0 if y == 0 % 2
|
||||
|
||||
It is also worth noting that:
|
||||
|
||||
jacobi(x,y) == 0 if gcd(y,x) != 1
|
||||
jacobi(y,y) == 0 if y > 1
|
||||
|
||||
Based on the generalization of the quadratic reciprocity theorem,
|
||||
when a and b are odd, b >= 3, and gcd(a,b) == 1:
|
||||
|
||||
jacobi(a,b) == jacobi(b,a) * ((-1) ^ ((a-1) * (b-1) / 4))
|
||||
|
||||
Therefore, when a and b are odd, b >= 3, and gcd(a,b) == 1:
|
||||
|
||||
jacobi(a,b) == jacobi(b,a) if a == 1 % 4 OR b == 1 % 4
|
||||
jacobi(a,b) == -jacobi(b,a) if a == 3 % 4 AND b == 3 % 4
|
||||
|
||||
Jacobi symbol satisfies the same rules as the Legendre symbol such as:
|
||||
|
||||
jacobi(x,y0*y1) == jacobi(x,y0) * jacobi(x,y1)
|
||||
jacobi(x0*x1,y) == jacobi(x0,y) * jacobi(x1,y)
|
||||
|
||||
When b is odd:
|
||||
|
||||
jacobi(x^2,b) == 1 if gcd(x,b) == 1
|
||||
jacobi(x,b^2) == 1 if gcd(x,b) == 1
|
||||
|
||||
jacobi(x0,b) == jacobi(x1,b) if x0 == x1 % b
|
||||
|
||||
jacobi(-1,b) == (-1) ^ ((b-1) / 2) == 1 if b == 1 % 4
|
||||
jacobi(-1,b) == (-1) ^ ((b-1) / 2) == -1 if b == 3 % 4
|
||||
|
||||
jacobi(2,b) == (-1) ^ ((b^2 - 1) / 8) == 1 if b == 1 % 8 OR
|
||||
b == 7 % 8
|
||||
jacobi(2,b) == (-1) ^ ((b^2 - 1) / 8) == -1 if b == 3 % 8 OR
|
||||
b == 5 % 8
|
||||
|
||||
jacobi(-3,b) == 1 if b == 1 % 6
|
||||
jacobi(-3,b) == -1 if b == 5 % 6
|
||||
|
||||
jacobi(5,b) == 1 if b == 1 % 10 OR
|
||||
b == 9 % 10
|
||||
jacobi(5,b) == -1 if b == 3 % 10 OR
|
||||
b == 7 % 10
|
||||
|
||||
If a and b are both odd primes, OR
|
||||
if gcd(a,b) = 1 and, a > 0, and a is odd:
|
||||
|
||||
jacobi(a,b) == jacobi(b,a) * ((-1) ^ (((a-1)/2) * ((b-1)/2)))
|
||||
jacobi(a,b) * jacobi(b,a) == ((-1) ^ (((a-1)/2) * ((b-1)/2)))
|
||||
|
||||
If b is an odd prime:
|
||||
|
||||
jacobi(a,b) == (a ^ ((b-1)/2)) % b
|
||||
|
||||
Combining all of the above, computing jacobi(x,b) may be expressed
|
||||
in the following algorithm when b is odd and 0 < x < b:
|
||||
|
||||
j = 1;
|
||||
while (x != 0) {
|
||||
while (iseven(x)) {
|
||||
x = x / 2;
|
||||
t = b % 8;
|
||||
if (t == 3 || t == 5) {
|
||||
j = -j;
|
||||
}
|
||||
}
|
||||
swap(x,b);
|
||||
if (((x % 4) == 3) && ((b % 4) == 3)) {
|
||||
j = -j;
|
||||
}
|
||||
x = x % b;
|
||||
}
|
||||
|
||||
if (b == 1) {
|
||||
return j;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
The above calc pseudo code is provided to help illustrate the
|
||||
properties of the jacobi symbol only. The use of calc's jacobi
|
||||
builtin is recommended for both speed as well as to handle
|
||||
specical cases.
|
||||
|
||||
For more information on the Legendre symbol and the Jacobi symbol:
|
||||
|
||||
http://mathworld.wolfram.com/LegendreSymbol.html
|
||||
http://mathworld.wolfram.com/JacobiSymbol.html
|
||||
http://primes.utm.edu/glossary/xpage/JacobiSymbol.html
|
||||
|
||||
EXAMPLE
|
||||
; print jacobi(2,3), jacobi(2,5), jacobi(2,15)
|
||||
@@ -61,7 +208,7 @@ LINK LIBRARY
|
||||
|
||||
SEE ALSO
|
||||
|
||||
## Copyright (C) 1999 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
|
||||
@@ -77,9 +224,9 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## @(#) $Revision: 30.1 $
|
||||
## @(#) $Id: jacobi,v 30.1 2007/03/16 11:10:42 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/bin/calc/help/RCS/jacobi,v $
|
||||
## @(#) $Revision: 30.2 $
|
||||
## @(#) $Id: jacobi,v 30.2 2017/05/19 16:09:14 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/bin/calc-RHEL7/help/RCS/jacobi,v $
|
||||
##
|
||||
## Under source code control: 1995/12/18 12:34:57
|
||||
## File existed as early as: 1995
|
||||
|
@@ -83,6 +83,12 @@
|
||||
|
||||
help full
|
||||
|
||||
The man command is an alias for the help command. Try:
|
||||
|
||||
man jacobi
|
||||
|
||||
Only calc help files may be displayed by the help and man commands.
|
||||
|
||||
By default, arguments to functions are passed by value (even
|
||||
matrices). For speed, you can put an ampersand before any
|
||||
variable argument in a function call, and that variable will be
|
||||
@@ -169,7 +175,7 @@
|
||||
to be calculated. Global variables which are numbers can be
|
||||
saved to a file by using the 'write filename' command.
|
||||
|
||||
## Copyright (C) 1999 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
|
||||
@@ -185,9 +191,9 @@
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## @(#) $Revision: 30.1 $
|
||||
## @(#) $Id: overview,v 30.1 2007/03/16 11:10:42 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/bin/calc/help/RCS/overview,v $
|
||||
## @(#) $Revision: 30.2 $
|
||||
## @(#) $Id: overview,v 30.2 2017/05/19 16:09:14 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/bin/calc-RHEL7/help/RCS/overview,v $
|
||||
##
|
||||
## Under source code control: 1991/07/21 04:37:23
|
||||
## File existed as early as: 1991
|
||||
|
@@ -319,8 +319,13 @@ Statements
|
||||
|
||||
help help
|
||||
|
||||
The man command is an alias for the help command. For example:
|
||||
|
||||
## Copyright (C) 1999-2007 Landon Curt Noll
|
||||
man jacobi
|
||||
|
||||
Only calc help files may be displayed by the help and man commands.
|
||||
|
||||
## Copyright (C) 1999-2007,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
|
||||
@@ -336,9 +341,9 @@ Statements
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## @(#) $Revision: 30.1 $
|
||||
## @(#) $Id: statement,v 30.1 2007/03/16 11:10:42 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/bin/calc/help/RCS/statement,v $
|
||||
## @(#) $Revision: 30.2 $
|
||||
## @(#) $Id: statement,v 30.2 2017/05/19 16:09:14 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/bin/calc-RHEL7/help/RCS/statement,v $
|
||||
##
|
||||
## Under source code control: 1991/07/21 04:37:23
|
||||
## File existed as early as: 1991
|
||||
|
2
rpm.mk
2
rpm.mk
@@ -21,7 +21,7 @@
|
||||
#
|
||||
MAKEFILE_REV= $$Revision: 30.15 $$
|
||||
# @(#) $Id: rpm.mk,v 30.15 2014/09/08 00:04:13 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/bin/calc/RCS/rpm.mk,v $
|
||||
# @(#) $Source: /usr/local/src/bin/calc-RHEL7/RCS/rpm.mk,v $
|
||||
#
|
||||
# Under source code control: 2003/02/16 20:21:39
|
||||
# File existed as early as: 2003
|
||||
|
9
token.c
9
token.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* token - read input file characters into tokens
|
||||
*
|
||||
* Copyright (C) 1999-2007 David I. Bell and Ernest Bowen
|
||||
* Copyright (C) 1999-2007,2017 David I. Bell and Ernest Bowen
|
||||
*
|
||||
* Primary author: David I. Bell
|
||||
*
|
||||
@@ -19,9 +19,9 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.2 $
|
||||
* @(#) $Id: token.c,v 30.2 2008/11/05 17:32:19 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/token.c,v $
|
||||
* @(#) $Revision: 30.3 $
|
||||
* @(#) $Id: token.c,v 30.3 2017/05/19 16:09:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc-RHEL7/RCS/token.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:25
|
||||
* File existed as early as: before 1990
|
||||
@@ -100,6 +100,7 @@ STATIC struct keyword keywords[] = {
|
||||
{"read", T_READ},
|
||||
{"show", T_SHOW},
|
||||
{"help", T_HELP},
|
||||
{"man", T_HELP},
|
||||
{"write", T_WRITE},
|
||||
{"mat", T_MAT},
|
||||
{"obj", T_OBJ},
|
||||
|
10
value.c
10
value.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* value - generic value manipulation routines
|
||||
*
|
||||
* Copyright (C) 1999-2007,2014 David I. Bell
|
||||
* Copyright (C) 1999-2007,2014,2017 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,9 +17,9 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.8 $
|
||||
* @(#) $Id: value.c,v 30.8 2014/08/31 15:43:39 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/value.c,v $
|
||||
* @(#) $Revision: 30.9 $
|
||||
* @(#) $Id: value.c,v 30.9 2017/05/19 16:09:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc-RHEL7/RCS/value.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:25
|
||||
* File existed as early as: before 1990
|
||||
@@ -2843,7 +2843,7 @@ printvalue(VALUE *vp, int flags)
|
||||
qfree(qtemp);
|
||||
break;
|
||||
case V_OPTR:
|
||||
math_fmt("o-ptr: %p", vp->v_octet);
|
||||
math_fmt("o-ptr: %p", (void *)vp->v_octet);
|
||||
break;
|
||||
case V_VPTR:
|
||||
math_fmt("v-ptr: %p", (void *)vp->v_addr);
|
||||
|
17
version.c
17
version.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* version - determine the version of calc
|
||||
*
|
||||
* Copyright (C) 1999-2014 David I. Bell and Landon Curt Noll
|
||||
* Copyright (C) 1999-2017 David I. Bell and Landon Curt Noll
|
||||
*
|
||||
* Primary author: David I. Bell
|
||||
*
|
||||
@@ -19,9 +19,9 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.31 $
|
||||
* @(#) $Id: version.c,v 30.31 2016/02/22 19:37:21 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/version.c,v $
|
||||
* @(#) $Revision: 30.32 $
|
||||
* @(#) $Id: version.c,v 30.32 2017/05/19 16:09:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc-RHEL7/RCS/version.c,v $
|
||||
*
|
||||
* Under source code control: 1990/05/22 11:00:58
|
||||
* File existed as early as: 1990
|
||||
@@ -49,7 +49,7 @@ static char *program;
|
||||
#define MAJOR_VER 2 /* major library version */
|
||||
#define MINOR_VER 12 /* minor library version */
|
||||
#define MAJOR_PATCH 5 /* major software level under library version */
|
||||
#define MINOR_PATCH 4 /* minor software level or 0 if not patched */
|
||||
#define MINOR_PATCH 5 /* minor software level or 0 if not patched */
|
||||
|
||||
|
||||
/*
|
||||
@@ -109,6 +109,7 @@ char *
|
||||
version(void)
|
||||
{
|
||||
char verbuf[BUFSIZ+1]; /* form version string here */
|
||||
size_t len; /* length of version string */
|
||||
|
||||
/*
|
||||
* return previously stored version if one exists
|
||||
@@ -127,12 +128,14 @@ version(void)
|
||||
/*
|
||||
* save the versions string into a newly malloced buffer
|
||||
*/
|
||||
stored_version = (char *)malloc(strlen(verbuf)+1);
|
||||
len = strlen(verbuf);
|
||||
stored_version = (char *)malloc(len+1);
|
||||
if (stored_version == NULL) {
|
||||
fprintf(stderr, "%s: cannot malloc version string\n", program);
|
||||
exit(70);
|
||||
}
|
||||
strcpy(stored_version, verbuf);
|
||||
strncpy(stored_version, verbuf, BUFSIZ);
|
||||
stored_version[len] = '\0'; /* paranoia */
|
||||
|
||||
/*
|
||||
* return the newly malloced buffer
|
||||
|
Reference in New Issue
Block a user