diff --git a/CHANGES b/CHANGES index 6847249..7d0bc75 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,67 @@ -The following are the changes from calc version 2.12.4.6 to date: +The following are the changes from calc version 2.12.4.11 to date: + + Fixed many typos in comments of the Makefile thanks to the review + work of Michael Somos . + + Fixed typo in "help sysinfo". + + The Makefile rule, debug, is now more verbose and prints more information + about the calc compiled constants. + + Added a more of calc resource files by + Christoph Zurnieden including: + + infinities.cal - handle infinities symbolically, a little helper file + intnum.cal - implementation of tanhsinh- and Gauss-Legendre quadrature + smallfactors.cal - find the factors of a number < 2^32 + strings.cal - implementation of the macros in ctype.h plus str[n]casecmp + + Reformatted some calc resource files. Cleanup in comment the headers + of some calc resource files. + + Minor formatting changes to a few help files. + + No need to be special picky about the test8900.cal calc resource file. + + Added a number of ctype-like builtins: + + isalnum - whether character is alpha-numeric + isalpha - whether character is alphabetic + iscntrl - whether character is a control character + isdigit - whether character is a digit character + isgraph - whether character is a graphical character + islower - whether character is lower case + isprint - whether character is a printable + ispunct - whether character is a punctuation + isspace - whether character is a space character + isupper - whether character is upper case + isxdigit - whether character a hexadecimal digit + strcasecmp - compare two strings, case independent + strncasecmp - compare two strings up to n characters, case independent + + For details on these new builtins, see their help messages. + Thanks goes to Inge Zurnieden for + these new builtins. + + Calc source code is now picky v2.3 clean using: + + picky -s -v file file2 .. + + With the exception of: + + help/errorcodes.sed + cal/set8700.line + + Due to the long lines in those files, we use: + + picky -w -s -v help/errorcodes.sed cal/set8700.line + + For more information about the picky tool, see: + + http://cis.csuohio.edu/~somos/picky.html + + +The following are the changes from calc version 2.12.4.6 to version 2.12.4.10: Updated RPM build process to remove use of deprecated flags. @@ -20,16 +83,16 @@ The following are the changes from calc version 2.12.4.6 to date: Added a number of calc resource files by Christoph Zurnieden including: - bernpoly.cal - Computes the nth Bernoulli polynomial at z for any n,z - brentsolve.cal - root-finder implementwed with the Brent-Dekker trick - factorial.cal - product of the positive integers - factorial2.cal - variety of integer functions quasi-related to factoral - lambertw.cal - Computes Lambert's W-function at "z" at branch "branch" - lnseries.cal - Calculates a series of natural logarithms at 1,2,3,4...n - specialfunctions.cal - Calculates the value of the beta function - statistics.cal - a wide vareity of stastical functions - toomcook.cal - Multiply by way of the Toom-Cook algorithm - zeta2.cal - Calculate the value of the Hurwitz Zeta function + bernpoly.cal - Computes the nth Bernoulli polynomial at z for any n,z + brentsolve.cal - root-finder implementwed with the Brent-Dekker trick + factorial.cal - product of the positive integers + factorial2.cal - variety of integer functions quasi-related to factoral + lambertw.cal - Computes Lambert's W-function at "z" at branch "branch" + lnseries.cal - Calculates a series of natural logarithms at 1,2,3,4...n + specialfunctions.cal - Calculates the value of the beta function + statistics.cal - a wide vareity of stastical functions + toomcook.cal - Multiply by way of the Toom-Cook algorithm + zeta2.cal - Calculate the value of the Hurwitz Zeta function Fixed a makefile bug that prevented the those new calc resource files from being installed. @@ -6881,8 +6944,8 @@ 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.32 $ -## @(#) $Id: CHANGES,v 30.32 2013/08/11 09:10:11 chongo Exp $ +## @(#) $Revision: 30.33 $ +## @(#) $Id: CHANGES,v 30.33 2013/09/01 22:19:41 chongo Exp $ ## @(#) $Source: /usr/local/src/bin/calc/RCS/CHANGES,v $ ## ## Under source code control: 1993/06/02 18:12:57 diff --git a/COPYING b/COPYING index ae8d88e..04b2e4b 100644 --- a/COPYING +++ b/COPYING @@ -12,11 +12,11 @@ This file is Copyrighted Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - # @(#) $Revision: 30.2 $ - # @(#) $Id: COPYING,v 30.2 2008/10/24 10:46:52 chongo Exp $ + # @(#) $Revision: 30.4 $ + # @(#) $Id: COPYING,v 30.4 2013/09/01 20:14:30 chongo Exp $ # @(#) $Source: /usr/local/src/bin/calc/RCS/COPYING,v $ -=-= +-=- Calc is covered by the GNU Lesser General Public License -------------------------------------------------------- @@ -78,7 +78,7 @@ Calc is covered by the GNU Lesser General Public License Feel free to follow the name line with additional EMail text as desired. -=-= +-=- Calc bug reports and calc bug fixes should be sent to: @@ -93,7 +93,7 @@ Calc is covered by the GNU Lesser General Public License You may have additional words in your subject line. -=-= +-=- Calc's relationship to the GNU Lesser General Public License ------------------------------------------------------------ @@ -149,7 +149,7 @@ Calc's relationship to the GNU Lesser General Public License except for the exception files explicitly listed in the ``Calc copyrights and exception files'' section below. -=-= +-=- Calc copyrights and exception files ----------------------------------- @@ -165,6 +165,7 @@ Calc copyrights and exception files Copyright (C) year Ernest Bowen and Landon Curt Noll Copyright (C) year Ernest Bowen Copyright (C) year Petteri Kettunen and Landon Curt Noll + Copyright (C) year Christoph Zurnieden These files are not covered under one of the Copyrights listed above: @@ -188,7 +189,7 @@ Calc copyrights and exception files And because one may freely distribute the LGPL covered files, the entire calc source may be freely used and distributed. -=-= +-=- General Copyleft and License info --------------------------------- @@ -202,7 +203,7 @@ General Copyleft and License info http://www.gnu.org/copyleft/lesser.html http://www.gnu.org/copyleft/lesser.txt -=-= +-=- Why calc did not use the GNU General Public License --------------------------------------------------- diff --git a/COPYING-LGPL b/COPYING-LGPL index 4362b49..c8d3d99 100644 --- a/COPYING-LGPL +++ b/COPYING-LGPL @@ -485,7 +485,8 @@ convey the exclusion of warranty; and each file should have at least the You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + USA Also add information on how to contact you by electronic and paper mail. diff --git a/Makefile b/Makefile index 845031e..f0acf9d 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ # ######################################################################## # Gnu makefile: # This is a Gnu make makefile. If your make does not # -# Gnu makefile: # understand this makefilkke format, then edit and use # +# Gnu makefile: # understand this makefile format, then edit and use # # Gnu makefile: # Makefile.simple instead of this Makefile. # ######################################################################## # @@ -12,12 +12,12 @@ # # NOTE: This is NOT the calc rpm Makefile. This Makefile is a generic # Makefile for the people who build calc from the bzip2-ed tarball. -# Without modification, it not assume the system has readline, ncurses -# or less. It compiles with gcc -O3 -g3 as well. You can change all -# this by modifying the Makefile variables below. +# Without modification, it does not assume the system has readline, +# ncurses or less. It compiles with gcc -O3 -g3 as well. You can +# change all this by modifying the Makefile variables below. # # NOTE: You might want use the READLINE facility if your system -# has the GNU readline headers and libaraies: +# has the GNU readline headers and libraries: # # USE_READLINE= -DUSE_READLINE # READLINE_LIB= -lreadline @@ -26,7 +26,7 @@ # Copyright (C) 1999-2008 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 +# the terms of 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 @@ -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.54 $$ -# @(#) $Id: Makefile.ship,v 30.54 2013/08/11 05:40:18 chongo Exp $ -# @(#) $Source: /usr/local/src/cmd/calc/RCS/Makefile.ship,v $ +MAKEFILE_REV= $$Revision: 30.58 $$ +# @(#) $Id: Makefile.ship,v 30.58 2013/08/18 20:36:50 chongo Exp $ +# @(#) $Source: /usr/local/src/bin/calc/RCS/Makefile.ship,v $ # # Under source code control: 1990/02/15 01:48:41 # File existed as early as: before 1990 @@ -61,7 +61,7 @@ MAKEFILE_REV= $$Revision: 30.54 $$ # # make ...__optional_arguments_... target=value -# Try uname -s if the target was not alreadhy set on the make command line +# Try uname -s if the target was not already set on the make command line # ifeq ($(target),) target=$(shell uname -s 2>/dev/null) @@ -101,13 +101,13 @@ TERMCONTROL= # If you do not have vsprintf(), then calc will try sprintf() and hope # for the best. # -# A simular problem occurs if your system does not have a vsnprintf() +# A similar problem occurs if your system does not have a vsnprintf() # function. This function is like the vsprintf() function except that # there is an extra second argument that controls the maximum size # string that is produced. # # If HAVE_VSPRINTF is empty, this Makefile will run the have_stdvs.c and/or -# have_varvs.c program to determine if vsprintf() is supported. If +# have_varvs.c program to determine if vsprintf() is supported. If # HAVE_VSPRINTF is set to -DDONT_HAVE_VSPRINTF then calc will hope that # sprintf() will work. # @@ -243,13 +243,13 @@ INODE_BITS= #INODE_BITS= 64 # Determine if we have an off_t which one can perform arithmetic operations, -# assignments and comparisons. On some systems off_t is some sort of union +# assignments and comparisons. On some systems off_t is some sort of union # or struct. # # If HAVE_OFFSCL is empty, this Makefile will run the have_offscl program # to determine if off_t is a scalar. If HAVE_OFFSCL is set to the value # -DOFF_T_NON_SCALAR when calc will assume that off_t some sort of -# union or struct which. +# union or struct. # # If in doubt, leave HAVE_OFFSCL empty and this Makefile will figure it out. # @@ -257,7 +257,7 @@ HAVE_OFFSCL= #HAVE_OFFSCL= -DOFF_T_NON_SCALAR # Determine if we have an fpos_t which one can perform arithmetic operations, -# assignments and comparisons. On some systems fpos_t is some sort of union +# assignments and comparisons. On some systems fpos_t is some sort of union # or struct. Some systems do not have an fpos_t and long is as a file # offset instead. # @@ -265,7 +265,7 @@ HAVE_OFFSCL= # to determine if off_t is a scalar, or if there is no off_t and long # (a scalar) should be used instead. If HAVE_POSSCL is set to the value # -DFILEPOS_NON_SCALAR when calc will assume that fpos_t exists and is -# some sort of union or struct which. +# some sort of union or struct. # # If in doubt, leave HAVE_POSSCL empty and this Makefile will figure it out. # @@ -286,7 +286,7 @@ HAVE_CONST= # Determine if we have uid_t # # If HAVE_UID_T is empty, this Makefile will run the have_uid_t program -# to determine if const is supported. If HAVE_UID_T is set to -DHAVE_NO_UID_T, +# to determine if uid_t is supported. If HAVE_UID_T is set to -DHAVE_NO_UID_T, # then calc will treat uid_t as an unsigned short. This only matters if # $HOME is not set and calc must look up the home directory in /etc/passwd. # @@ -313,7 +313,7 @@ HAVE_NEWSTR= # If HAVE_MEMMOVE is empty, this Makefile will run the have_memmv program # to determine if memmove() is supported. If HAVE_MEMMOVE is set to # -DHAVE_NO_MEMMOVE, then calc will use internal functions to simulate -# the memory move function that does correct overlapping memory modes. +# the memory move function that does correct overlapping memory moves. # # If in doubt, leave HAVE_MEMMOVE empty and this Makefile will figure it out. # @@ -322,10 +322,10 @@ HAVE_MEMMOVE= # Determine if we have ustat() # -# If HAVE_USTAT is empty, this Makefile will run the have_memmv program -# to determine if ustat() is supported. If HAVE_USTAT is set to +# If HAVE_USTAT is empty, this Makefile will run the have_ustat program +# to determine if ustat() is supported. If HAVE_USTAT is set to # -DHAVE_NO_USTAT, then calc will use internal functions to simulate -# the memory move function that does correct overlapping memory modes. +# the ustat() function that gets file system statistics. # # Select HAVE_USTAT= -DHAVE_NO_USTAT for DJGPP. # @@ -336,10 +336,10 @@ HAVE_USTAT= # Determine if we have getsid() # -# If HAVE_GETSID is empty, this Makefile will run the have_memmv program +# If HAVE_GETSID is empty, this Makefile will run the have_getsid program # to determine if getsid() is supported. If HAVE_GETSID is set to # -DHAVE_NO_GETSID, then calc will use internal functions to simulate -# the memory move function that does correct overlapping memory modes. +# the getsid() function that gets session ID. # # Select HAVE_GETSID= -DHAVE_NO_GETSID for DJGPP. # @@ -350,10 +350,10 @@ HAVE_GETSID= # Determine if we have getpgid() # -# If HAVE_GETPGID is empty, this Makefile will run the have_memmv program +# If HAVE_GETPGID is empty, this Makefile will run the have_getpgid program # to determine if getpgid() is supported. If HAVE_GETPGID is set to # -DHAVE_NO_GETPGID, then calc will use internal functions to simulate -# the memory move function that does correct overlapping memory modes. +# the getpgid() function that sets the process group ID. # # Select HAVE_GETPGID= -DHAVE_NO_GETPGID for DJGPP. # @@ -364,10 +364,10 @@ HAVE_GETPGID= # Determine if we have clock_gettime() # -# If HAVE_GETTIME is empty, this Makefile will run the have_memmv program -# to determine if clock_gettime() is supported. If HAVE_GETTIME is set to +# If HAVE_GETTIME is empty, this Makefile will run the have_gettime program +# to determine if clock_gettime() is supported. If HAVE_GETTIME is set to # -DHAVE_NO_GETTIME, then calc will use internal functions to simulate -# the memory move function that does correct overlapping memory modes. +# the clock_gettime() function. # # Select HAVE_GETTIME= -DHAVE_NO_GETTIME for DJGPP. # @@ -378,10 +378,10 @@ HAVE_GETTIME= # Determine if we have getprid() # -# If HAVE_GETPRID is empty, this Makefile will run the have_memmv program +# If HAVE_GETPRID is empty, this Makefile will run the have_getprid program # to determine if getprid() is supported. If HAVE_GETPRID is set to # -DHAVE_NO_GETPRID, then calc will use internal functions to simulate -# the memory move function that does correct overlapping memory modes. +# the getprid() function. # # Select HAVE_GETPRID= -DHAVE_NO_GETPRID for DJGPP. # @@ -392,7 +392,7 @@ HAVE_GETPRID= # Determine if we have the /dev/urandom # -# HAVE_URANDOM_H= let the Makefile look /dev/urandom +# HAVE_URANDOM_H= let the Makefile look for /dev/urandom # HAVE_URANDOM_H= YES assume that /dev/urandom exists # HAVE_URANDOM_H= NO assume that /dev/urandom does not exist # @@ -406,10 +406,10 @@ HAVE_URANDOM_H= # Determine if we have getrusage() # -# If HAVE_GETRUSAGE is empty, this Makefile will run the have_memmv program +# If HAVE_GETRUSAGE is empty, this Makefile will run the have_rusage program # to determine if getrusage() is supported. If HAVE_GETRUSAGE is set to # -DHAVE_NO_GETRUSAGE, then calc will use internal functions to simulate -# the memory move function that does correct overlapping memory modes. +# the getrusage() function. # # If in doubt, leave HAVE_GETRUSAGE empty and this Makefile will figure it out. # @@ -418,10 +418,10 @@ HAVE_GETRUSAGE= # Determine if we have strdup() # -# If HAVE_STRDUP is empty, this Makefile will run the have_memmv program +# If HAVE_STRDUP is empty, this Makefile will run the have_strdup program # to determine if strdup() is supported. If HAVE_STRDUP is set to # -DHAVE_NO_STRDUP, then calc will use internal functions to simulate -# the memory move function that does correct overlapping memory modes. +# the strdup() function. # # If in doubt, leave HAVE_STRDUP empty and this Makefile will figure it out. # @@ -429,10 +429,10 @@ HAVE_STRDUP= #HAVE_STRDUP= -DHAVE_NO_STRDUP # Some architectures such as Sparc do not allow one to access 32 bit values -# that are not alligned on a 32 bit boundary. +# that are not aligned on a 32 bit boundary. # # The Dec Alpha running OSF/1 will produce alignment error messages when -# align32.c tries to figure out if alignment is needed. Use the +# align32.c tries to figure out if alignment is needed. Use the # ALIGN32= -DMUST_ALIGN32 to force alignment and avoid such error messages. # # ALIGN32= let align32.c figure out if alignment is needed @@ -587,7 +587,7 @@ HAVE_UNUSED= #INCDIR= /dev/env/DJDIR/include INCDIR= /usr/include -# Where to install calc realted things +# Where to install calc related things # # ${BINDIR} where to install calc binary files # ${LIBDIR} where calc link library (*.a) files are installed @@ -672,7 +672,7 @@ SCRIPTDIR= ${BINDIR}/cscript # T - top level directory under which calc will be installed # # The calc install is performed under ${T}, the calc build is -# performed under /. The purpose for ${T} is to allow someone +# performed under /. The purpose for ${T} is to allow someone # to install calc somewhere other than into the system area. # # For example, if: @@ -690,7 +690,7 @@ SCRIPTDIR= ${BINDIR}/cscript # calc binary files: /var/tmp/testing/usr/bin # calc link library: /var/tmp/testing/usr/lib # calc help, .cal ...: /var/tmp/testing/usr/share/calc -# ... etc ... /var/tmp/testing/... +# ... etc ... /var/tmp/testing/... # # If ${T} is empty, calc is installed under /, which is the same # top of tree for which it was built. If ${T} is non-empty, then @@ -754,12 +754,12 @@ CATEXT= 1 # If NROFF is non-empty, then # # ${NROFF} ${NROFF_ARG} calc.1 > ${CATDIR}/calc.${CATEXT} -# is used to built and install the cat page +# is used to build and install the cat page # # else (NROFF is empty) # # ${MANMAKE} calc.1 ${CATDIR} -# is used to built and install the cat page +# is used to build and install the cat page # else # # The cat page is not built or installed @@ -782,8 +782,8 @@ CATMODE= 0444 # By default, custom builtin functions may only be executed if calc # is given the -C option. This is because custom builtin functions -# may invoke non-standard or non-portable code. One may completely -# disable custom builtin functions by not compiling any of code +# may invoke non-standard or non-portable code. One may completely +# disable custom builtin functions by not compiling any custom code # # ALLOW_CUSTOM= -DCUSTOM # allow custom only if -C is given # ALLOW_CUSTOM= # disable custom even if -C is given @@ -794,7 +794,7 @@ ALLOW_CUSTOM= -DCUSTOM #ALLOW_CUSTOM= # If the $CALCPATH environment variable is not defined, then the following -# path will be search for calc resource file routines. +# path will be searched for calc resource file routines. # # Select CALCPATH= .;./cal;~/.cal;${CALC_SHAREDIR};${CUSTOMCALDIR} for DJGPP. # @@ -809,7 +809,7 @@ endif #endif /* end of skip for non-Gnu makefiles */ # If the $CALCRC environment variable is not defined, then the following -# path will be search for calc resource files. +# path will be searched for calc resource files. # # Select CALCRC= ${CALC_SHAREDIR}/startup;~/.calcrc;./.calcinit for DJGPP. # @@ -817,7 +817,7 @@ CALCRC= ${CALC_SHAREDIR}/startup:~/.calcrc:./.calcinit #CALCRC= ${CALC_SHAREDIR}/startup;~/.calcrc;./.calcinit # Determine of the GNU-readline facility will be used instead of the -# built-in calc binding method. +# builtin calc binding method. # # USE_READLINE= Do not use GNU-readline, use calc bindings # USE_READLINE= -DUSE_READLINE Use GNU-readline, do not use calc bindings @@ -831,7 +831,7 @@ CALCRC= ${CALC_SHAREDIR}/startup:~/.calcrc:./.calcinit # READLINE_INCLUDE Where the readline include files reside # (leave blank if they are /usr/include/readline) # -# NOTE: The GNU-readline code is not shipped with calc. You must have +# NOTE: The GNU-readline code is not shipped with calc. You must have # the appropriate headers and link libs installed on your system in # order to use it. # @@ -908,9 +908,9 @@ RANLIB=ranlib #RANLIB=: # Normally certain files depend on the Makefile. If the Makefile is -# changed, then certain steps should be redone. If MAKE_FILE is +# changed, then certain steps should be redone. If MAKE_FILE is # set to Makefile, then these files will depend on Makefile. If -# MAKE_FILE is empty, then they wont. +# MAKE_FILE is empty, then they won't. # # If in doubt, set MAKE_FILE to Makefile # @@ -971,9 +971,9 @@ CALC_ENV= CALCPATH=./cal LD_LIBRARY_PATH=. # # ${MKDIR} ${MKDIR_ARG} # -# to create directorties. Normall this amounts to usins mkdir -p dir ... -# Some older systems may not have mkdir -p. If you system does not -# make mkdir -p, then set MKDIR_ARG to empty. +# to create directories. Normally this amounts to using mkdir -p dir ... +# Some older systems may not have mkdir -p. If your system does not +# have mkdir -p, then set MKDIR_ARG to empty. # # MKDIR_ARG= -p # use mkdir -p when creating paths # MKDIR_ARG= # use if system does not understand mkdir -p @@ -981,8 +981,8 @@ CALC_ENV= CALCPATH=./cal LD_LIBRARY_PATH=. MKDIR_ARG= -p #MKDIR_ARG= -# Some out of date operating systems require / want an executable to -# end with a certain file extension. Some compile systems such as +# Some out of date operating systems require/want an executable to +# end with a certain file extension. Some compiler systems such as # windoz build calc as calc.exe. The EXT variable is used to denote # the extension required by such. Note that Cygwin requires EXT to be # the same as Linux/Un*x/GNU, even though it runs under windoz. @@ -997,7 +997,7 @@ EXT= # The default calc versions # -VERSION= 2.12.4.10 +VERSION= 2.12.4.11 VERS= 2.12.4 VER= 2.12 VE= 2 @@ -1048,11 +1048,11 @@ STRIP= strip # Extra compiling and linking flags # # EXTRA_CFLAGS are flags given to ${CC} when compiling C files -# EXTRA_LDFLAGS are flags given to ${CC} when linking progs +# EXTRA_LDFLAGS are flags given to ${CC} when linking programs # # Both CFLAGS and LDFLAGS are left blank in this Makefile by # default so that users may use them on the make command line -# to always the way that C is compiled and files are linked +# to always set the way that C is compiled and files are linked # respectively. For example: # # make all EXTRA_CFLAGS="-DMAGIC" EXTRA_LDFLAGS="-lmagic" @@ -1060,13 +1060,13 @@ STRIP= strip # NOTE: These should be left blank in this Makefile to make it # easier to add stuff on the command line. If you want to # to change the way calc is compiled by this Makefile, change -# the appropirate host target section below or a flag above. +# the appropriate host target section below or a flag above. # EXTRA_CFLAGS= EXTRA_LDFLAGS= -# COMMON_CFLAGS are the common ${CC} flags used for all progs, both -# intermediate and final calc and calc related progs +# COMMON_CFLAGS are the common ${CC} flags used for all programs, both +# intermediate and final calc and calc related programs # #if 0 /* start of skip for non-Gnu makefiles */ ifdef ALLOW_CUSTOM @@ -1078,8 +1078,8 @@ COMMON_CFLAGS= -DCALC_SRC -UCUSTOM ${CCWARN} ${CCMISC} ${EXTRA_CFLAGS} endif #endif /* end of skip for non-Gnu makefiles */ -# COMMON_LDFLAGS are the common flags used for linking all progs, both -# intermediate and final calc and calc related progs +# COMMON_LDFLAGS are the common flags used for linking all programs, both +# intermediate and final calc and calc related programs # COMMON_LDFLAGS= ${EXTRA_LDFLAGS} @@ -1097,16 +1097,16 @@ COMMON_LDFLAGS= ${EXTRA_LDFLAGS} # BLD_TYPE= calc-static-only # # CC_SHARE are flags given to ${CC} to build .o files suitable for shared libs -# DEFAULT_LIB_INSTALL_PATH is where calc progs look for calc shared libs +# DEFAULT_LIB_INSTALL_PATH is where calc programs look for calc shared libs # LD_SHARE are common flags given to ${CC} to link with shared libraries -# LIBCALC_SHLIB are flags given to ${CC} to build libcalc shared lib +# 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 # # 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 -# LIBCALC_STATIC are flags given to ${CC} to build libcalc static lib +# LIBCALC_STATIC are flags given to ${CC} to build libcalc static libraries # LIBCUSTCALC_STATIC are flags given to ${CC} to build libcustcalc static lib # # NOTE: The above 4 values are unused if BLD_TYPE= calc-dynamic-only @@ -1119,7 +1119,7 @@ COMMON_LDFLAGS= ${EXTRA_LDFLAGS} # to abort on warnings, then leave CCWERR blank. # CCMISC are misc flags given to ${CC} # -# LCC how the C compiler is invoked on locally executed intermediate progs +# LCC is how the C compiler is invoked on locally executed intermediate programs # CC is how the C compiler is invoked (with an optional Purify) # # Specific target overrides or modifications to default values @@ -1200,7 +1200,7 @@ CCMISC= ${DARWIN_ARCH} LCC= MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} gcc CC= ${PURIFY} ${LCC} ${CCWERR} # -# Darmin dynamic shared lib filenames +# Darwin dynamic shared lib filenames LIB_EXT:= .dylib LIB_EXT_VERSION:= .${VERSION}${LIB_EXT} LIB_EXT_VERS:= .${VERS}${LIB_EXT} @@ -1403,10 +1403,10 @@ CC= ${PURIFY} ${LCC} ${CCWERR} # # The simple makefile forces the use of static ${CC} flags # -# ICFLAGS are given to ${CC} for intermediate progs used to help compile calc -# CFLAGS are given to ${CC} for calc progs other than intermediate progs -# ILDFLAGS for ${CC} in linking intermediate progs used to help compile calc -# LDFLAGS for ${CC} in linking calc progs other than intermediate progs +# ICFLAGS are given to ${CC} for intermediate programs used to help compile calc +# CFLAGS are given to ${CC} for calc programs other than intermediate programs +# ILDFLAGS for ${CC} in linking intermediate programs used to help compile calc +# LDFLAGS for ${CC} in linking calc programs other than intermediate programs # ICFLAGS= ${COMMON_CFLAGS} ${CC_STATIC} CFLAGS= ${ICFLAGS} ${CCOPT} @@ -1506,8 +1506,8 @@ endif # Required flags to compile C files for calc # -# ICFLAGS are given to ${CC} for intermediate progs used to help compile calc -# CFLAGS are given to ${CC} for calc progs other than intermediate progs +# ICFLAGS are given to ${CC} for intermediate programs used to help compile calc +# CFLAGS are given to ${CC} for calc programs other than intermediate programs # # NOTE: This does not work for: make-XYZ-only and BLD_TYPE != make-XYZ-only # @@ -1520,8 +1520,8 @@ CFLAGS= ${ICFLAGS} ${CCOPT} # Required flags to link files for calc # -# ILDFLAGS for ${CC} in linking intermediate progs used to help compile calc -# LDFLAGS for ${CC} in linking calc progs other than intermediate progs +# ILDFLAGS for ${CC} in linking intermediate programs used to help compile calc +# LDFLAGS for ${CC} in linking calc programs other than intermediate programs # ILDFLAGS= ${COMMON_LDFLAGS} LDFLAGS= ${LD_DEBUG} ${ILDFLAGS} @@ -1740,7 +1740,7 @@ CUSTOM_PASSDOWN= \ VERSION=${VERSION} \ target=${target} -# The compelte list of Makefile vars passed down to help/Makefile. +# The complete list of Makefile vars passed down to help/Makefile. # HELP_PASSDOWN= \ AR=${AR} \ @@ -1777,7 +1777,7 @@ HELP_PASSDOWN= \ TOUCH=${TOUCH} \ TRUE=${TRUE} -# The compelte list of Makefile vars passed down to cal/Makefile. +# The complete list of Makefile vars passed down to cal/Makefile. # CAL_PASSDOWN= \ AR=${AR} \ @@ -1805,7 +1805,7 @@ CAL_PASSDOWN= \ TOUCH=${TOUCH} \ TRUE=${TRUE} -# The compelte list of Makefile vars passed down to cscript/Makefile. +# The complete list of Makefile vars passed down to cscript/Makefile. # CSCRIPT_PASSDOWN= \ AR=${AR} \ @@ -1854,7 +1854,7 @@ DISTLIST= ${C_SRC} ${H_SRC} ${MAKE_FILE} BUGS CHANGES LIBRARY README \ README.WINDOWS calc.man HOWTO.INSTALL ${UTIL_MISC_SRC} ${LICENSE} \ sample.README calc.spec.in rpm.mk -# These files are used to make (but not built) a calc .a link library +# These files are used to make (but not build) a calc .a link library # CALCLIBLIST= ${LIBSRC} ${UTIL_C_SRC} ${LIB_H_SRC} ${MAKE_FILE} \ ${UTIL_MISC_SRC} BUGS CHANGES LIBRARY @@ -1875,7 +1875,7 @@ CALC_STATIC_LIBS= libcalc.a endif #endif /* end of skip for non-Gnu makefiles */ -# Libaraies created and used to build calc +# Libraries created and used to build calc # #if 0 /* start of skip for non-Gnu makefiles */ ifdef ALLOW_CUSTOM @@ -1887,7 +1887,7 @@ CALC_DYNAMIC_LIBS= libcalc${LIB_EXT_VERSION} endif #endif /* end of skip for non-Gnu makefiles */ -# Symlinks of dymanic shared libraries +# Symlinks of dynamic shared libraries # #if 0 /* start of skip for non-Gnu makefiles */ ifdef ALLOW_CUSTOM @@ -1903,7 +1903,7 @@ SYM_DYNAMIC_LIBS= libcalc${LIB_EXT_VER} libcalc${LIB_EXT_VE} libcalc${LIB_EXT} \ endif #endif /* end of skip for non-Gnu makefiles */ -# list of sample programs to that need to be built to satisfy sample rule +# list of sample programs that need to be built to satisfy sample rule # # NOTE: The ${SAMPLE_TARGETS} and ${SAMPLE_STATIC_TARGETS} are built but # not installed at this time. @@ -1914,7 +1914,7 @@ endif SAMPLE_TARGETS= sample_rand${EXT} sample_many${EXT} SAMPLE_STATIC_TARGETS= sample_rand-static${EXT} sample_many-static${EXT} -# list of cscript programs to that need to be built to satisfy cscript/.all +# list of cscript programs that need to be built to satisfy cscript/.all # # NOTE: This list MUST be coordinated with the ${CSCRIPT_TARGETS} variable # in the cscript/Makefile @@ -1977,7 +1977,7 @@ calc-dynamic-only: ${DYNAMIC_FIRST_TARGETS} ${EARLY_TARGETS} \ echo " ${MAKE} -f ${MAKE_FILE} clobber" 1>&2; \ echo " ${MAKE} -f ${MAKE_FILE} $$r BLD_TYPE=$$r" 1>&2; \ echo "" 1>&2; \ - echo "NOTE: It is a very good idea to c first clobber any" 1>&2; \ + echo "NOTE: It is a very good idea to first clobber any" 1>&2; \ echo " previously built .o, libs and executables" 1>&2; \ echo " before switching to $$r!" 1>&2; \ echo "" 1>&2; \ @@ -1993,7 +1993,7 @@ calc-dynamic-only: ${DYNAMIC_FIRST_TARGETS} ${EARLY_TARGETS} \ echo " ${MAKE} -f ${MAKE_FILE} clobber" 1>&2; \ echo " ${MAKE} -f ${MAKE_FILE} $$r BLD_TYPE=$$r" 1>&2; \ echo "" 1>&2; \ - echo "to clean out any previously build static files." 1>&2; \ + echo "to clean out any previously built static files." 1>&2; \ echo "" 1>&2; \ echo "=== aborting make ===" 1>&2; \ exit 2; \ @@ -2023,7 +2023,7 @@ calc-static-only: ${STATIC_FIRST_TARGETS} ${EARLY_TARGETS} \ echo " ${MAKE} -f ${MAKE_FILE} clobber" 1>&2; \ echo " ${MAKE} -f ${MAKE_FILE} $$r BLD_TYPE=$$r" 1>&2; \ echo "" 1>&2; \ - echo "NOTE: It is a very good idea to c first clobber any" 1>&2; \ + echo "NOTE: It is a very good idea to first clobber any" 1>&2; \ echo " previously built .o, libs and executables" 1>&2; \ echo " before switching to $$r!" 1>&2; \ echo "" 1>&2; \ @@ -2039,7 +2039,7 @@ calc-static-only: ${STATIC_FIRST_TARGETS} ${EARLY_TARGETS} \ echo " ${MAKE} -f ${MAKE_FILE} clobber" 1>&2; \ echo " ${MAKE} -f ${MAKE_FILE} $$r BLD_TYPE=$$r" 1>&2; \ echo "" 1>&2; \ - echo "to clean out any previously build dynamic files." 1>&2; \ + echo "to clean out any previously built dynamic files." 1>&2; \ echo "" 1>&2; \ echo "=== aborting make ===" 1>&2; \ exit 4; \ @@ -2135,8 +2135,8 @@ seed.o: seed.c no_implicit.arg ${MAKE_FILE} ### # # The next set of rules cause the .h files BUILD_H_SRC files to be built -# according tot he system and the Makefile variables above. The hsrc rule -# is a convenient rule to invoke to built all of the BUILD_H_SRC. +# according to the system and the Makefile variables above. The hsrc rule +# is a convenient rule to invoke to build all of the BUILD_H_SRC. # # We add in the BUILD_C_SRC files because they are similar to the # BUILD_H_SRC files in terms of the build process. @@ -3592,7 +3592,7 @@ endif ### # -# building calc-static and static lib*.a libraires +# building calc-static and static lib*.a libraries # ### @@ -3631,10 +3631,10 @@ sample_many-static${EXT}: sample_many.o ${CALC_STATIC_LIBS} ${MAKE_FILE} ### # -# Home grown make dependency rules. Your system make not support +# Homegrown make dependency rules. Your system may not support # or have the needed tools. You can ignore this section. # -# We will form a skelaton tree of *.c files containing only #include "foo.h" +# We will form a skeleton tree of *.c files containing only #include "foo.h" # lines and .h files containing the same lines surrounded by multiple include # prevention lines. This allows us to build a static depend list that will # satisfy all possible cpp symbol definition combinations. @@ -3744,21 +3744,21 @@ h_list: # 1 level version string. # # version: -# This rule simply echos the value found in this makefile. +# This rule simply echoes the value found in this makefile. # This rule produces the full version string. Note that the # full version could be 4 or 3 levels long depending on the # minor patch number. # # vers: -# This rule simply echos the value found in this makefile. +# This rule simply echoes the value found in this makefile. # This rule produces only a 3 level version string. # # ver: -# This rule simply echos the value found in this makefile. +# This rule simply echoes the value found in this makefile. # This rule produces only a 2 level version string. # # ve: -# This rule simply echos the value found in this makefile. +# This rule simply echoes the value found in this makefile. # This rule produces only a 1 level version string. # ### @@ -3876,7 +3876,7 @@ custom/Makefile.simple: custom/Makefile # # Doing a 'make chk' will cause only the context around interesting # (and error) messages to be printed. Unlike 'make check', this -# rule does not cause things to be built. I.e., the all rule is +# rule does not cause things to be built. i.e., the all rule is # not invoked. # ### @@ -4072,34 +4072,38 @@ env: mkdebug: env version.c @echo '=-=-=-=-= ${MAKE_FILE} start of $@ rule =-=-=-=-=' - @echo '=-=-=-=-= Determining the source version =-=-=-=-=' + @echo '=-=-=-= Determining the source version =-=-=-=' @${MAKE} -f Makefile Q= V=@ ver_calc${EXT} -@./ver_calc${EXT} - @echo '=-=-=-=-= Invoking ${MAKE} -f Makefile Q= V=@ all =-=-=-=-=' + @echo '=-=-=-= Invoking ${MAKE} -f Makefile Q= V=@ all =-=-=-=' @${MAKE} -f Makefile Q= V=@ all - @echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' - @echo '=-=-=-=-= Determining the binary version =-=-=-=-=' + @echo '=-=-=-= Back to the main Makefile for $@ rule =-=-=-=' + @echo '=-=-=-= Determining the binary version =-=-=-=' -@./calc${EXT} -e -q -v - @echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' + @echo '=-=-=-= Back to the main Makefile for $@ rule =-=-=-=' @echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-=' debug: env @echo '=-=-=-=-= ${MAKE_FILE} start of $@ rule =-=-=-=-=' - @echo '=-=-=-=-= Invoking ${MAKE} -f Makefile Q= V=@ clobber =-=-=-=-=' + @echo '=-=-=-= Invoking ${MAKE} -f Makefile Q= V=@ clobber =-=-=-=' @${MAKE} -f Makefile Q= V=@ clobber - @echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' - @echo '=-=-=-=-= Determining the source version =-=-=-=-=' + @echo '=-=-=-= Back to the main Makefile for $@ rule =-=-=-=' + @echo '=-=-=-= Invoking ${MAKE} -f Makefile Q= V=@ all =-=-=-=' + @echo '=-=-= this may take a bit of time =-=-=' + @${MAKE} -f Makefile Q= V=@ all + @echo '=-=-=-= Back to the main Makefile for $@ rule =-=-=-=' + @echo '=-=-=-= Determining the source version =-=-=-=' @${MAKE} -f Makefile Q= V=@ ver_calc${EXT} -@./ver_calc${EXT} - @echo '=-=-=-=-= Invoking ${MAKE} -f Makefile Q= V=@ all =-=-=-=-=' - @${MAKE} -f Makefile Q= V=@ all - @echo '=-=-=-=-= Determining the binary version =-=-=-=-=' - -@./calc${EXT} -e -q -v - @echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' - @echo '=-=-=-=-= Invoking ${MAKE} -f Makefile Q= V=@ chk =-=-=-=-=' - @echo '=-=-=-=-= this may take a while =-=-=-=-=' - @${MAKE} -f Makefile Q= V=@ chk - @echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' + @echo '=-=-=-= Back to the main Makefile for $@ rule =-=-=-=' + @echo -n '=-=-=-= Print #defile values if custom functions ' + @echo 'are allowed =-=-=-=' + -@./calc${EXT} -e -q -C 'print custom("sysinfo", 2);' + @echo '=-=-=-= Back to the main Makefile for $@ rule =-=-=-=' + @echo '=-=-=-= Invoking ${MAKE} -f Makefile Q= V=@ check =-=-=-=' + @echo '=-=-= this may take a while =-=-=' + @${MAKE} -f Makefile Q= V=@ check + @echo '=-=-=-= Back to the main Makefile for $@ rule =-=-=-=' @echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-=' ### @@ -4210,7 +4214,7 @@ inst_files: ${MAKE_FILE} help/Makefile cal/Makefile custom/Makefile \ ${Q} LANG=C ${SORT} -u inst_files -o inst_files ${V} echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-=' -# The olduninstall rule will remove calc files from the older, histroic +# The olduninstall rule will remove calc files from the older, historic # locations under the /usr/local directory. If you are using the # new default values for ${BINDIR}, ${CALC_SHAREDIR}, ${INCDIR} and ${LIBDIR} # then you can use this rule to clean out the older calc stuff under @@ -4329,7 +4333,7 @@ clobber: custom/Makefile clean # install everything # -# NOTE: Keep the uninstall rule in reverse order to the install rule +# NOTE: Keep the uninstall rule in the reverse order of the install rule # install: custom/Makefile ${LIB_H_SRC} ${BUILD_H_SRC} calc.1 all ${V} echo '=-=-=-=-= ${MAKE_FILE} start of $@ rule =-=-=-=-=' @@ -4636,7 +4640,7 @@ endif # Try to remove everything that was installed # -# NOTE: Keep the uninstall rule in reverse order to the install rule +# NOTE: Keep the uninstall rule in the reverse order of the install rule # uninstall: custom/Makefile ${V} echo '=-=-=-=-= ${MAKE_FILE} start of $@ rule =-=-=-=-=' @@ -4840,7 +4844,7 @@ strip: done ${V} echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-=' -# calc-symlink - setup symlinks from stardard locations into the ${T} tree +# calc-symlink - setup symlinks from standard locations into the ${T} tree # calc-symlink: ${Q}if [ -z "${T}" ]; then \ diff --git a/Makefile.simple b/Makefile.simple index 87f2270..088122e 100644 --- a/Makefile.simple +++ b/Makefile.simple @@ -4,7 +4,7 @@ # ######################################################################## # Gnu makefile: # This is a Gnu make makefile. If your make does not # -# Gnu makefile: # understand this makefilkke format, then edit and use # +# Gnu makefile: # understand this makefile format, then edit and use # # Gnu makefile: # Makefile.simple instead of this Makefile. # ######################################################################## # @@ -12,12 +12,12 @@ # # NOTE: This is NOT the calc rpm Makefile. This Makefile is a generic # Makefile for the people who build calc from the bzip2-ed tarball. -# Without modification, it not assume the system has readline, ncurses -# or less. It compiles with gcc -O3 -g3 as well. You can change all -# this by modifying the Makefile variables below. +# Without modification, it does not assume the system has readline, +# ncurses or less. It compiles with gcc -O3 -g3 as well. You can +# change all this by modifying the Makefile variables below. # # NOTE: You might want use the READLINE facility if your system -# has the GNU readline headers and libaraies: +# has the GNU readline headers and libraries: # # USE_READLINE= -DUSE_READLINE # READLINE_LIB= -lreadline @@ -26,7 +26,7 @@ # Copyright (C) 1999-2008 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 +# the terms of 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 @@ -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.54 $$ -# @(#) $Id: Makefile.ship,v 30.54 2013/08/11 05:40:18 chongo Exp $ -# @(#) $Source: /usr/local/src/cmd/calc/RCS/Makefile.ship,v $ +MAKEFILE_REV= $$Revision: 30.58 $$ +# @(#) $Id: Makefile.ship,v 30.58 2013/08/18 20:36:50 chongo Exp $ +# @(#) $Source: /usr/local/src/bin/calc/RCS/Makefile.ship,v $ # # Under source code control: 1990/02/15 01:48:41 # File existed as early as: before 1990 @@ -86,13 +86,13 @@ TERMCONTROL= # If you do not have vsprintf(), then calc will try sprintf() and hope # for the best. # -# A simular problem occurs if your system does not have a vsnprintf() +# A similar problem occurs if your system does not have a vsnprintf() # function. This function is like the vsprintf() function except that # there is an extra second argument that controls the maximum size # string that is produced. # # If HAVE_VSPRINTF is empty, this Makefile will run the have_stdvs.c and/or -# have_varvs.c program to determine if vsprintf() is supported. If +# have_varvs.c program to determine if vsprintf() is supported. If # HAVE_VSPRINTF is set to -DDONT_HAVE_VSPRINTF then calc will hope that # sprintf() will work. # @@ -228,13 +228,13 @@ INODE_BITS= #INODE_BITS= 64 # Determine if we have an off_t which one can perform arithmetic operations, -# assignments and comparisons. On some systems off_t is some sort of union +# assignments and comparisons. On some systems off_t is some sort of union # or struct. # # If HAVE_OFFSCL is empty, this Makefile will run the have_offscl program # to determine if off_t is a scalar. If HAVE_OFFSCL is set to the value # -DOFF_T_NON_SCALAR when calc will assume that off_t some sort of -# union or struct which. +# union or struct. # # If in doubt, leave HAVE_OFFSCL empty and this Makefile will figure it out. # @@ -242,7 +242,7 @@ HAVE_OFFSCL= #HAVE_OFFSCL= -DOFF_T_NON_SCALAR # Determine if we have an fpos_t which one can perform arithmetic operations, -# assignments and comparisons. On some systems fpos_t is some sort of union +# assignments and comparisons. On some systems fpos_t is some sort of union # or struct. Some systems do not have an fpos_t and long is as a file # offset instead. # @@ -250,7 +250,7 @@ HAVE_OFFSCL= # to determine if off_t is a scalar, or if there is no off_t and long # (a scalar) should be used instead. If HAVE_POSSCL is set to the value # -DFILEPOS_NON_SCALAR when calc will assume that fpos_t exists and is -# some sort of union or struct which. +# some sort of union or struct. # # If in doubt, leave HAVE_POSSCL empty and this Makefile will figure it out. # @@ -271,7 +271,7 @@ HAVE_CONST= # Determine if we have uid_t # # If HAVE_UID_T is empty, this Makefile will run the have_uid_t program -# to determine if const is supported. If HAVE_UID_T is set to -DHAVE_NO_UID_T, +# to determine if uid_t is supported. If HAVE_UID_T is set to -DHAVE_NO_UID_T, # then calc will treat uid_t as an unsigned short. This only matters if # $HOME is not set and calc must look up the home directory in /etc/passwd. # @@ -298,7 +298,7 @@ HAVE_NEWSTR= # If HAVE_MEMMOVE is empty, this Makefile will run the have_memmv program # to determine if memmove() is supported. If HAVE_MEMMOVE is set to # -DHAVE_NO_MEMMOVE, then calc will use internal functions to simulate -# the memory move function that does correct overlapping memory modes. +# the memory move function that does correct overlapping memory moves. # # If in doubt, leave HAVE_MEMMOVE empty and this Makefile will figure it out. # @@ -307,10 +307,10 @@ HAVE_MEMMOVE= # Determine if we have ustat() # -# If HAVE_USTAT is empty, this Makefile will run the have_memmv program -# to determine if ustat() is supported. If HAVE_USTAT is set to +# If HAVE_USTAT is empty, this Makefile will run the have_ustat program +# to determine if ustat() is supported. If HAVE_USTAT is set to # -DHAVE_NO_USTAT, then calc will use internal functions to simulate -# the memory move function that does correct overlapping memory modes. +# the ustat() function that gets file system statistics. # # Select HAVE_USTAT= -DHAVE_NO_USTAT for DJGPP. # @@ -321,10 +321,10 @@ HAVE_USTAT= # Determine if we have getsid() # -# If HAVE_GETSID is empty, this Makefile will run the have_memmv program +# If HAVE_GETSID is empty, this Makefile will run the have_getsid program # to determine if getsid() is supported. If HAVE_GETSID is set to # -DHAVE_NO_GETSID, then calc will use internal functions to simulate -# the memory move function that does correct overlapping memory modes. +# the getsid() function that gets session ID. # # Select HAVE_GETSID= -DHAVE_NO_GETSID for DJGPP. # @@ -335,10 +335,10 @@ HAVE_GETSID= # Determine if we have getpgid() # -# If HAVE_GETPGID is empty, this Makefile will run the have_memmv program +# If HAVE_GETPGID is empty, this Makefile will run the have_getpgid program # to determine if getpgid() is supported. If HAVE_GETPGID is set to # -DHAVE_NO_GETPGID, then calc will use internal functions to simulate -# the memory move function that does correct overlapping memory modes. +# the getpgid() function that sets the process group ID. # # Select HAVE_GETPGID= -DHAVE_NO_GETPGID for DJGPP. # @@ -349,10 +349,10 @@ HAVE_GETPGID= # Determine if we have clock_gettime() # -# If HAVE_GETTIME is empty, this Makefile will run the have_memmv program -# to determine if clock_gettime() is supported. If HAVE_GETTIME is set to +# If HAVE_GETTIME is empty, this Makefile will run the have_gettime program +# to determine if clock_gettime() is supported. If HAVE_GETTIME is set to # -DHAVE_NO_GETTIME, then calc will use internal functions to simulate -# the memory move function that does correct overlapping memory modes. +# the clock_gettime() function. # # Select HAVE_GETTIME= -DHAVE_NO_GETTIME for DJGPP. # @@ -363,10 +363,10 @@ HAVE_GETTIME= # Determine if we have getprid() # -# If HAVE_GETPRID is empty, this Makefile will run the have_memmv program +# If HAVE_GETPRID is empty, this Makefile will run the have_getprid program # to determine if getprid() is supported. If HAVE_GETPRID is set to # -DHAVE_NO_GETPRID, then calc will use internal functions to simulate -# the memory move function that does correct overlapping memory modes. +# the getprid() function. # # Select HAVE_GETPRID= -DHAVE_NO_GETPRID for DJGPP. # @@ -377,7 +377,7 @@ HAVE_GETPRID= # Determine if we have the /dev/urandom # -# HAVE_URANDOM_H= let the Makefile look /dev/urandom +# HAVE_URANDOM_H= let the Makefile look for /dev/urandom # HAVE_URANDOM_H= YES assume that /dev/urandom exists # HAVE_URANDOM_H= NO assume that /dev/urandom does not exist # @@ -391,10 +391,10 @@ HAVE_URANDOM_H= # Determine if we have getrusage() # -# If HAVE_GETRUSAGE is empty, this Makefile will run the have_memmv program +# If HAVE_GETRUSAGE is empty, this Makefile will run the have_rusage program # to determine if getrusage() is supported. If HAVE_GETRUSAGE is set to # -DHAVE_NO_GETRUSAGE, then calc will use internal functions to simulate -# the memory move function that does correct overlapping memory modes. +# the getrusage() function. # # If in doubt, leave HAVE_GETRUSAGE empty and this Makefile will figure it out. # @@ -403,10 +403,10 @@ HAVE_GETRUSAGE= # Determine if we have strdup() # -# If HAVE_STRDUP is empty, this Makefile will run the have_memmv program +# If HAVE_STRDUP is empty, this Makefile will run the have_strdup program # to determine if strdup() is supported. If HAVE_STRDUP is set to # -DHAVE_NO_STRDUP, then calc will use internal functions to simulate -# the memory move function that does correct overlapping memory modes. +# the strdup() function. # # If in doubt, leave HAVE_STRDUP empty and this Makefile will figure it out. # @@ -414,10 +414,10 @@ HAVE_STRDUP= #HAVE_STRDUP= -DHAVE_NO_STRDUP # Some architectures such as Sparc do not allow one to access 32 bit values -# that are not alligned on a 32 bit boundary. +# that are not aligned on a 32 bit boundary. # # The Dec Alpha running OSF/1 will produce alignment error messages when -# align32.c tries to figure out if alignment is needed. Use the +# align32.c tries to figure out if alignment is needed. Use the # ALIGN32= -DMUST_ALIGN32 to force alignment and avoid such error messages. # # ALIGN32= let align32.c figure out if alignment is needed @@ -572,7 +572,7 @@ HAVE_UNUSED= #INCDIR= /dev/env/DJDIR/include INCDIR= /usr/include -# Where to install calc realted things +# Where to install calc related things # # ${BINDIR} where to install calc binary files # ${LIBDIR} where calc link library (*.a) files are installed @@ -657,7 +657,7 @@ SCRIPTDIR= ${BINDIR}/cscript # T - top level directory under which calc will be installed # # The calc install is performed under ${T}, the calc build is -# performed under /. The purpose for ${T} is to allow someone +# performed under /. The purpose for ${T} is to allow someone # to install calc somewhere other than into the system area. # # For example, if: @@ -675,7 +675,7 @@ SCRIPTDIR= ${BINDIR}/cscript # calc binary files: /var/tmp/testing/usr/bin # calc link library: /var/tmp/testing/usr/lib # calc help, .cal ...: /var/tmp/testing/usr/share/calc -# ... etc ... /var/tmp/testing/... +# ... etc ... /var/tmp/testing/... # # If ${T} is empty, calc is installed under /, which is the same # top of tree for which it was built. If ${T} is non-empty, then @@ -739,12 +739,12 @@ CATEXT= 1 # If NROFF is non-empty, then # # ${NROFF} ${NROFF_ARG} calc.1 > ${CATDIR}/calc.${CATEXT} -# is used to built and install the cat page +# is used to build and install the cat page # # else (NROFF is empty) # # ${MANMAKE} calc.1 ${CATDIR} -# is used to built and install the cat page +# is used to build and install the cat page # else # # The cat page is not built or installed @@ -767,8 +767,8 @@ CATMODE= 0444 # By default, custom builtin functions may only be executed if calc # is given the -C option. This is because custom builtin functions -# may invoke non-standard or non-portable code. One may completely -# disable custom builtin functions by not compiling any of code +# may invoke non-standard or non-portable code. One may completely +# disable custom builtin functions by not compiling any custom code # # ALLOW_CUSTOM= -DCUSTOM # allow custom only if -C is given # ALLOW_CUSTOM= # disable custom even if -C is given @@ -779,14 +779,14 @@ ALLOW_CUSTOM= -DCUSTOM #ALLOW_CUSTOM= # If the $CALCPATH environment variable is not defined, then the following -# path will be search for calc resource file routines. +# path will be searched for calc resource file routines. # # Select CALCPATH= .;./cal;~/.cal;${CALC_SHAREDIR};${CUSTOMCALDIR} for DJGPP. # CALCPATH= .:./cal:~/.cal:${CALC_SHAREDIR}:${CUSTOMCALDIR} # If the $CALCRC environment variable is not defined, then the following -# path will be search for calc resource files. +# path will be searched for calc resource files. # # Select CALCRC= ${CALC_SHAREDIR}/startup;~/.calcrc;./.calcinit for DJGPP. # @@ -794,7 +794,7 @@ CALCRC= ${CALC_SHAREDIR}/startup:~/.calcrc:./.calcinit #CALCRC= ${CALC_SHAREDIR}/startup;~/.calcrc;./.calcinit # Determine of the GNU-readline facility will be used instead of the -# built-in calc binding method. +# builtin calc binding method. # # USE_READLINE= Do not use GNU-readline, use calc bindings # USE_READLINE= -DUSE_READLINE Use GNU-readline, do not use calc bindings @@ -808,7 +808,7 @@ CALCRC= ${CALC_SHAREDIR}/startup:~/.calcrc:./.calcinit # READLINE_INCLUDE Where the readline include files reside # (leave blank if they are /usr/include/readline) # -# NOTE: The GNU-readline code is not shipped with calc. You must have +# NOTE: The GNU-readline code is not shipped with calc. You must have # the appropriate headers and link libs installed on your system in # order to use it. # @@ -885,9 +885,9 @@ RANLIB=ranlib #RANLIB=: # Normally certain files depend on the Makefile. If the Makefile is -# changed, then certain steps should be redone. If MAKE_FILE is +# changed, then certain steps should be redone. If MAKE_FILE is # set to Makefile, then these files will depend on Makefile. If -# MAKE_FILE is empty, then they wont. +# MAKE_FILE is empty, then they won't. # # If in doubt, set MAKE_FILE to Makefile # @@ -948,9 +948,9 @@ CALC_ENV= CALCPATH=./cal LD_LIBRARY_PATH=. # # ${MKDIR} ${MKDIR_ARG} # -# to create directorties. Normall this amounts to usins mkdir -p dir ... -# Some older systems may not have mkdir -p. If you system does not -# make mkdir -p, then set MKDIR_ARG to empty. +# to create directories. Normally this amounts to using mkdir -p dir ... +# Some older systems may not have mkdir -p. If your system does not +# have mkdir -p, then set MKDIR_ARG to empty. # # MKDIR_ARG= -p # use mkdir -p when creating paths # MKDIR_ARG= # use if system does not understand mkdir -p @@ -958,8 +958,8 @@ CALC_ENV= CALCPATH=./cal LD_LIBRARY_PATH=. MKDIR_ARG= -p #MKDIR_ARG= -# Some out of date operating systems require / want an executable to -# end with a certain file extension. Some compile systems such as +# Some out of date operating systems require/want an executable to +# end with a certain file extension. Some compiler systems such as # windoz build calc as calc.exe. The EXT variable is used to denote # the extension required by such. Note that Cygwin requires EXT to be # the same as Linux/Un*x/GNU, even though it runs under windoz. @@ -974,7 +974,7 @@ EXT= # The default calc versions # -VERSION= 2.12.4.10 +VERSION= 2.12.4.11 VERS= 2.12.4 VER= 2.12 VE= 2 @@ -1025,11 +1025,11 @@ STRIP= strip # Extra compiling and linking flags # # EXTRA_CFLAGS are flags given to ${CC} when compiling C files -# EXTRA_LDFLAGS are flags given to ${CC} when linking progs +# EXTRA_LDFLAGS are flags given to ${CC} when linking programs # # Both CFLAGS and LDFLAGS are left blank in this Makefile by # default so that users may use them on the make command line -# to always the way that C is compiled and files are linked +# to always set the way that C is compiled and files are linked # respectively. For example: # # make all EXTRA_CFLAGS="-DMAGIC" EXTRA_LDFLAGS="-lmagic" @@ -1037,18 +1037,18 @@ STRIP= strip # NOTE: These should be left blank in this Makefile to make it # easier to add stuff on the command line. If you want to # to change the way calc is compiled by this Makefile, change -# the appropirate host target section below or a flag above. +# the appropriate host target section below or a flag above. # EXTRA_CFLAGS= EXTRA_LDFLAGS= -# COMMON_CFLAGS are the common ${CC} flags used for all progs, both -# intermediate and final calc and calc related progs +# COMMON_CFLAGS are the common ${CC} flags used for all programs, both +# intermediate and final calc and calc related programs # COMMON_CFLAGS= -DCALC_SRC ${ALLOW_CUSTOM} ${CCWARN} ${CCMISC} ${EXTRA_CFLAGS} -# COMMON_LDFLAGS are the common flags used for linking all progs, both -# intermediate and final calc and calc related progs +# COMMON_LDFLAGS are the common flags used for linking all programs, both +# intermediate and final calc and calc related programs # COMMON_LDFLAGS= ${EXTRA_LDFLAGS} @@ -1066,16 +1066,16 @@ COMMON_LDFLAGS= ${EXTRA_LDFLAGS} # BLD_TYPE= calc-static-only # # CC_SHARE are flags given to ${CC} to build .o files suitable for shared libs -# DEFAULT_LIB_INSTALL_PATH is where calc progs look for calc shared libs +# DEFAULT_LIB_INSTALL_PATH is where calc programs look for calc shared libs # LD_SHARE are common flags given to ${CC} to link with shared libraries -# LIBCALC_SHLIB are flags given to ${CC} to build libcalc shared lib +# 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 # # 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 -# LIBCALC_STATIC are flags given to ${CC} to build libcalc static lib +# LIBCALC_STATIC are flags given to ${CC} to build libcalc static libraries # LIBCUSTCALC_STATIC are flags given to ${CC} to build libcustcalc static lib # # NOTE: The above 4 values are unused if BLD_TYPE= calc-dynamic-only @@ -1088,7 +1088,7 @@ COMMON_LDFLAGS= ${EXTRA_LDFLAGS} # to abort on warnings, then leave CCWERR blank. # CCMISC are misc flags given to ${CC} # -# LCC how the C compiler is invoked on locally executed intermediate progs +# LCC is how the C compiler is invoked on locally executed intermediate programs # CC is how the C compiler is invoked (with an optional Purify) # # Specific target overrides or modifications to default values @@ -1128,10 +1128,10 @@ CC= ${PURIFY} ${LCC} ${CCWERR} # # The simple makefile forces the use of static ${CC} flags # -# ICFLAGS are given to ${CC} for intermediate progs used to help compile calc -# CFLAGS are given to ${CC} for calc progs other than intermediate progs -# ILDFLAGS for ${CC} in linking intermediate progs used to help compile calc -# LDFLAGS for ${CC} in linking calc progs other than intermediate progs +# ICFLAGS are given to ${CC} for intermediate programs used to help compile calc +# CFLAGS are given to ${CC} for calc programs other than intermediate programs +# ILDFLAGS for ${CC} in linking intermediate programs used to help compile calc +# LDFLAGS for ${CC} in linking calc programs other than intermediate programs # ICFLAGS= ${COMMON_CFLAGS} ${CC_STATIC} CFLAGS= ${ICFLAGS} ${CCOPT} @@ -1354,7 +1354,7 @@ CUSTOM_PASSDOWN= \ VERSION=${VERSION} \ target=${target} -# The compelte list of Makefile vars passed down to help/Makefile. +# The complete list of Makefile vars passed down to help/Makefile. # HELP_PASSDOWN= \ AR=${AR} \ @@ -1391,7 +1391,7 @@ HELP_PASSDOWN= \ TOUCH=${TOUCH} \ TRUE=${TRUE} -# The compelte list of Makefile vars passed down to cal/Makefile. +# The complete list of Makefile vars passed down to cal/Makefile. # CAL_PASSDOWN= \ AR=${AR} \ @@ -1419,7 +1419,7 @@ CAL_PASSDOWN= \ TOUCH=${TOUCH} \ TRUE=${TRUE} -# The compelte list of Makefile vars passed down to cscript/Makefile. +# The complete list of Makefile vars passed down to cscript/Makefile. # CSCRIPT_PASSDOWN= \ AR=${AR} \ @@ -1468,7 +1468,7 @@ DISTLIST= ${C_SRC} ${H_SRC} ${MAKE_FILE} BUGS CHANGES LIBRARY README \ README.WINDOWS calc.man HOWTO.INSTALL ${UTIL_MISC_SRC} ${LICENSE} \ sample.README calc.spec.in rpm.mk -# These files are used to make (but not built) a calc .a link library +# These files are used to make (but not build) a calc .a link library # CALCLIBLIST= ${LIBSRC} ${UTIL_C_SRC} ${LIB_H_SRC} ${MAKE_FILE} \ ${UTIL_MISC_SRC} BUGS CHANGES LIBRARY @@ -1481,18 +1481,18 @@ OBJS= ${LIBOBJS} ${CALCOBJS} ${UTIL_OBJS} ${SAMPLE_OBJ} # CALC_STATIC_LIBS= libcalc.a libcustcalc.a -# Libaraies created and used to build calc +# Libraries created and used to build calc # CALC_DYNAMIC_LIBS= libcalc${LIB_EXT_VERSION} libcustcalc${LIB_EXT_VERSION} -# Symlinks of dymanic shared libraries +# Symlinks of dynamic shared libraries # SYM_DYNAMIC_LIBS= libcalc${LIB_EXT_VER} libcalc${LIB_EXT_VE} libcalc${LIB_EXT} \ libcalc${LIB_EXT_VERS} libcustcalc${LIB_EXT_VERSION} \ libcustcalc${LIB_EXT_VERS} libcustcalc${LIB_EXT_VER} \ libcustcalc${LIB_EXT_VE} libcustcalc${LIB_EXT} -# list of sample programs to that need to be built to satisfy sample rule +# list of sample programs that need to be built to satisfy sample rule # # NOTE: The ${SAMPLE_TARGETS} and ${SAMPLE_STATIC_TARGETS} are built but # not installed at this time. @@ -1503,7 +1503,7 @@ SYM_DYNAMIC_LIBS= libcalc${LIB_EXT_VER} libcalc${LIB_EXT_VE} libcalc${LIB_EXT} \ SAMPLE_TARGETS= sample_rand${EXT} sample_many${EXT} SAMPLE_STATIC_TARGETS= sample_rand-static${EXT} sample_many-static${EXT} -# list of cscript programs to that need to be built to satisfy cscript/.all +# list of cscript programs that need to be built to satisfy cscript/.all # # NOTE: This list MUST be coordinated with the ${CSCRIPT_TARGETS} variable # in the cscript/Makefile @@ -1558,7 +1558,7 @@ calc-dynamic-only: ${DYNAMIC_FIRST_TARGETS} ${EARLY_TARGETS} \ echo " ${MAKE} -f ${MAKE_FILE} clobber" 1>&2; \ echo " ${MAKE} -f ${MAKE_FILE} $$r BLD_TYPE=$$r" 1>&2; \ echo "" 1>&2; \ - echo "NOTE: It is a very good idea to c first clobber any" 1>&2; \ + echo "NOTE: It is a very good idea to first clobber any" 1>&2; \ echo " previously built .o, libs and executables" 1>&2; \ echo " before switching to $$r!" 1>&2; \ echo "" 1>&2; \ @@ -1574,7 +1574,7 @@ calc-dynamic-only: ${DYNAMIC_FIRST_TARGETS} ${EARLY_TARGETS} \ echo " ${MAKE} -f ${MAKE_FILE} clobber" 1>&2; \ echo " ${MAKE} -f ${MAKE_FILE} $$r BLD_TYPE=$$r" 1>&2; \ echo "" 1>&2; \ - echo "to clean out any previously build static files." 1>&2; \ + echo "to clean out any previously built static files." 1>&2; \ echo "" 1>&2; \ echo "=== aborting make ===" 1>&2; \ exit 2; \ @@ -1604,7 +1604,7 @@ calc-static-only: ${STATIC_FIRST_TARGETS} ${EARLY_TARGETS} \ echo " ${MAKE} -f ${MAKE_FILE} clobber" 1>&2; \ echo " ${MAKE} -f ${MAKE_FILE} $$r BLD_TYPE=$$r" 1>&2; \ echo "" 1>&2; \ - echo "NOTE: It is a very good idea to c first clobber any" 1>&2; \ + echo "NOTE: It is a very good idea to first clobber any" 1>&2; \ echo " previously built .o, libs and executables" 1>&2; \ echo " before switching to $$r!" 1>&2; \ echo "" 1>&2; \ @@ -1620,7 +1620,7 @@ calc-static-only: ${STATIC_FIRST_TARGETS} ${EARLY_TARGETS} \ echo " ${MAKE} -f ${MAKE_FILE} clobber" 1>&2; \ echo " ${MAKE} -f ${MAKE_FILE} $$r BLD_TYPE=$$r" 1>&2; \ echo "" 1>&2; \ - echo "to clean out any previously build dynamic files." 1>&2; \ + echo "to clean out any previously built dynamic files." 1>&2; \ echo "" 1>&2; \ echo "=== aborting make ===" 1>&2; \ exit 4; \ @@ -1716,8 +1716,8 @@ seed.o: seed.c no_implicit.arg ${MAKE_FILE} ### # # The next set of rules cause the .h files BUILD_H_SRC files to be built -# according tot he system and the Makefile variables above. The hsrc rule -# is a convenient rule to invoke to built all of the BUILD_H_SRC. +# according to the system and the Makefile variables above. The hsrc rule +# is a convenient rule to invoke to build all of the BUILD_H_SRC. # # We add in the BUILD_C_SRC files because they are similar to the # BUILD_H_SRC files in terms of the build process. @@ -3161,7 +3161,7 @@ libcustcalc${LIB_EXT}: libcustcalc${LIB_EXT_VERSION} ### # -# building calc-static and static lib*.a libraires +# building calc-static and static lib*.a libraries # ### @@ -3194,10 +3194,10 @@ sample_many-static${EXT}: sample_many.o ${CALC_STATIC_LIBS} ${MAKE_FILE} ### # -# Home grown make dependency rules. Your system make not support +# Homegrown make dependency rules. Your system may not support # or have the needed tools. You can ignore this section. # -# We will form a skelaton tree of *.c files containing only #include "foo.h" +# We will form a skeleton tree of *.c files containing only #include "foo.h" # lines and .h files containing the same lines surrounded by multiple include # prevention lines. This allows us to build a static depend list that will # satisfy all possible cpp symbol definition combinations. @@ -3307,21 +3307,21 @@ h_list: # 1 level version string. # # version: -# This rule simply echos the value found in this makefile. +# This rule simply echoes the value found in this makefile. # This rule produces the full version string. Note that the # full version could be 4 or 3 levels long depending on the # minor patch number. # # vers: -# This rule simply echos the value found in this makefile. +# This rule simply echoes the value found in this makefile. # This rule produces only a 3 level version string. # # ver: -# This rule simply echos the value found in this makefile. +# This rule simply echoes the value found in this makefile. # This rule produces only a 2 level version string. # # ve: -# This rule simply echos the value found in this makefile. +# This rule simply echoes the value found in this makefile. # This rule produces only a 1 level version string. # ### @@ -3413,7 +3413,7 @@ calcliblistfmt: # # Doing a 'make chk' will cause only the context around interesting # (and error) messages to be printed. Unlike 'make check', this -# rule does not cause things to be built. I.e., the all rule is +# rule does not cause things to be built. i.e., the all rule is # not invoked. # ### @@ -3609,34 +3609,38 @@ env: mkdebug: env version.c @echo '=-=-=-=-= ${MAKE_FILE} start of $@ rule =-=-=-=-=' - @echo '=-=-=-=-= Determining the source version =-=-=-=-=' + @echo '=-=-=-= Determining the source version =-=-=-=' @${MAKE} -f Makefile Q= V=@ ver_calc${EXT} -@./ver_calc${EXT} - @echo '=-=-=-=-= Invoking ${MAKE} -f Makefile Q= V=@ all =-=-=-=-=' + @echo '=-=-=-= Invoking ${MAKE} -f Makefile Q= V=@ all =-=-=-=' @${MAKE} -f Makefile Q= V=@ all - @echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' - @echo '=-=-=-=-= Determining the binary version =-=-=-=-=' + @echo '=-=-=-= Back to the main Makefile for $@ rule =-=-=-=' + @echo '=-=-=-= Determining the binary version =-=-=-=' -@./calc${EXT} -e -q -v - @echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' + @echo '=-=-=-= Back to the main Makefile for $@ rule =-=-=-=' @echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-=' debug: env @echo '=-=-=-=-= ${MAKE_FILE} start of $@ rule =-=-=-=-=' - @echo '=-=-=-=-= Invoking ${MAKE} -f Makefile Q= V=@ clobber =-=-=-=-=' + @echo '=-=-=-= Invoking ${MAKE} -f Makefile Q= V=@ clobber =-=-=-=' @${MAKE} -f Makefile Q= V=@ clobber - @echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' - @echo '=-=-=-=-= Determining the source version =-=-=-=-=' + @echo '=-=-=-= Back to the main Makefile for $@ rule =-=-=-=' + @echo '=-=-=-= Invoking ${MAKE} -f Makefile Q= V=@ all =-=-=-=' + @echo '=-=-= this may take a bit of time =-=-=' + @${MAKE} -f Makefile Q= V=@ all + @echo '=-=-=-= Back to the main Makefile for $@ rule =-=-=-=' + @echo '=-=-=-= Determining the source version =-=-=-=' @${MAKE} -f Makefile Q= V=@ ver_calc${EXT} -@./ver_calc${EXT} - @echo '=-=-=-=-= Invoking ${MAKE} -f Makefile Q= V=@ all =-=-=-=-=' - @${MAKE} -f Makefile Q= V=@ all - @echo '=-=-=-=-= Determining the binary version =-=-=-=-=' - -@./calc${EXT} -e -q -v - @echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' - @echo '=-=-=-=-= Invoking ${MAKE} -f Makefile Q= V=@ chk =-=-=-=-=' - @echo '=-=-=-=-= this may take a while =-=-=-=-=' - @${MAKE} -f Makefile Q= V=@ chk - @echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' + @echo '=-=-=-= Back to the main Makefile for $@ rule =-=-=-=' + @echo -n '=-=-=-= Print #defile values if custom functions ' + @echo 'are allowed =-=-=-=' + -@./calc${EXT} -e -q -C 'print custom("sysinfo", 2);' + @echo '=-=-=-= Back to the main Makefile for $@ rule =-=-=-=' + @echo '=-=-=-= Invoking ${MAKE} -f Makefile Q= V=@ check =-=-=-=' + @echo '=-=-= this may take a while =-=-=' + @${MAKE} -f Makefile Q= V=@ check + @echo '=-=-=-= Back to the main Makefile for $@ rule =-=-=-=' @echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-=' ### @@ -3747,7 +3751,7 @@ inst_files: ${MAKE_FILE} help/Makefile cal/Makefile custom/Makefile \ ${Q} LANG=C ${SORT} -u inst_files -o inst_files ${V} echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-=' -# The olduninstall rule will remove calc files from the older, histroic +# The olduninstall rule will remove calc files from the older, historic # locations under the /usr/local directory. If you are using the # new default values for ${BINDIR}, ${CALC_SHAREDIR}, ${INCDIR} and ${LIBDIR} # then you can use this rule to clean out the older calc stuff under @@ -3861,7 +3865,7 @@ clobber: custom/Makefile clean # install everything # -# NOTE: Keep the uninstall rule in reverse order to the install rule +# NOTE: Keep the uninstall rule in the reverse order of the install rule # install: custom/Makefile ${LIB_H_SRC} ${BUILD_H_SRC} calc.1 all ${V} echo '=-=-=-=-= ${MAKE_FILE} start of $@ rule =-=-=-=-=' @@ -4156,7 +4160,7 @@ install: custom/Makefile ${LIB_H_SRC} ${BUILD_H_SRC} calc.1 all # Try to remove everything that was installed # -# NOTE: Keep the uninstall rule in reverse order to the install rule +# NOTE: Keep the uninstall rule in the reverse order of the install rule # uninstall: custom/Makefile ${V} echo '=-=-=-=-= ${MAKE_FILE} start of $@ rule =-=-=-=-=' @@ -4360,7 +4364,7 @@ strip: done ${V} echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-=' -# calc-symlink - setup symlinks from stardard locations into the ${T} tree +# calc-symlink - setup symlinks from standard locations into the ${T} tree # calc-symlink: ${Q}if [ -z "${T}" ]; then \ diff --git a/cal/README b/cal/README index 7ecda39..1760a37 100644 --- a/cal/README +++ b/cal/README @@ -537,6 +537,20 @@ hms.cal Calculate in hours, minutes, and seconds. See also dmscal. +infinities.cal + + isinfinite(x) + iscinf(x) + ispinf(x) + isninf(x) + cinf() + ninf() + pinf() + + The symbolic handling of infinities. Needed for intnum.cal but might be + usefull elsewhere, too. + + intfile.cal file2be(filename) @@ -564,6 +578,127 @@ intfile.cal of the integer become the last octets of the file. +intnum.cal + + quadtsdeletenodes() + quadtscomputenodes(order, expo, eps) + quadtscore(a, b, n) + quadts(a, b, points) + quadglcomputenodes(N) + quadgldeletenodes() + quadglcore(a, b, n) + quadgl(a, b, points) + quad(a, b, points = -1, method = "tanhsinh") + makerange(start, end, steps) + makecircle(radius, center, points) + makeellipse(angle, a, b, center, points) + makepoints() + + This file offers some methods for numerical integration. Implemented are + the Gauss-Legendre and the tanh-sinh quadrature. + + All functions are usefull to some extend but the main function for + quadrature is quad(), which is not much more than an abstraction layer. + + The main workers are quadgl() for Gauss-legendre and quadts() for the + tanh-sinh quadrature. The limits of the integral can be anything in the + complex plane and the extended real line. The latter means that infinite + limits are supported by way of the smbolic infinities implemented in the + file infinities.cal (automatically linked in by intnum.cal). + + Integration in parts and contour is supported by the "points" argument + which takes either a number or a list. the functions starting with "make" + allow for a less error prone use. + + The function to evaluate must have the name "f". + + Examples (shamelessly stolen from mpmath): + + ; define f(x){return sin(x);} + f(x) defined + ; quadts(0,pi()) - 2 + 0.00000000000000000000 + ; quadgl(0,pi()) - 2 + 0.00000000000000000000 + + Sometimes rounding errors accumulate, it might be a good idea to crank up + the working precision a notch or two. + + ; define f(x){ return exp(-x^2);} + f(x) redefined + ; quadts(0,pinf()) - pi() + 0.00000000000000000000 + ; quadgl(0,pinf()) - pi() + 0.00000000000000000001 + + ; define f(x){ return exp(-x^2);} + f(x) redefined + ; quadgl(ninf(),pinf()) - sqrt(pi()) + 0.00000000000000000000 + ; quadts(ninf(),pinf()) - sqrt(pi()) + -0.00000000000000000000 + + Using the "points" parameter is a bit tricky + + ; define f(x){ return 1/x; } + f(x) redefined + ; quadts(1,1,mat[3]={1i,-1,-1i}) - 2i*pi() + 0.00000000000000000001i + ; quadgl(1,1,mat[3]={1i,-1,-1i}) - 2i*pi() + 0.00000000000000000001i + + The make* functions make it a bit simpler + + ; quadts(1,1,makepoints(1i,-1,-1i)) - 2i*pi() + 0.00000000000000000001i + ; quadgl(1,1,makepoints(1i,-1,-1i)) - 2i*pi() + 0.00000000000000000001i + + ; define f(x){ return abs(sin(x));} + f(x) redefined + ; quadts(0,2*pi(),makepoints(pi())) - 4 + 0.00000000000000000000 + ; quadgl(0,2*pi(),makepoints(pi())) - 4 + 0.00000000000000000000 + + The quad*core functions do not offer anything fancy but the third parameter + controls the so called "order" which is just the number of nodes computed. + This can be quite usefull in some circumstances. + + ; quadgldeletenodes() + ; define f(x){ return exp(x);} + f(x) redefined + ; s=usertime();quadglcore(-3,3)- (exp(3)-exp(-3));e=usertime();e-s + 0.00000000000000000001 + 2.632164 + ; s=usertime();quadglcore(-3,3)- (exp(3)-exp(-3));e=usertime();e-s + 0.00000000000000000001 + 0.016001 + ; quadgldeletenodes() + ; s=usertime();quadglcore(-3,3,14)- (exp(3)-exp(-3));e=usertime();e-s + -0.00000000000000000000 + 0.024001 + ; s=usertime();quadglcore(-3,3,14)- (exp(3)-exp(-3));e=usertime();e-s + -0.00000000000000000000 + 0 + + It is not much but can sum up. The tanh-sinh algorithm is not optimizable + as much as the Gauss-Legendre algorithm but is per se much faster. + + ; s=usertime();quadtscore(-3,3)- (exp(3)-exp(-3));e=usertime();e-s + -0.00000000000000000001 + 0.128008 + ; s=usertime();quadtscore(-3,3)- (exp(3)-exp(-3));e=usertime();e-s + -0.00000000000000000001 + 0.036002 + ; s=usertime();quadtscore(-3,3,49)- (exp(3)-exp(-3));e=usertime();e-s + -0.00000000000000000000 + 0.036002 + ; s=usertime();quadtscore(-3,3,49)- (exp(3)-exp(-3));e=usertime();e-s + -0.00000000000000000000 + 0.01200 + + lambertw.cal lambertw(z,branch) @@ -988,6 +1123,15 @@ set8700.line The set8700.cal file (and dotest.cal) should be read first. +smallfactors.cal + + smallfactors(x0) + printsmallfactors(flist) + + Lists the prime factors of numbers smaller than 2^32. Try for example: + printsmallfactors(smallfactors(10!)). + + solve.cal solve(low, high, epsilon) @@ -1236,6 +1380,29 @@ statistics.cal Calculates a bunch of (hopefully) aptly named statistical functions. +strings.cal + + toupper(s) + tolower(s) + strcasecmp(s1,s2) + strncasecmp(s1,s2,length) + isascii(c) + isalnum(c) + isalpha(c) + iscntrl(c) + isdigit(c) + isgraph(c) + islower(c) + isprint(c) + ispunct(c) + isspace(c) + isupper(c) + isblank(c) + isxdigit(c) + + Implements most of the functions of libc's ctype.h and strings.h. + + sumsq.cal ss(p) @@ -1625,9 +1792,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.5 $ -## @(#) $Id: README,v 30.5 2013/08/11 03:26:46 chongo Exp $ -## @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/README,v $ +## @(#) $Revision: 30.6 $ +## @(#) $Id: README,v 30.6 2013/08/18 20:01:53 chongo Exp $ +## @(#) $Source: /usr/local/src/bin/calc/cal/RCS/README,v $ ## ## Under source code control: 1990/02/15 01:50:32 ## File existed as early as: before 1990 diff --git a/cal/bernpoly.cal b/cal/bernpoly.cal index d462c86..c8598b7 100644 --- a/cal/bernpoly.cal +++ b/cal/bernpoly.cal @@ -1,13 +1,13 @@ /* - * bernpoly- Bernoully polynomials B_n(z) for arbitrary n,z.. + * bernpoly - Bernoully polynomials B_n(z) for arbitrary n,z.. * * Copyright (C) 2013 Christoph Zurnieden * - * bernpoly is open software; you can redistribute it and/or modify it under + * 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. * - * bernpoly is distributed in the hope that it will be useful, but WITHOUT + * 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. @@ -17,8 +17,8 @@ * 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.3 $ - * @(#) $Id: bernpoly.cal,v 30.3 2013/08/11 08:41:38 chongo Exp $ + * @(#) $Revision: 30.4 $ + * @(#) $Id: bernpoly.cal,v 30.4 2013/08/18 20:01:53 chongo Exp $ * @(#) $Source: /usr/local/src/bin/calc/cal/RCS/bernpoly.cal,v $ * * Under source code control: 2013/08/11 01:31:28 diff --git a/cal/brentsolve.cal b/cal/brentsolve.cal index a50d700..8d7674a 100644 --- a/cal/brentsolve.cal +++ b/cal/brentsolve.cal @@ -1,13 +1,13 @@ /* - * brentsolve- Root finding with the Brent-Dekker trick. + * brentsolve - Root finding with the Brent-Dekker trick * * Copyright (C) 2013 Christoph Zurnieden * - * brentsolve is open software; you can redistribute it and/or modify it under + * 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. * - * brentsolve is distributed in the hope that it will be useful, but WITHOUT + * 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. @@ -17,14 +17,15 @@ * 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.3 $ - * @(#) $Id: brentsolve.cal,v 30.3 2013/08/11 08:41:38 chongo Exp $ + * @(#) $Revision: 30.4 $ + * @(#) $Id: brentsolve.cal,v 30.4 2013/08/18 20:01:53 chongo Exp $ * @(#) $Source: /usr/local/src/bin/calc/cal/RCS/brentsolve.cal,v $ * * Under source code control: 2013/08/11 01:31:28 * File existed as early as: 2013 */ + static resource_debug_level; resource_debug_level = config("resource_debug", 0); diff --git a/cal/constants.cal b/cal/constants.cal index 7dba7ff..30866e2 100644 --- a/cal/constants.cal +++ b/cal/constants.cal @@ -3,11 +3,11 @@ * * Copyright (C) 2013 Christoph Zurnieden * - * constants is open software; you can redistribute it and/or modify it under + * 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. * - * constants is distributed in the hope that it will be useful, but WITHOUT + * 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. @@ -17,8 +17,8 @@ * 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.3 $ - * @(#) $Id: constants.cal,v 30.3 2013/08/11 08:41:38 chongo Exp $ + * @(#) $Revision: 30.4 $ + * @(#) $Id: constants.cal,v 30.4 2013/08/18 20:01:53 chongo Exp $ * @(#) $Source: /usr/local/src/bin/calc/cal/RCS/constants.cal,v $ * * Under source code control: 2013/08/11 01:31:28 diff --git a/cal/factorial.cal b/cal/factorial.cal index 93e67aa..8906f6a 100644 --- a/cal/factorial.cal +++ b/cal/factorial.cal @@ -3,11 +3,11 @@ * * Copyright (C) 2013 Christoph Zurnieden * - * factorial is open software; you can redistribute it and/or modify it under + * 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. * - * factorial is distributed in the hope that it will be useful, but WITHOUT + * 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. @@ -17,8 +17,8 @@ * 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.3 $ - * @(#) $Id: factorial.cal,v 30.3 2013/08/11 08:41:38 chongo Exp $ + * @(#) $Revision: 30.4 $ + * @(#) $Id: factorial.cal,v 30.4 2013/08/18 20:01:53 chongo Exp $ * @(#) $Source: /usr/local/src/bin/calc/cal/RCS/factorial.cal,v $ * * Under source code control: 2013/08/11 01:31:28 diff --git a/cal/factorial2.cal b/cal/factorial2.cal index c1e5a05..13a8de0 100644 --- a/cal/factorial2.cal +++ b/cal/factorial2.cal @@ -3,22 +3,22 @@ * * Copyright (C) 2013 Christoph Zurnieden * - * factorial2 is open software; you can redistribute it and/or modify it under + * 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. * - * factorial2 is distributed in the hope that it will be useful, but WITHOUT + * 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 factorial2 under the filename COPYING-LGPL. You should have + * 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.3 $ - * @(#) $Id: factorial2.cal,v 30.3 2013/08/11 08:41:38 chongo Exp $ + * @(#) $Revision: 30.4 $ + * @(#) $Id: factorial2.cal,v 30.4 2013/08/18 20:01:53 chongo Exp $ * @(#) $Source: /usr/local/src/bin/calc/cal/RCS/factorial2.cal,v $ * * Under source code control: 2013/08/11 01:31:28 diff --git a/cal/lambertw.cal b/cal/lambertw.cal index 7f782f1..cc7b61d 100644 --- a/cal/lambertw.cal +++ b/cal/lambertw.cal @@ -1,13 +1,13 @@ /* - * lambertw- Lambert's W-function + * lambertw - Lambert's W-function * * Copyright (C) 2013 Christoph Zurnieden * - * lambertw is open software; you can redistribute it and/or modify it under + * 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. * - * lambertw is distributed in the hope that it will be useful, but WITHOUT + * 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. @@ -17,8 +17,8 @@ * 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.3 $ - * @(#) $Id: lambertw.cal,v 30.3 2013/08/11 08:41:38 chongo Exp $ + * @(#) $Revision: 30.4 $ + * @(#) $Id: lambertw.cal,v 30.4 2013/08/18 20:01:53 chongo Exp $ * @(#) $Source: /usr/local/src/bin/calc/cal/RCS/lambertw.cal,v $ * * Under source code control: 2013/08/11 01:31:28 diff --git a/cal/lnseries.cal b/cal/lnseries.cal index ded4702..db14ed8 100644 --- a/cal/lnseries.cal +++ b/cal/lnseries.cal @@ -1,13 +1,13 @@ /* - * special_functions - special functions (e.g.: gamma, zeta, psi) + * lnseries - special functions (e.g.: gamma, zeta, psi) * * Copyright (C) 2013 Christoph Zurnieden * - * lnseries.cal is open software; you can redistribute it and/or modify it under + * 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. * - * lnseries.cal is distributed in the hope that it will be useful, but WITHOUT + * 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. @@ -17,8 +17,8 @@ * 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.3 $ - * @(#) $Id: lnseries.cal,v 30.3 2013/08/11 08:41:38 chongo Exp $ + * @(#) $Revision: 30.4 $ + * @(#) $Id: lnseries.cal,v 30.4 2013/08/18 20:01:53 chongo Exp $ * @(#) $Source: /usr/local/src/bin/calc/cal/RCS/lnseries.cal,v $ * * Under source code control: 2013/08/11 01:31:28 diff --git a/cal/regress.cal b/cal/regress.cal index b765a8a..e74c81a 100644 --- a/cal/regress.cal +++ b/cal/regress.cal @@ -17,8 +17,8 @@ * 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: regress.cal,v 30.8 2013/08/11 08:41:38 chongo Exp $ + * @(#) $Revision: 30.10 $ + * @(#) $Id: regress.cal,v 30.10 2013/09/01 22:08:44 chongo Exp $ * @(#) $Source: /usr/local/src/bin/calc/cal/RCS/regress.cal,v $ * * Under source code control: 1990/02/15 01:50:36 @@ -1445,7 +1445,93 @@ define test_functions() vrfy(jacobi(-1,-1) == 0, '1236: jacobi(-1,-1) == 0'); vrfy(jacobi(0,-1) == 0, '1237: jacobi(0,-1) == 0'); - print '1238: Ending test_functions'; + /* ctype function tests */ + vrfy(isalnum("A") == 1, '1238: isalnum("A") == 1'); + vrfy(isalnum("a") == 1, '1239: isalnum("a") == 1'); + vrfy(isalnum("2") == 1, '1239: isalnum("2") == 1'); + vrfy(isalnum("\t") == 0, '1240: isalnum("\t") == 0'); + + vrfy(isalpha("A") == 1, '1241: isalpha("A") == 1'); + vrfy(isalpha("a") == 1, '1242: isalpha("a") == 1'); + vrfy(isalpha("2") == 0, '1243: isalpha("2") == 0'); + vrfy(isalpha("\t") == 0, '1244: isalpha("\t") == 0'); + + vrfy(iscntrl("A") == 0, '1245: iscntrl("A") == 0'); + vrfy(iscntrl("a") == 0, '1246: iscntrl("a") == 0'); + vrfy(iscntrl("2") == 0, '1247: iscntrl("2") == 0'); + vrfy(iscntrl("\t") == 1, '1248: iscntrl("\t") == 1'); + + vrfy(isdigit("A") == 0, '1249: isdigit("A") == 0'); + vrfy(isdigit("a") == 0, '1250: isdigit("a") == 0'); + vrfy(isdigit("2") == 1, '1251: isdigit("2") == 1'); + vrfy(isdigit("\t") == 0, '1252: isdigit("\t") == 0'); + + vrfy(isgraph("A") == 1, '1253: isgraph("A") == 1'); + vrfy(isgraph("a") == 1, '1254: isgraph("a") == 1'); + vrfy(isgraph("2") == 1, '1255: isgraph("2") == 1'); + vrfy(isgraph("\t") == 0, '1255: isgraph("\t") == 0'); + + vrfy(islower("A") == 0, '1256: islower("A") == 0'); + vrfy(islower("a") == 1, '1257: islower("a") == 1'); + vrfy(islower("1") == 0, '1258: islower("1") == 0'); + + vrfy(isprint("A") == 1, '1259: isprint("A") == 1'); + vrfy(isprint("a") == 1, '1260: isprint("a") == 1'); + vrfy(isprint(" ") == 1, '1261: isprint(" ") == 1'); + vrfy(isprint("\t") == 0, '1262: isprint("\t") == 0'); + + vrfy(ispunct("A") == 0, '1263: ispunct("A") == 0'); + vrfy(ispunct("a") == 0, '1264: ispunct("a") == 0'); + vrfy(ispunct(" ") == 0, '1265: ispunct(" ") == 0'); + vrfy(ispunct("?") == 1, '1266: ispunct("?") == 1'); + + vrfy(isspace("A") == 0, '1267: isspace("A") == 0'); + vrfy(isspace("Krik") == 0, '1268: isspace("Krik") == 0'); + vrfy(isspace(" ") == 1, '1269: isspace(" ") == 1'); + vrfy(isspace("?") == 0, '1270: isspace("?") == 0'); + + vrfy(isupper("A") == 1, '1271: isupper("A") == 1'); + vrfy(isupper("a") == 0, '1272: isupper("a") == 0'); + vrfy(isupper("1") == 0, '1273: isupper("1") == 0'); + + vrfy(isxdigit("A") == 1, '1274: isxdigit("A") == 1'); + vrfy(isxdigit("f") == 1, '1275: isxdigit("f") == 1'); + vrfy(isxdigit("2") == 1, '1276: isxdigit("2") == 1'); + vrfy(isxdigit("x") == 0, '1277: isxdigit("x") == 0'); + + vrfy(strcasecmp("ab", "aBc") == -1, + '1278: strcasecmp("ab", "aBc") == -1'); + vrfy(strcasecmp("abc", "aBb") == 1, + '1279: strcasecmp("abc", "aBb") == 1'); + vrfy(strcasecmp("abc", "abc") == 0, + '1280: strcasecmp("abc", "abc") == 0'); + vrfy(strcasecmp("abc", "aBc") == 0, + '1281: strcasecmp("abc", "aBc") == 0'); + vrfy(strcasecmp("abc", "aBd") == -1, + '1282: strcasecmp("abc", "aBd") == -1'); + vrfy(strcasecmp("abc\0", "aBc") == 1, + '1283: strcasecmp("abc\0", "aBc") == 1'); + vrfy(strcasecmp("a\0b", "A\0c") == -1, + '1284: strcasecmp("a\0b", "A\0c") == -1'); + + vrfy(strncasecmp("abc", "xyz", 0) == 0, + '1285: strncasecmp("abc", "xyz", 0) == 0'); + vrfy(strncasecmp("abc", "xyz", 1) == -1, + '1286: strncasecmp("abc", "xyz", 1) == -1'); + vrfy(strncasecmp("abc", "", 1) == 1, + '1287: strncasecmp("abc", "", 1) == 1'); + vrfy(strncasecmp("a", "b", 2) == -1, + '1288: strncasecmp("a", "b", 2) == -1'); + vrfy(strncasecmp("ab", "Ac", 2) == -1, + '1289: strncasecmp("ab", "Ac", 2) == -1'); + vrfy(strncasecmp("\0ac", "\0b", 2) == -1, + '1290: strncasecmp("\0ac", "\0b", 2) == -1'); + vrfy(strncasecmp("ab", "aBc", 2) == 0, + '1291: strncasecmp("ab", "aBc", 2) == 0'); + vrfy(strncasecmp("abc", "abd", 2) == 0, + '1292: strncasecmp("abc", "abd", 2) == 0'); + + print '1293: Ending test_functions'; } print '017: parsed test_functions()'; @@ -1462,14 +1548,14 @@ define _test_underscore() local _a = 27; local __a = 23209; - print "1290: Beginning _test_underscore"; + print "1294: Beginning _test_underscore"; - vrfy(_a == 27, '1291: _a == 27'); - vrfy(_ == 49, '1292: _ == 49'); - vrfy(__ == 63, '1293: __ == 63'); - vrfy(__a == 23209, '1294: __a == 23209'); + vrfy(_a == 27, '1295: _a == 27'); + vrfy(_ == 49, '1296: _ == 49'); + vrfy(__ == 63, '1297: __ == 63'); + vrfy(__a == 23209, '1298: __a == 23209'); - print "1295: Ending _test_underscore"; + print "1299: Ending _test_underscore"; } print '020: parsed _test_underscore'; @@ -5031,7 +5117,7 @@ vrfy(i == 9, '151: i == 9'); /* - * test_commaeq - test changes to , and = + * test_commaeq - test changes to = and , */ obj xx5600 {} xx5600; print '152: obj xx5600 {} xx5600'; diff --git a/cal/specialfunctions.cal b/cal/specialfunctions.cal index 448f4d1..0db45ef 100644 --- a/cal/specialfunctions.cal +++ b/cal/specialfunctions.cal @@ -1,13 +1,13 @@ /* - * special_functions - special functions (e.g.: gamma, zeta, psi) + * specialfunctions - special functions (e.g.: gamma, zeta, psi) * * Copyright (C) 2013 Christoph Zurnieden * - * special_functions is open software; you can redistribute it and/or modify + * 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. * - * special_functions is distributed in the hope that it will be useful, + * 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. @@ -17,8 +17,8 @@ * 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: specialfunctions.cal,v 30.4 2013/08/11 08:41:38 chongo Exp $ + * @(#) $Revision: 30.6 $ + * @(#) $Id: specialfunctions.cal,v 30.6 2013/09/01 17:48:27 chongo Exp $ * @(#) $Source: /usr/local/src/bin/calc/cal/RCS/specialfunctions.cal,v $ * * Under source code control: 2013/08/11 01:31:28 @@ -45,85 +45,92 @@ read -once zeta2; */ define zeta(s) { - /* Not the best way, I'm afraid, but a way. */ - return hurwitzzeta(s,1); + /* Not the best way, I'm afraid, but a way. */ + return hurwitzzeta(s, 1); } -define psi0(z){ - local i k m x y eps_digits eps ret; +define psi0(z) +{ + local i k m x y eps_digits eps ret; - /* - One can use the Stirling series, too, which might be faster for some - values. The series used here converges very fast but needs a lot of - bernoulli numbers which are quite expensive to compute. - */ + /* + * One can use the Stirling series, too, which might be faster for some + * values. The series used here converges very fast but needs a lot of + * bernoulli numbers which are quite expensive to compute. + */ - eps = epsilon(); - epsilon(eps*1e-3); - if(isint(z) && z<=0)return newerror("psi(z); z is a negative integer or 0"); - if(re(z) < 0){ - return ( pi() * cot(pi() * (0-z) ) ) + psi0(1-z); - } - eps_digits = digits(1/epsilon()); - /* - R.W. Gosper has r = .41 as the relation, empirical tests showed that - for d<100 r = .375 is sufficient and r = .396 for d<200. - It does not save much time but for a long series even a little - can grow large. - */ - if(eps_digits < 100) - k = 2 * ceil(.375 * eps_digits); - else if(eps_digits < 200) - k = 2 * ceil(.395 * eps_digits); - else - k = 2 * ceil(11/27 * eps_digits); - m = 0; - y = (z+k)^2; - x = 0.0; - /* - There is a chance to speed up the first partial sum with binary splitting. - The second partial sum is dominated by the calculation of the Bernoulli - numbers but can profit from binary splitting when the Bernoulli numbers are - already cached. - */ - for(i = 1; i <= (k/2); i++){ - m = 1 / ( z + 2*i - 1) + 1 / ( z + 2*i -2 ) + m; - x = ( x + bernoulli(k-2*i+2) / (k-2*i+2) ) / y ; - } - ret = ln(z+k) - 1 / ( 2 * (z+k) ) - x - m ; - epsilon(eps); - return ret; + eps = epsilon(); + epsilon(eps * 1e-3); + if (isint(z) && z <= 0) { + return newerror("psi(z); z is a negative integer or 0"); + } + if (re(z) < 0) { + return (pi() * cot(pi() * (0 - z))) + psi0(1 - z); + } + eps_digits = digits(1 / epsilon()); + /* + * R.W. Gosper has r = .41 as the relation, empirical tests showed that + * for d<100 r = .375 is sufficient and r = .396 for d<200. + * It does not save much time but for a long series even a little + * can grow large. + */ + if (eps_digits < 100) { + k = 2 * ceil(.375 * eps_digits); + } else if (eps_digits < 200) { + k = 2 * ceil(.395 * eps_digits); + } else { + k = 2 * ceil(11 / 27 * eps_digits); + } + m = 0; + y = (z + k) ^ 2; + x = 0.0; + /* + * There is a chance to speed up the first partial sum with binary + * splitting. The second partial sum is dominated by the calculation + * of the Bernoulli numbers but can profit from binary splitting when + * the Bernoulli numbers are already cached. + */ + for (i = 1; i <= (k / 2); i++) { + m = 1 / (z + 2 * i - 1) + 1 / (z + 2 * i - 2) + m; + x = (x + bernoulli(k - 2 * i + 2) / (k - 2 * i + 2)) / y; + } + ret = ln(z + k) - 1 / (2 * (z + k)) - x - m; + epsilon(eps); + return ret; } define psi(z) { - return psi0(z); + return psi0(z); } -define polygamma(m,z) +define polygamma(m, z) { - /* - TODO: - http://functions.wolfram.com/GammaBetaErf/PolyGamma2/16/01/01/0002/ - */ - if(!isint(m))return newerror("polygamma(m,z); m not an integer"); - if( m<0 )return newerror("polygamma(m,z); m is < 0"); - /* - Reflection formula not implemented yet, needs cot-differentiation - http://functions.wolfram.com/ElementaryFunctions/Cot/20/02/0003/ - which is not implemented yet. - */ - if( m == 0){ - return psi0(z); - } - /* - use factorial for m a (small) integer? - use lngamma for m large? - */ - if(isodd(m+1)){ - return (-1)* gamma(m+1) * hurwitzzeta(m+1,z) - } - return gamma(m+1) * hurwitzzeta(m+1,z); + /* + * TODO: http://functions.wolfram.com/GammaBetaErf/PolyGamma2/16/01/01/0002/ + */ + if (!isint(m)) { + return newerror("polygamma(m,z); m not an integer"); + } + if (m < 0) { + return newerror("polygamma(m,z); m is < 0"); + } + /* + * Reflection formula not implemented yet, needs cot-differentiation + * http://functions.wolfram.com/ElementaryFunctions/Cot/20/02/0003/ + * which is not implemented yet. + */ + if (m == 0) { + return psi0(z); + } + /* + * use factorial for m a (small) integer? + * use lngamma for m large? + */ + if (isodd(m + 1)) { + return (-1) * gamma(m + 1) * hurwitzzeta(m + 1, z) + } + return gamma(m + 1) * hurwitzzeta(m + 1, z); } /* @@ -136,101 +143,110 @@ static __CZ__Ck; */ define __CZ__lngammarp(z) { - local epsilon accuracy a factrl sum n ret holds_enough term; + local epsilon accuracy a factrl sum n ret holds_enough term; - epsilon = epsilon(); - accuracy = digits(int(1/epsilon)) + 3; + epsilon = epsilon(); + accuracy = digits(int (1 / epsilon)) + 3; - epsilon(1e-18); - a = ceil(1.252850440912568095810522965 * accuracy); + epsilon(1e-18); + a = ceil(1.252850440912568095810522965 * accuracy); - epsilon(epsilon*10^(-(digits(1/epsilon)//2))); + epsilon(epsilon * 10 ^ (-(digits(1 / epsilon) //2))); - holds_enough = 0; + holds_enough = 0; - if(size( __CZ__Ck) != a) { - __CZ__Ck = mat[a]; - holds_enough = 1; - } - - factrl = 1.0; - - __CZ__Ck[0] = sqrt(2*pi()); /* c_0*/ - for(n = 1; n < a; n++){ - if(holds_enough == 1){ - __CZ__Ck[n] = (a - n)^(n - 0.5) * exp(a - n) /factrl; - factrl *= -n + if (size(__CZ__Ck) != a) { + __CZ__Ck = mat[a]; + holds_enough = 1; } - } - sum = __CZ__Ck[0]; - for (n = 1; n < a; n++){ - sum += __CZ__Ck[n]/(z+n); - } - ret = ln(sum)+(-(z+a)) + ln(z+a)*( z+0.5); - ret = ret-ln(z); + factrl = 1.0; - /* - Will take some time for large im(z) but almost all time is spend above - in that case. - */ - if(im(ret)) - ret = re(ret) + ln( exp( im(ret) *1i ) ); + __CZ__Ck[0] = sqrt(2 * pi()); /* c_0 */ + for (n = 1; n < a; n++) { + if (holds_enough == 1) { + __CZ__Ck[n] = (a - n) ^ (n - 0.5) * exp(a - n) / factrl; + factrl *= -n} + } + sum = __CZ__Ck[0]; + for (n = 1; n < a; n++) { + sum += __CZ__Ck[n] / (z + n); + } - epsilon(epsilon); - return ret; + ret = ln(sum) + (-(z + a)) + ln(z + a) * (z + 0.5); + ret = ret - ln(z); + + /* + * Will take some time for large im(z) but almost all time is spend above + * in that case. + */ + if (im(ret)) { + ret = re(ret) + ln(exp(im(ret) * 1i)); + } + + epsilon(epsilon); + return ret; } /* Simple lngamma with low precision*/ -define __CZ__lngamma_lanczos(z){ - local a k g zghalf lanczos; - mat lanczos[15] = { - 9.9999999999999709182e-1, - 5.7156235665862923516e1, - -5.9597960355475491248e1, - 1.4136097974741747173e1, - -4.9191381609762019978e-1, - 3.3994649984811888638e-5, - 4.6523628927048576010e-5, - -9.8374475304879566105e-5, - 1.5808870322491249322e-4, - -2.1026444172410489480e-4, - 2.1743961811521265523e-4, - -1.6431810653676390482e-4, - 8.4418223983852751308e-5, - -2.6190838401581411237e-5, - 3.6899182659531626821e-6 - }; - g = 607/128; - z = z-1; - a = 0; - for(k = 12; k >= 1; k--){ - a += lanczos[k]/(z+k); - } - a += lanczos[0]; - zghalf = z + g + .5; - return ( ln(sqrt(2*pi())) + ln(a) -zghalf ) + (z+.5)*ln( zghalf ); +define __CZ__lngamma_lanczos(z) +{ + local a k g zghalf lanczos; + mat lanczos[15] = { + 9.9999999999999709182e-1, + 5.7156235665862923516e1, + -5.9597960355475491248e1, + 1.4136097974741747173e1, + -4.9191381609762019978e-1, + 3.3994649984811888638e-5, + 4.6523628927048576010e-5, + -9.8374475304879566105e-5, + 1.5808870322491249322e-4, + -2.1026444172410489480e-4, + 2.1743961811521265523e-4, + -1.6431810653676390482e-4, + 8.4418223983852751308e-5, + -2.6190838401581411237e-5, + 3.6899182659531626821e-6 + }; + g = 607 / 128; + z = z - 1; + a = 0; + for (k = 12; k >= 1; k--) { + a += lanczos[k] / (z + k); + } + a += lanczos[0]; + zghalf = z + g + .5; + return (ln(sqrt(2 * pi())) + ln(a) - zghalf) + (z + .5) * ln(zghalf); } /* Prints the Spouge coefficients actually in use. */ -define __CZ__print__CZ__Ck(){ - local k; - if(size(__CZ__Ck) <=1){ - __CZ__lngammarp(2.2-2.2i); - } - for(k=0;k= mat[0,2]*/ static __CZ__stirling_params; -define __CZ__lngstirling(z,n){ - local k head sum z2 bernterm zz; - head = (z-1/2)*ln(z)-z+(ln(2*pi())/2); - sum = 0; - bernterm=0; - zz = z; - z2 = z^2; +define __CZ__lngstirling(z, n) +{ + local k head sum z2 bernterm zz; + head = (z - 1 / 2) * ln(z) - z + (ln(2 * pi()) / 2); + sum = 0; + bernterm = 0; + zz = z; + z2 = z ^ 2; - if(size(__CZ__precomp_stirling) 0){ - flag = 0; - eps = epsilon(); - epsilon(eps*1e-3); + local ret eps flag increasedby Z k tmp tmp2 decdigits; + local corr d37 d52 termcount; + /* z \in \mathbf{Z} */ + if (isint(z)) { + /*The gamma-function has poles at zero and the negative integers */ + if (z <= 0) { + return newerror("lngamma(z): z is a negative integer"); + } else { + /* may hold up accuracy a bit longer, but YMMV */ + if (z < 20) { + return ln((z - 1) !); + } else { + return __CZ__lngammarp(z); + } + } + } else { /*if(isint(z)) */ + if (re(z) > 0) { + flag = 0; + eps = epsilon(); + epsilon(eps * 1e-3); - /* Compute values on the real line with Spouge's algorithm*/ - if(!im(z)){# - ret = __CZ__lngammarp(z); - epsilon(eps); - return ret; - } - /* Do the rest with the Stirling series.*/ - /* This code repeats down under. Booh! */ - /* Make it a positive im(z) */ - if(im(z)<0){ - z = conj(z); - flag = 1; - } - /* Evaluate the number of terms needed */ - decdigits = floor( digits(1/eps) ); - /* 20 dec. digits is the default in calc(?)*/ - if(decdigits <= 21){ - /* set 20 as the minimum */ - epsilon(1e-22); - increasedby = 0; - /* inflate z */ - Z=z; - while(abs(z) < 10){ - z++; - increasedby++; - } + /* Compute values on the real line with Spouge's algorithm */ + if (!im(z)) { + ret = __CZ__lngammarp(z); + epsilon(eps); + return ret; + } + /* Do the rest with the Stirling series. */ + /* This code repeats down under. Booh! */ + /* Make it a positive im(z) */ + if (im(z) < 0) { + z = conj(z); + flag = 1; + } + /* Evaluate the number of terms needed */ + decdigits = floor(digits(1 / eps)); + /* 20 dec. digits is the default in calc(?) */ + if (decdigits <= 21) { + /* set 20 as the minimum */ + epsilon(1e-22); + increasedby = 0; + /* inflate z */ + Z = z; + while (abs(z) < 10) { + z++; + increasedby++; + } - ret = __CZ__lngstirling(z,11); - /* deflate z */ - if(increasedby > 1){ - for(k=0;k 1) { + for (k = 0; k < increasedby; k++) { + ret = ret - ln(Z + (k)); + } + } + /* Undo conjugate if one has been applied */ + if (flag == 1) { + ret = conj(ret); + } + epsilon(eps); + return ret; + } else { + d37 = decdigits * .37; + d52 = decdigits * .52; + termcount = ceil(d52); + if (abs(z) >= d52) { + if (abs(im(z)) >= d37) { + termcount = ceil(d37); + } else { + termcount = ceil(d52); + } + } - We do know the current precision and the result of the helper - function __CZ__R(z,k) returns the same number as "decdigits" if - fed with the correct "z" and "n". - The largest error is near the real line, so we try Z = re(1-z). - If Z is small, say < 20 we increment it until it is. - Computing Bernoulli numbers is expensive but they are small on - average, get cached and because of the method used, computing - any Bernoulli number > 0 produces the rest as a by-product. - Nevertheless we could use a faster asymptotic approximation. + Z = z; + increasedby = 0; + /* inflate z */ + if (abs(im(z)) >= d37) { + while (abs(z) < d52 + 1) { + z++; + increasedby++; + } + } else { + tmp = R(z, termcount); + tmp2 = tmp; + while (tmp2 < decdigits) { + z++; + increasedby++; + tmp2 = R(z, termcount); + if (tmp2 < tmp) { + return + newerror(strcat + ("lngamma(1): something happend that ", + "should not have happend")); + } + } + } - We increment the number of terms "k" in R(z,k) until the result - quits incrementing (it may even get smaller!). If the result is - still smaller than the current precision we increment "z" with - fixed "k" untill the result quits incrementing. - The results, the current precision, abs(re(z)) and "k" are kept. + corr = ceil(re(z) / 2 - 3 / 4 - kroneckerdelta(im(z)) / 4); - BTW: incrementing the number of terms might be more costly than - incrementing "z" -- computing large Bernoulli numbers vs. - computing a large number of complex logarithms is a fight with - a hard to know result -- and that the series isn't convergent - is of not much help either. E.g: - R(25,68) = 71 max - R(50,55) = 101 - R(50,145) = 140 max - R(60,170) = 167 max - R(70,209) = 195 max - R(75,173) = 200 max - R(80,147) = 200 max - R(90,124) = 200 max - R(100,111) = 200 max - Bernoulli(222) has a denominator of 9388 with a 254 digit - numerator. Computing up to 100 complex logarithms on the - other side ... + ret = __CZ__lngstirling(z, termcount); - D.E.G. Hare has found the bounds - |im(z)| > .37d or re(z) >= 0 and |z| > .52d - to be usefull to compute "z" to d digits accuracy. The numbers - correspond to the table above. + /* deflate z */ + if (increasedby > 1) { + for (k = 0; k < increasedby; k++) { + ret = ret - ln(Z + (k)); + } + } + /* Undo conjugate if one has been applied */ + if (flag == 1) { + ret = conj(ret); + } + epsilon(eps); + return ret; + } /* if(decdigits <= 20){...} else */ + } else { /* re(z)<0 */ + eps = epsilon(); + epsilon(eps * 1e-3); - To avoid repeated expensive computation, the result is cached - together with the current precision. It might be a good idea - to keep it more permanently in a config-file? - */ - d37 = decdigits * .37; - d52 = decdigits * .52; - termcount = ceil(d52); - if(abs(z) >= d52){ - if(abs(im(z))>= d37 ) - termcount = ceil(d37); - else - termcount = ceil(d52); - } + /* Use Spouge's approximation on the real line */ + if (!im(z)) { + /* reflection */ + ret = ln(pi() / sin(pi() * z)) - __CZ__lngammarp(1 - z); + /* it is log(gamma) and im(log(even(-x))) = k\pi, therefore: */ + if (abs(z) <= 1 / 2) { + ret = re(ret) - pi() * 1i; + } else if (isodd(floor(abs(re(z))))) { + ret = re(ret) + (ceil(abs(z)) * pi() * 1i); + } else if (iseven(floor(abs(re(z))))) { + /* < n+1/2 */ + if (iseven(floor(abs(z)))) { + ret = re(ret) + (ceil(abs(z) - 1 / 2 - 1) * pi() * 1i); + } else { + ret = re(ret) + (ceil(abs(z) - 1 / 2) * pi() * 1i); + } + } + epsilon(eps); + return ret; + } else { + /* Make it a positive im(z) */ + if (im(z) < 0) { + z = conj(z); + flag = 1; + } + /* Evaluate the number of terms needed */ + decdigits = floor(digits(1 / eps)); + /* 20 dec. digits is the default in calc(?) */ + if (decdigits <= 21) { + /* set 20 as the minimum */ + epsilon(1e-22); + termcount = 11; + increasedby = 0; + Z = z; + /* inflate z */ + if (im(z) >= digits(1 / epsilon()) * .37) { + while (abs(1 - z) < 10) { + z--; + increasedby++; + } + } else { + tmp = R(1 - z, termcount); + tmp2 = tmp; + while (tmp2 < 21) { + z--; + increasedby++; + tmp2 = R(1 - z, termcount); + if (tmp2 < tmp) { + return + newerror(strcat + ("lngamma(1): something happend ", + "that should not have happend")); + } + } + } - Z=z; - increasedby = 0; - /* inflate z */ - if( abs(im(z))>= d37){ - while(abs(z) < d52+1){ - z++; - increasedby++; - } - } - else{ - tmp = R(z,termcount); - tmp2 = tmp; - while(tmp2 < decdigits){ - z++; - increasedby++; - tmp2 = R(z,termcount); - if(tmp2 < tmp) - return newerror("lngamma(1): something happend that " - "should not have happend"); - } - } + corr = ceil(re(z) / 2 - 3 / 4 - kroneckerdelta(im(z)) / 4); - corr = ceil( re(z)/2 -3/4 - kroneckerdelta(im(z))/4); + /* reflection */ + ret = + ln(pi() / sin(pi() * z)) - __CZ__lngstirling(1 - z, + termcount); - ret = __CZ__lngstirling(z,termcount); + /* deflate z */ + if (increasedby > 0) { + for (k = 0; k < increasedby; k++) { + ret = ret + ln(z + (k)); + } + } + /* Apply correction term */ + ret = ret + 2 * (corr * pi()) * 1i; + /* Undo conjugate if one has been applied */ + if (flag == 1) { + ret = conj(ret); + } - /* deflate z */ - if(increasedby > 1){ - for(k=0;k 0) */ - else{/* re(z)<0 */ - eps = epsilon(); - epsilon(eps*1e-3); - - /* Use Spouge's approximation on the real line */ - if(!im(z)){ - /* reflection */ - ret = ln( pi() / sin(pi() *z ) ) - __CZ__lngammarp(1-z); - /* it is log(gamma) and im(log(even(-x))) = k\pi, therefore: */ - if(abs(z) <= 1/2) - ret = re(ret) - pi()*1i; - else if( isodd(floor(abs(re(z)))) ){ - ret = re(ret) + ( ceil(abs(z)) * pi() * 1i); - } - else if( iseven(floor(abs(re(z)))) ){ - /* < n+1/2 */ - if(iseven(floor(abs(z)))){ - ret = re(ret) + ( ceil(abs(z)-1/2 -1 ) * pi() * 1i); - } - else{ - ret = re(ret) + ( ceil(abs(z) -1/2 ) * pi() * 1i); - } - } - epsilon(eps); - return ret; - }/*if(!im(z))*/ - /* Use Stirlinsg approximation for the rest of the complex plane */ - else{ - /* Make it a positive im(z) */ - if(im(z)<0){ - z = conj(z); - flag = 1; - } - /* Evaluate the number of terms needed */ - decdigits = floor( digits(1/eps) ); - /* - Evaluate the correction term for the imaginary part needed because - of the reflection. - See - D. E. G. Hare, "Computing the Principal Branch of log-Gamma", - Journal of Algorithms 25(2):221-236 (1997) - http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.84.2063 - */ - - /* 20 dec. digits is the default in calc(?)*/ - if(decdigits <= 21){ - /* set 20 as the minimum */ - epsilon(1e-22); - termcount = 11; - increasedby = 0; - Z=z; - /* inflate z */ - if( im(z)>= digits(1/epsilon()) * .37){ - while(abs(1-z) < 10){ - /* making z more negative makes 1-z more positive. */ - z--; - increasedby++; - } - } - else{ - tmp = R(1-z,termcount); - tmp2 = tmp; - while(tmp2 < 21){ - z--; - increasedby++; - tmp2 = R(1-z,termcount); - if(tmp2 < tmp) - return newerror("lngamma(1): something happend " - "that should not have happend"); - } - } - - corr = ceil( re(z)/2 -3/4 - kroneckerdelta(im(z))/4); - - /* reflection */ - ret = ln( pi() / sin(pi() * z ) ) - __CZ__lngstirling(1-z,termcount); - - /* deflate z */ - if(increasedby > 0){ - for(k=0;k= d52){ - if(abs(im(z))>= d37 ) - termcount = ceil(d37); - else - termcount = ceil(d52); - } - increasedby = 0; - ##print "Z 1: ",z; - Z=z; - /* inflate z */ - if( abs(im(z))>= d37){ - while(abs(1-z) < d52+1){ - /* making z more negative makes 1-z more positive. */ - z--; - increasedby++; - } - } - else{ - tmp = R(1-z,termcount); - tmp2 = tmp; - while(tmp2 < decdigits){ - z--; - increasedby++; - tmp2 = R(1-z,termcount); - if(tmp2 < tmp) - return newerror("lngamma(1): something happend that " - "should not have happend"); - } - } - corr = ceil( re(z)/2 -3/4 - kroneckerdelta(im(z))/4); - /* reflection */ - ret = ln( pi() / sin(pi() *(z) ) ) - - __CZ__lngstirling(1-z,termcount); - /* deflate z */ - if(increasedby > 0){ - for(k=0;k 0){...} else */ - }/*if(isint(z)){...} else*/ + epsilon(eps); + return ret; + } else { + d37 = decdigits * .37; + d52 = decdigits * .52; + termcount = ceil(d52); + if (abs(z) >= d52) { + if (abs(im(z)) >= d37) { + termcount = ceil(d37); + } else { + termcount = ceil(d52); + } + } + increasedby = 0; + Z = z; + /* inflate z */ + if (abs(im(z)) >= d37) { + while (abs(1 - z) < d52 + 1) { + z--; + increasedby++; + } + } else { + tmp = R(1 - z, termcount); + tmp2 = tmp; + while (tmp2 < decdigits) { + z--; + increasedby++; + tmp2 = R(1 - z, termcount); + if (tmp2 < tmp) { + return + newerror(strcat + ("lngamma(1): something happend ", + "that should not have happend")); + } + } + } + corr = ceil(re(z) / 2 - 3 / 4 - kroneckerdelta(im(z)) / 4); + /* reflection */ + ret = + ln(pi() / sin(pi() * (z))) - __CZ__lngstirling(1 - z, + termcount); + /* deflate z */ + if (increasedby > 0) { + for (k = 0; k < increasedby; k++) { + ret = ret + ln(z + (k)); + } + } + /* Apply correction term */ + ret = ret + 2 * ((corr) * pi()) * 1i; + /* Undo conjugate if one has been applied */ + if (flag == 1) { + ret = conj(ret); + } + epsilon(eps); + return ret; + } /* if(decdigits <= 20){...} else */ + } /*if(!im(z)){...} else */ + } /* if(re(z) > 0){...} else */ + } /*if(isint(z)){...} else */ } /* Warning about large values? */ define gamma(z) { - /* exp(log(gamma(z))) = exp(lngamma(z)), so use Spouge here?*/ - local ret eps; - if(isint(z)){ - if(z <=0) - return newerror("gamma(z): z is a negative integer"); - else{ - /* may hold up accuracy a bit longer, but YMMV */ - if(z < 20) - return (z-1)!*1.0; - else{ - eps = epsilon(epsilon()*1e-2); - ret = exp(lngamma(z)); - epsilon(eps); - return ret; - } + /* exp(log(gamma(z))) = exp(lngamma(z)), so use Spouge here? */ + local ret eps; + if (isint(z)) { + if (z <= 0) { + return newerror("gamma(z): z is a negative integer"); + } else { + /* may hold up accuracy a bit longer, but YMMV */ + if (z < 20) { + return (z - 1) ! *1.0; + } else { + eps = epsilon(epsilon() * 1e-2); + ret = exp(lngamma(z)); + epsilon(eps); + return ret; + } + } + } else { + eps = epsilon(epsilon() * 1e-2); + ret = exp(lngamma(z)); + epsilon(eps); + return ret; } - } - else{ - eps = epsilon(epsilon()*1e-2); - ret = exp(lngamma(z)); - epsilon(eps); - return ret; - } } -define __CZ__harmonicF( a, b ,s) +define __CZ__harmonicF(a, b, s) { - local c; - if( b == a) return s ; - if( b-a > 1){ - c= (b + a) >> 1; - return( __CZ__harmonicF(a, c,1/a) + __CZ__harmonicF(c+1, b,1/b)); - } - return (1/a+1/b); + local c; + if (b == a) { + return s; + } + if (b - a > 1) { + c = (b + a) >> 1; + return (__CZ__harmonicF(a, c, 1 / a) + + __CZ__harmonicF(c + 1, b, 1 / b)); + } + return (1 / a + 1 / b); } define harmonic(limit) { - if( !isint(limit) ) - return newerror("harmonic(limit): limit is not an integer"); - if( limit <= 0 ) - return newerror("harmonic(limit): limit is <=0"); + if (!isint(limit)) { + return newerror("harmonic(limit): limit is not an integer"); + } + if (limit <= 0) { + return newerror("harmonic(limit): limit is <=0"); + } /* The binary splitting algorithm returns 0 for f(1,1,0) */ - if( limit == 1 ) return 1; - return __CZ__harmonicF( 1, limit ,0); + if (limit == 1) { + return 1; + } + return __CZ__harmonicF(1, limit, 0); } /* lower incomplete gamma function */ @@ -713,41 +672,44 @@ define harmonic(limit) /* lower for z <= 1.1 */ -define __CZ__gammainc_series_lower(a,z){ - local k ret tmp eps fact; - ret = 0; - k=0; - tmp=1; - fact = 1; - eps = epsilon(); - while(abs(tmp-ret) > eps){ - tmp = ret; - ret += (z^(k+a))/( (a+k)*fact ); - k++; - fact *= -k; - } - return gamma(a)-ret; +define __CZ__gammainc_series_lower(a, z) +{ + local k ret tmp eps fact; + ret = 0; + k = 0; + tmp = 1; + fact = 1; + eps = epsilon(); + while (abs(tmp - ret) > eps) { + tmp = ret; + ret += (z ^ (k + a)) / ((a + k) * fact); + k++; + fact *= -k; + } + return gamma(a) - ret; } /* lower for z > 1.1 */ -define __CZ__gammainc_cf(a,z,n){ - local ret k num1 denom1 num2 denom2 ; - ret = 0; - for(k=n+1;k>1;k--){ - ret = ((1-k)*(k-1-a))/(2*k-1+z-a+ret); - } - return ((z^a*exp(-z))/(1+z-a+ret)); +define __CZ__gammainc_cf(a, z, n) +{ + local ret k num1 denom1 num2 denom2; + ret = 0; + for (k = n + 1; k > 1; k--) { + ret = ((1 - k) * (k - 1 - a)) / (2 * k - 1 + z - a + ret); + } + return ((z ^ a * exp(-z)) / (1 + z - a + ret)); } /* G(n,z) lower*/ -define __CZ__gammainc_integer_a(a,z){ - local k sum fact zz; - for(k=0;k G(a,z) */ -define __CZ__endcf(n,a,z,P){ - local ret; +define __CZ__endcf(n, a, z, P) +{ + local ret; - ret = P*ln(10)+ln(4*pi()*sqrt(n)) + re(z+(3/2-a)*ln(z)-lngamma(1-a)); - ret = ret /( sqrt( 8*(abs(z)+re(z)) ) ); - return ret^2; + ret = + P * ln(10) + ln(4 * pi() * sqrt(n)) + re(z + (3 / 2 - a) * ln(z) - + lngamma(1 - a)); + ret = ret / (sqrt(8 * (abs(z) + re(z)))); + return ret ^ 2; } -/* lower incomplete gamma function */ define gammainc(a,z){ - local ret nterms eps epsilon tmp_before tmp_after n A B C sum k; - if(z == 0) - return 1; - if(isint(a)){ - if(a>0){ - if(a==1) return exp(-z); return __CZ__gammainc_integer_a(a,z); - } else{ - if(a==0){ - return -expoint(-z)+1/2*( ln(-z) - ln(-1/z) ) -ln(z); - } else if(a==-1){ - return expoint(-z)+1/2*(ln(-1/z)-ln(-z))+ln(z)+(exp(-z)/z); - } else{ - A = (-1)^((-a)-1)/((-a)!); B = - expoint(-z)-1/2*(ln(-z)-ln(1/-z))+ln(z); C = exp(-z); sum =0; - for(k=1;k<-a;k++){ - sum += (z^(k-a-1))/( fallingfactorial(-a,k) ); - } return A * B - C *sum; - } +/* lower incomplete gamma function */ +define gammainc(a, z) +{ + local ret nterms eps epsilon tmp_before tmp_after n A B C sum k; + if (z == 0) { + return 1; + } + if (isint(a)) { + if (a > 0) { + if (a == 1) { + return exp(-z); + } + return __CZ__gammainc_integer_a(a, z); + } else { + if (a == 0) { + return -expoint(-z) + 1 / 2 * (ln(-z) - ln(-1 / z)) - ln(z); + } else if (a == -1) { + return expoint(-z) + 1 / 2 * (ln(-1 / z) - ln(-z)) + ln(z) + + (exp(-z) / z); + } else { + A = (-1) ^ ((-a) - 1) / ((-a) !); + B = expoint(-z) - 1 / 2 * (ln(-z) - ln(1 / -z)) + ln(z); + C = exp(-z); + sum = 0; + for (k = 1; k < -a; k++) { + sum += (z ^ (k - a - 1)) / (fallingfactorial(-a, k)); + } + return A * B - C * sum; + } + } + } + if (re(z) <= 1.1 || re(z) < a + 1) { + eps = epsilon(epsilon() * 1e-10); + ret = __CZ__gammainc_series_lower(a, z); + epsilon(eps); + return ret; + } else { + eps = epsilon(epsilon() * 1e-10); + if (abs(exp(-z)) <= eps) { + return 0; + } + tmp_before = 0; + tmp_after = 1; + n = 1; + while (ceil(tmp_before) != ceil(tmp_after)) { + tmp_before = tmp_after; + tmp_after = __CZ__endcf(n++, a, z, digits(1 / eps)); + /* a still quite arbitrary limit */ + if (n > 10) { + return + newerror(strcat + ("gammainc: evaluating limit for continued ", + "fraction does not converge")); + } + } + ret = __CZ__gammainc_cf(a, z, ceil(tmp_after)); + epsilon(eps); + return ret; } - } if(re(z)<=1.1|| re(z) < a+1){##print "series"; - eps = epsilon(epsilon()*1e-10); ret = - __CZ__gammainc_series_lower(a,z); epsilon(eps); return ret; - } else{##print "cf"; - eps = epsilon(epsilon()*1e-10); if(abs(exp(-z)) <= eps) return 0; - tmp_before = 0; tmp_after = 1; n = 1; while(ceil(tmp_before) != - ceil(tmp_after)){ - tmp_before = tmp_after; tmp_after = - __CZ__endcf(n++,a,z,digits(1/eps)); /* a still quite arbitrary - limit */ if(n > 10){ - return newerror("gammainc: evaluating limit for continued " - "fraction does not converge"); - } - } ret = __CZ__gammainc_cf(a,z,ceil(tmp_after)); epsilon(eps); - return ret; - } } -define heavisidestep(x){ - return (1+sign(x))/2; + +define heavisidestep(x) +{ + return (1 + sign(x)) / 2; } -define NUMBER_POSITIVE_INFINITY(){ return 1/epsilon();} +define NUMBER_POSITIVE_INFINITY() +{ + return 1 / epsilon(); +} -define NUMBER_NEGATIVE_INFINITY(){ return -(1/epsilon());} +define NUMBER_NEGATIVE_INFINITY() +{ + return -(1 / epsilon()); +} static TRUE = 1; static FALSE = 0; -define g(prec){ - local eps ret; - if(!isnull(prec)){ - eps = epsilon(prec); - ret = -psi(1); +define g(prec) +{ + local eps ret; + if (!isnull(prec)) { + eps = epsilon(prec); + ret = -psi(1); + epsilon(eps); + return ret; + } + return -psi(1); +} + +define __CZ__series_converged(new, old, max) +{ + local eps; + if (isnull(max)) { + eps = epsilon(); + } else { + eps = max; + } + if (abs(re(new - old)) <= eps * abs(re(new)) + && abs(im(new - old)) <= eps * abs(im(new))) { + return TRUE; + } + return FALSE; +} + +define __CZ__ei_power(z) +{ + local tmp ei k old; + ei = g() + ln(abs(z)) + sgn(im(z)) * 1i * abs(arg(z));; + tmp = 1; + k = 1; + while (k) { + tmp *= z / k; + old = ei; + ei += tmp / k; + if (__CZ__series_converged(ei, old)) { + break; + } + k++; + } + return ei; +} + +define __CZ__ei_asymp(z) +{ + local ei old tmp k; + ei = sgn(im(z)) * 1i * pi(); + tmp = exp(z) / z; + for (k = 1; k <= floor(abs(z)) + 1; k++) { + old = ei; + ei += tmp; + if (__CZ__series_converged(ei, old)) { + return ei; + } + tmp *= k / z; + } + return newerror("expoint: asymptotic series does not converge"); +} + +define __CZ__ei_cf(z) +{ + local ei c d k old; + ei = sgn(im(z)) * 1i * pi(); + if (ei != 0) { + c = 1 / ei; + d = 0; + c = 1 / (1 - z - exp(z) * c); + d = 1 / (1 - z - exp(z) * d); + ei *= d / c; + } else { + c = NUMBER_POSITIVE_INFINITY(); + d = 0; + c = 0; + d = 1 / (1 - z - exp(z) * d); + ei = d * (-exp(z)); + } + k = 1; + while (1) { + c = 1 / (2 * k + 1 - z - k * k * c); + d = 1 / (2 * k + 1 - z - k * k * d); + old = ei; + ei *= d / c; + if (__CZ__series_converged(ei, old)) { + break; + } + k++; + } + return ei; +} + +define expoint(z) +{ + local ei eps ret; + eps = epsilon(epsilon() * 1e-5); + if (abs(z) >= NUMBER_POSITIVE_INFINITY()) { + if (config("user_debug") > 0) { + print "expoint: abs(z) > +inf"; + } + ret = sgn(im(z)) * 1i * pi() + exp(z) / z; + epsilon(eps); + return ret; + } + if (abs(z) > 2 - 1.035 * log(epsilon())) { + if (config("user_debug") > 0) { + print "expoint: using asymptotic series"; + } + ei = __CZ__ei_asymp(z); + if (!iserror(ei)) { + ret = ei; + epsilon(eps); + return ret; + } + } + if (abs(z) > 1 && (re(z) < 0 || abs(im(z)) > 1)) { + if (config("user_debug") > 0) { + print "expoint: using continued fraction"; + } + ret = __CZ__ei_cf(z); + epsilon(eps); + return ret; + } + if (abs(z) > 0) { + if (config("user_debug") > 0) { + print "expoint: using power series"; + } + ret = __CZ__ei_power(z); + epsilon(eps); + return ret; + } + if (abs(z) == 0) { + if (config("user_debug") > 0) { + print "expoint: abs(z) = zero "; + } + epsilon(eps); + return NUMBER_NEGATIVE_INFINITY(); + } +} + +define erf(z) +{ + return sqrt(z ^ 2) / z * (1 - 1 / sqrt(pi()) * gammainc(1 / 2, z ^ 2)); +} + +define erfc(z) +{ + return 1 - erf(z); +} + +define erfi(z) +{ + return -1i * erf(1i * z); +} + +define faddeeva(z) +{ + return exp(-z ^ 2) * erfc(-1i * z); +} + +define gammap(a, z) +{ + return gammainc(a, z) / gamma(a); +} + +define gammaq(a, z) +{ + return 1 - gammap(a, z); +} + +define lnbeta(a, b) +{ + local ret eps; + eps = epsilon(epsilon() * 1e-3); + ret = (lngamma(a) + lngamma(b)) - lngamma(a + b); epsilon(eps); return ret; - } - return -psi(1); } -define __CZ__series_converged(new,old,max){ - local eps; - if(isnull(max)) - eps = epsilon(); - else - eps = max; - if( abs(re(new - old)) <= eps * abs(re(new)) - && abs(im(new - old)) <= eps * abs(im(new))) - return TRUE; - return FALSE; +define beta(a, b) +{ + return exp(lnbeta(a, b)); } -define __CZ__ei_power(z){ - local tmp ei k old; - ei = g() + ln(abs(z)) + sgn(im(z)) * 1i * abs(arg(z)); - ##ei = g() + ln(z) -1i*pi()*floor( (arg(z)+pi()) / (2*pi()) ); - tmp = 1; - k = 1; - while(k){ - tmp *= z / k; - old = ei; - ei += tmp / k; - if (__CZ__series_converged(ei,old)) break; - k++; - } - return ei; -} -define __CZ__ei_asymp(z){ - local ei old tmp k; - ei = sgn(im(z)) * 1i * pi(); - tmp = exp(z) / z; - for(k=1; k<=floor(abs(z))+1; k++){ - old = ei; - ei += tmp; - if (__CZ__series_converged(ei, old)) return ei; - tmp *= k / z; - } - return newerror("expoint: asymptotic series does not converge"); -} - -define __CZ__ei_cf(z){ - local ei c d k old; - ei = sgn(im(z)) * 1i * pi(); - if(ei != 0){ - c = 1 / ei; - d = 0; - c = 1 / (1 - z - exp(z) * c); - d = 1 / (1 - z - exp(z) * d); - ei *= d / c; - } - else{ - c = NUMBER_POSITIVE_INFINITY(); - d = 0; - c = 0; - d = 1 / (1 - z - exp(z) * d); - ei = d * (- exp(z)); - } - k = 1; - while(1){ - c = 1 / (2 * k + 1 - z - k * k * c); - d = 1 / (2 * k + 1 - z - k * k * d); - old = ei; - ei *= d / c; - if (__CZ__series_converged(ei, old)) break; - k++; - } - return ei; -} - -define expoint(z){ - local ei eps ret; - eps=epsilon(epsilon()*1e-5); - if(abs(z) >= NUMBER_POSITIVE_INFINITY()){ - if (config("user_debug") > 0) { - print "expoint: abs(z) > +inf"; +define __CZ__ibetacf_a(a, b, z, n) +{ + local A B m places; + if (n == 1) { + return 1; } - ret = sgn(im(z)) * 1i * pi() + exp(z) / z; - epsilon(eps); - return ret; - } - if(abs(z) > 2 - 1.035 * log(epsilon())){ - if (config("user_debug") > 0) { - print "expoint: using asymptotic series"; - } - ei = __CZ__ei_asymp(z); - if (!iserror(ei)){ - ret = ei; - epsilon(eps); - return ret; - } - } - if(abs(z) > 1 && (re(z) < 0 || abs(im(z)) > 1)){ - if (config("user_debug") > 0) { - print "expoint: using continued fraction"; - } - ret = __CZ__ei_cf(z); - epsilon(eps); - return ret; - } - if(abs(z) > 0){ - if (config("user_debug") > 0) { - print "expoint: using power series"; - } - ret = __CZ__ei_power(z); - epsilon(eps); - return ret; - } - if(abs(z) == 0){ - if (config("user_debug") > 0) { - print "expoint: abs(z) = zero "; - } - epsilon(eps); - return NUMBER_NEGATIVE_INFINITY(); - } + m = n - 1; + places = highbit(1 + int (1 / epsilon())) +1; + A = bround((a + m - 1) * (a + b + m - 1) * m * (b - m) * z ^ 2, places++); + B = bround((a + 2 * (m) - 1) ^ 2, places++); + return A / B; } -define erf(z){ - return sqrt(z^2)/z * ( 1-1/sqrt(pi()) *gammainc(1/2,z^2) ); -} - -define erfc(z){ - return 1-erf(z); -} - -define erfi(z){ - return -1i*erf(1i*z); -} - -define faddeeva(z){ - return exp(-z^2)*erfc(-1i*z); -} - -define gammap(a,z){ - return gammainc(a,z)/gamma(a); -} - -define gammaq(a,z){ - return 1-gammap(a,z); -} - -define lnbeta(a,b){ - local ret eps; - eps=epsilon(epsilon()*1e-3); - ret = (lngamma(a)+lngamma(b))-lngamma(a+b); - epsilon(eps); - return ret; -} - -define beta(a,b){ - return exp(lnbeta(a,b)); -} - -define __CZ__ibetacf_a(a,b,z,n){ - local A B m places; - if(n==1) return 1; - m=n-1; - places = highbit(1 + int(1/epsilon())) + 1; - A = bround((a+m-1) * (a+b+m-1) * m * (b-m) * z^2,places++); - B = bround((a+2*(m)-1)^2,places++); - return A/B; -} - -define __CZ__ibetacf_b(a,b,z,n){ - local A B m places; - places = highbit(1 + int(1/epsilon())) + 1; - m=n-1; - A = bround((m*(b-m)*z)/(a+2*m-1),places++); - B = bround(( (a+m) * (a-(a+b)*z+1+m*(2-z)) )/(a+2*m+1),places++); - return m+A+B; +define __CZ__ibetacf_b(a, b, z, n) +{ + local A B m places; + places = highbit(1 + int (1 / epsilon())) +1; + m = n - 1; + A = bround((m * (b - m) * z) / (a + 2 * m - 1), places++); + B = bround(((a + m) * (a - (a + b) * z + 1 + m * (2 - z))) / (a + 2 * m + + 1), places++); + return m + A + B; } /* Didonato-Morris */ -define __CZ__ibeta_cf_var_dm(a,b,z,max){ - local m f c d check del h qab qam qap eps places; +define __CZ__ibeta_cf_var_dm(a, b, z, max) +{ + local m f c d check del h qab qam qap eps places; - eps= epsilon(); + eps = epsilon(); - if(isnull(max)) max = 100; - places = highbit(1 + int(1/epsilon())) + 1; - f = eps; - c = f; - d = 0; - for(m=1;m<=max;m++){ - d =bround( __CZ__ibetacf_b(a,b,z,m)+__CZ__ibetacf_a(a,b,z,m)*d,places++); - if(abs(d) max) return newerror("ibeta: continous fraction does not converge"); - return f; -} - -define betainc_complex(z,a,b){ - local factor ret eps cf sum k N places tmp tmp2; - - if(z == 0){ - if(re(a) > 0) return 0; - if(re(a) < 0) return newerror("betainc_complex: z == 0 and re(a) < 0"); - } - if(z == 1){ - if(re(b)>0) return 1; - else return newerror("betainc_complex: z == 1 and re(b) < 0"); - } - if(b<=0){ - if(isint(b)) return 0; - else return newerror("betainc_complex: b <= 0"); - } - if(z==1/2 && (a==b)){return 1/2; - } - ##if(2==1){ - if(isint(a) && isint(b)){ - eps=epsilon(epsilon()*1e-10); - N = a+b-1; - sum = 0; - for(k=a;k<=N;k++){ - tmp = ln(z)*k+ln(1-z)*(N-k); - tmp2 = exp(ln(comb(N,k))+tmp); - sum += tmp2; + if (isnull(max)) { + max = 100; } - epsilon(eps); - return sum - } - else if(re(z) <= re((a+1)/(a+b+2))){ - eps=epsilon(epsilon()*1e-10); - places = highbit(1 + int(1/epsilon())) + 1; - factor = bround(( ln(z^a*(1-z)^b ) - lnbeta(a,b) ),places); - cf =bround( __CZ__ibeta_cf_var_dm(a,b,z),places); - ret = factor + ln(cf); - if(abs(ret//ln(2)) >= places) - ret = 0; - else - ret = bround(exp(factor + ln(cf)),places); - epsilon(eps); - return ret; - } - else if( re(z) > re( (a+1)/(a+b+2) ) || re(1-z) < re( (b+1)/(a+b+2) ) ){ - ret = 1 - betainc_complex(1-z,b,a); - } - return ret; + places = highbit(1 + int (1 / epsilon())) + 1; + f = eps; + c = f; + d = 0; + for (m = 1; m <= max; m++) { + d = bround(__CZ__ibetacf_b(a, b, z, m) + + __CZ__ibetacf_a(a, b, z, m) * d, places++); + if (abs(d) < eps) { + d = eps; + } + c = bround(__CZ__ibetacf_b(a, b, z, m) + + __CZ__ibetacf_a(a, b, z, m) / c, places++); + if (abs(c) < eps) { + c = eps; + } + d = 1 / d; + check = c * d; + f = f * check; + if (abs(check - 1) < eps) { + break; + } + } + if (m > max) { + return newerror("ibeta: continous fraction does not converge"); + } + return f; } +define betainc_complex(z, a, b) +{ + local factor ret eps cf sum k N places tmp tmp2; + + if (z == 0) { + if (re(a) > 0) { + return 0; + } + if (re(a) < 0) { + return newerror("betainc_complex: z == 0 and re(a) < 0"); + } + } + if (z == 1) { + if (re(b) > 0) { + return 1; + } else { + return newerror("betainc_complex: z == 1 and re(b) < 0"); + } + } + if (b <= 0) { + if (isint(b)) { + return 0; + } else { + return newerror("betainc_complex: b <= 0"); + } + } + if (z == 1 / 2 && (a == b)) { + return 1 / 2; + } + if (isint(a) && isint(b)) { + eps = epsilon(epsilon() * 1e-10); + N = a + b - 1; + sum = 0; + for (k = a; k <= N; k++) { + tmp = ln(z) * k + ln(1 - z) * (N - k); + tmp2 = exp(ln(comb(N, k)) + tmp); + sum += tmp2; + } + epsilon(eps); + return sum; + } else if (re(z) <= re((a + 1) / (a + b + 2))) { + eps = epsilon(epsilon() * 1e-10); + places = highbit(1 + int (1 / epsilon())) + 1; + factor = bround((ln(z ^ a * (1 - z) ^ b) - lnbeta(a, b)), places); + cf = bround(__CZ__ibeta_cf_var_dm(a, b, z), places); + ret = factor + ln(cf); + if (abs(ret//ln(2)) >= places) { + ret = 0; + } else { + ret = bround(exp(factor + ln(cf)), places); + } + epsilon(eps); + return ret; + } else if (re(z) > re((a + 1) / (a + b + 2)) + || re(1 - z) < re((b + 1) / (a + b + 2))) { + ret = 1 - betainc_complex(1 - z, b, a); + } + return ret; +} + + + + /******************************************************************************/ /* @@ -1110,83 +1159,82 @@ define betainc_complex(z,a,b){ Output, the value of the incomplete Beta function ratio. */ -define __CZ__ibetaas63(x, a, b,beta){ - local ai betain cx indx ns aa asb bb rx temp term value xx acu places; - acu = epsilon(); +define __CZ__ibetaas63(x, a, b, beta) +{ + local ai betain cx indx ns aa asb bb rx temp term value xx acu places; + acu = epsilon(); - value = x; - /* inverse incbeta calculates it already */ - if(isnull(beta)) - beta = lnbeta(a,b); + value = x; + /* inverse incbeta calculates it already */ + if (isnull(beta)) + beta = lnbeta(a, b); - if ( a <= 0.0 || b <= 0.0 ){ - return newerror("betainc: domain error: a < 0 and/or b < 0"); - } - if ( x < 0.0 || 1.0 < x ){ - return newerror("betainc: domain error: x<0 or x>1"); - } - if ( x == 0.0 || x == 1.0 ){ + if (a <= 0.0 || b <= 0.0) { + return newerror("betainc: domain error: a < 0 and/or b < 0"); + } + if (x < 0.0 || 1.0 < x) { + return newerror("betainc: domain error: x<0 or x>1"); + } + if (x == 0.0 || x == 1.0) { + return value; + } + asb = a + b; + cx = 1.0 - x; + + if (a < asb * x) { + xx = cx; + cx = x; + aa = b; + bb = a; + indx = 1; + } else { + xx = x; + aa = a; + bb = b; + indx = 0; + } + + term = 1.0; + ai = 1.0; + value = 1.0; + ns = floor(bb + cx * asb); + + rx = xx / cx; + temp = bb - ai; + if (ns == 0) { + rx = xx; + } + places = highbit(1 + int (1 / acu)) + 1; + while (1) { + term = bround(term * temp * rx / (aa + ai), places++); + value = value + term;; + temp = abs(term); + + if (temp <= acu && temp <= abs(acu * value)) { + value = value * exp(aa * ln(xx) + + (bb - 1.0) * ln(cx) - beta) / aa; + + if (indx) { + value = 1.0 - value; + } + break; + } + + ai = ai + 1.0; + ns = ns - 1; + + if (0 <= ns) { + temp = bb - ai; + if (ns == 0) { + rx = xx; + } + } else { + temp = asb; + asb = asb + 1.0; + } + } + epsilon(acu); return value; - } - asb = a + b; - cx = 1.0 - x; - - if ( a < asb * x ){ - xx = cx; - cx = x; - aa = b; - bb = a; - indx = 1; - } - else{ - xx = x; - aa = a; - bb = b; - indx = 0; - } - - term = 1.0; - ai = 1.0; - value = 1.0; - ns = floor( bb + cx * asb ); - - rx = xx / cx; - temp = bb - ai; - if ( ns == 0 ){ - rx = xx; - } - places = highbit(1 + int(1/acu)) + 1; - while(1){ - term = bround(term * temp * rx / ( aa + ai ),places++); - value = value + term;; - temp = abs ( term ); - - if ( temp <= acu && temp <= abs(acu * value) ){ - value = value * exp ( aa * ln ( xx ) - + ( bb - 1.0 ) * ln ( cx ) - beta ) / aa; - - if ( indx ){ - value = 1.0 - value; - } - break; - } - - ai = ai + 1.0; - ns = ns - 1; - - if ( 0 <= ns ) { - temp = bb - ai; - if ( ns == 0 ) { - rx = xx; - } - } - else { - temp = asb; - asb = asb + 1.0; - } - } - epsilon(acu); - return value; } /* @@ -1200,169 +1248,196 @@ define __CZ__ibetaas63(x, a, b,beta){ */ -define betainc(z,a,b){ - local factor ret eps cf sum k N places tmp tmp2; +define betainc(z, a, b) +{ + local factor ret eps cf sum k N places tmp tmp2; - if(im(z) || im(a) || im(b)) - return betainc_complex(z,a,b); + if (im(z) || im(a) || im(b)) + return betainc_complex(z, a, b); - if(z == 0){ - if(re(a) > 0) return 0; - if(re(a) < 0) return newerror("betainc: z == 0 and re(a) < 0"); - } - if(z == 1){ - if(re(b)>0) return 1; - else return newerror("betainc: z == 1 and re(b) < 0"); - } - if(b<=0){ - if(isint(b)) return 0; - else return newerror("betainc: b <= 0"); - } - if(z==1/2 && a==b){ - return 1/2; - } - return __CZ__ibetaas63(z,a,b); + if (z == 0) { + if (re(a) > 0) { + return 0; + } + if (re(a) < 0) { + return newerror("betainc: z == 0 and re(a) < 0"); + } + } + if (z == 1) { + if (re(b) > 0) { + return 1; + } else { + return newerror("betainc: z == 1 and re(b) < 0"); + } + } + if (b <= 0) { + if (isint(b)) { + return 0; + } else { + return newerror("betainc: b <= 0"); + } + } + if (z == 1 / 2 && a == b) { + return 1 / 2; + } + return __CZ__ibetaas63(z, a, b); } -define __CZ__erfinvapprox(x){ - local a; - a =0.147; - return sgn(x)*sqrt(sqrt((2/(pi()*a)+(ln(1-x^2))/2)^2-(ln(1-x^2))/a)- - (2/(pi()*a)+(ln(1-x^2))/2)); +define __CZ__erfinvapprox(x) +{ + local a; + a = 0.147; + return sgn(x) * + sqrt(sqrt + ((2 / (pi() * a) + (ln(1 - x ^ 2)) / 2) ^ 2 - (ln(1 - x ^ 2)) / a) + - (2 / (pi() * a) + (ln(1 - x ^ 2)) / 2)); } /* complementary inverse errror function, faster at about x < 1-.91 Henry E. Fettis. "A stable algorithm for computing the inverse error function in the 'tail-end' region" Math. Comp., 28:585-587, 1974. */ -define __CZ__inverffettis(x,n){ - local y sqrtpi oldy k places; - if (isnull(n)) - n = 205; - y = erfinvapprox(1-x); - places = highbit(1 + int(1/epsilon())) + 1; - sqrtpi = sqrt(pi()); - do - { - oldy = y;k++; - y = bround((ln( __CZ__fettiscf(y,n) / (sqrtpi * x)))^(1/2),places); - } while( abs(y - oldy)/y > epsilon()); - return y; +define __CZ__inverffettis(x, n) +{ + local y sqrtpi oldy k places; + if (isnull(n)) + n = 205; + y = erfinvapprox(1 - x); + places = highbit(1 + int (1 / epsilon())) + 1; + sqrtpi = sqrt(pi()); + do { + oldy = y; + k++; + y = bround((ln(__CZ__fettiscf(y, n) / (sqrtpi * x))) ^ (1 / 2), places); + } while (abs(y - oldy) / y > epsilon()); + return y; } /* cf for erfc() */ -define __CZ__fettiscf(y,n){ - local k t tt r a b ; - t = 1/y; - tt = t^2/2; - for (k=n;k> 0;k--){ - a = 1; - b = k*tt; - r = b / (a + r); - } - return t / (1+r); +define __CZ__fettiscf(y, n) +{ + local k t tt r a b; + t = 1 / y; + tt = t ^ 2 / 2; + for (k = n; k > 0; k--) { + a = 1; + b = k * tt; + r = b / (a + r); + } + return t / (1 + r); } /* inverse errror function, faster at about x<=.91*/ -define __CZ__inverfbin(x){ - local places approx flow fhigh eps high low mid fmid epsilon; - approx = erfinvapprox(x); - epsilon = epsilon(); - high = approx + 1e-4; - low = -1; - places = highbit(1 + int(1/epsilon)) + 1; - fhigh = x-erf(high); - flow = x-erf(low); - while(1){ - mid = bround(high - fhigh * (high - low) / (fhigh - flow), places); - if ((mid == low) || (mid == high)) - places++; - fmid = x-erf(mid); - if (abs(fmid) < epsilon) - return mid; - if (sgn(fmid) == sgn(flow)) { - low = mid; - flow = fmid; +define __CZ__inverfbin(x) +{ + local places approx flow fhigh eps high low mid fmid epsilon; + approx = erfinvapprox(x); + epsilon = epsilon(); + high = approx + 1e-4; + low = -1; + places = highbit(1 + int (1 / epsilon)) +1; + fhigh = x - erf(high); + flow = x - erf(low); + while (1) { + mid = bround(high - fhigh * (high - low) / (fhigh - flow), places); + if ((mid == low) || (mid == high)) { + places++; + } + fmid = x - erf(mid); + if (abs(fmid) < epsilon) { + return mid; + } + if (sgn(fmid) == sgn(flow)) { + low = mid; + flow = fmid; + } else { + high = mid; + fhigh = fmid; + } } - else { - high = mid; - fhigh = fmid; - } - } } -define erfinv(x){ - local ret approx a eps y old places errfunc sqrtpihalf flag k; - if(x<-1 || x > 1) return newerror("erfinv: input out of domain (-1<=x<=1)"); - if(x == 0) return 0; - if(x == -1) return NUMBER_NEGATIVE_INFINITY(); - if(x == +1) return NUMBER_POSITIVE_INFINITY(); +define erfinv(x) +{ + local ret approx a eps y old places errfunc sqrtpihalf flag k; + if (x < -1 || x > 1) + return newerror("erfinv: input out of domain (-1<=x<=1)"); + if (x == 0) + return 0; + if (x == -1) + return NUMBER_NEGATIVE_INFINITY(); + if (x == +1) + return NUMBER_POSITIVE_INFINITY(); - if(x<0){ - x = -x; - flag = 1; - } - /* No need for full pecision */ - eps=epsilon(1e-20); - if(eps >= 1e-40){ - /* Winitzki, Sergei (6 February 2008). "A handy approximation for the error - function and its inverse"*/ - a = 0.147; - y = sgn(x)*sqrt(sqrt((2/(pi()*a) - +(ln(1-x^2))/2)^2 - -(ln(1-x^2))/a) - -(2/(pi()*a)+(ln(1-x^2))/2)); - - } - else { - /* 20 digits instead of 5 */ - if(x <= .91) - y = __CZ__inverfbin(x); - else - y = __CZ__inverffettis(1-x); - - if(eps <= 1e-20){ - epsilon(eps); - return y; + if (x < 0) { + x = -x; + flag = 1; } - } - epsilon(eps); - /* binary digits in number (here: number = epsilon()) */ - places = highbit(1 + int(1/eps)) + 1; - sqrtpihalf = 2/sqrt(pi()); - k = 0; - /* - Do some Newton-Raphson steps to reach final accuracy. - Only a couple of steps are necessary but calculating the error function at - higher precision is quite costly; - */ - do{ - old = y; - errfunc = bround( erf(y),places); - if( abs(errfunc-x) <= eps ) break; - y = bround(y-( errfunc -x) / ( sqrtpihalf * exp(-y^2)),places); - k++; - }while(1); - /* - This is not really necessary but e.g: - ; epsilon(1e-50) - 0.00000000000000000000000000000000000000000000000001 - ; erfinv(.9999999999999999999999999999999) - 8.28769266865549025938 - ; erfinv(.999999999999999999999999999999) - 8.14861622316986460738453487549552168842204512959346 - ; erf(8.28769266865549025938) - 0.99999999999999999999999999999990000000000000000000 - ; erf(8.14861622316986460738453487549552168842204512959346) - 0.99999999999999999999999999999900000000000000000000 - The precision "looks too short". - */ - if(k == 0) - y = bround(y-( errfunc -x) / ( sqrtpihalf * exp(-y^2)),places); - if(flag == 1) - y = -y; - return y; + /* No need for full pecision */ + eps = epsilon(1e-20); + if (eps >= 1e-40) { + /* Winitzki, Sergei (6 February 2008). "A handy approximation for the + * error function and its inverse" */ + a = 0.147; + y = sgn(x) * sqrt(sqrt((2 / (pi() * a) + + (ln(1 - x ^ 2)) / 2) ^ 2 + - (ln(1 - x ^ 2)) / a) + - (2 / (pi() * a) + (ln(1 - x ^ 2)) / 2)); + + } else { + /* 20 digits instead of 5 */ + if (x <= .91) { + y = __CZ__inverfbin(x); + } else { + y = __CZ__inverffettis(1 - x); + } + + if (eps <= 1e-20) { + epsilon(eps); + return y; + } + } + epsilon(eps); + /* binary digits in number (here: number = epsilon()) */ + places = highbit(1 + int (1 / eps)) +1; + sqrtpihalf = 2 / sqrt(pi()); + k = 0; + /* + * Do some Newton-Raphson steps to reach final accuracy. + * Only a couple of steps are necessary but calculating the error function + * at higher precision is quite costly; + */ + do { + old = y; + errfunc = bround(erf(y), places); + if (abs(errfunc - x) <= eps) { + break; + } + y = bround(y - (errfunc - x) / (sqrtpihalf * exp(-y ^ 2)), places); + k++; + } while (1); + /* + * This is not really necessary but e.g: + * ; epsilon(1e-50) + * 0.00000000000000000000000000000000000000000000000001 + * ; erfinv(.9999999999999999999999999999999) + * 8.28769266865549025938 + * ; erfinv(.999999999999999999999999999999) + * 8.14861622316986460738453487549552168842204512959346 + * ; erf(8.28769266865549025938) + * 0.99999999999999999999999999999990000000000000000000 + * ; erf(8.14861622316986460738453487549552168842204512959346) + * 0.99999999999999999999999999999900000000000000000000 + * The precision "looks too short". + */ + if (k == 0) { + y = bround(y - (errfunc - x) / (sqrtpihalf * exp(-y ^ 2)), places); + } + if (flag == 1) { + y = -y; + } + return y; } diff --git a/cal/statistics.cal b/cal/statistics.cal index 2f4ca16..bb49f08 100644 --- a/cal/statistics.cal +++ b/cal/statistics.cal @@ -1,13 +1,13 @@ /* - * statistics - Some assorted statistics functions. + * statistics - Some assorted statistics functions. * * Copyright (C) 2013 Christoph Zurnieden * - * statistics is open software; you can redistribute it and/or modify it under + * 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. * - * statistics is distributed in the hope that it will be useful, but WITHOUT + * 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. @@ -17,8 +17,8 @@ * 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.3 $ - * @(#) $Id: statistics.cal,v 30.3 2013/08/11 08:41:38 chongo Exp $ + * @(#) $Revision: 30.4 $ + * @(#) $Id: statistics.cal,v 30.4 2013/08/18 20:01:53 chongo Exp $ * @(#) $Source: /usr/local/src/bin/calc/cal/RCS/statistics.cal,v $ * * Under source code control: 2013/08/11 01:31:28 @@ -31,8 +31,8 @@ resource_debug_level = config("resource_debug", 0); /* - get dependencies -*/ + * get dependencies + */ read -once factorial2 brentsolve diff --git a/cal/test8900.cal b/cal/test8900.cal index 866b769..240ff4e 100644 --- a/cal/test8900.cal +++ b/cal/test8900.cal @@ -3,11 +3,11 @@ * * Copyright (C) 2013 Christoph Zurnieden * - * test8900 is open software; you can redistribute it and/or modify it under + * 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. * - * test8900 is distributed in the hope that it will be useful, but WITHOUT + * 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. @@ -17,8 +17,8 @@ * 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: test8900.cal,v 30.4 2013/08/11 08:22:01 chongo Exp $ + * @(#) $Revision: 30.6 $ + * @(#) $Id: test8900.cal,v 30.6 2013/09/01 22:16:21 chongo Exp $ * @(#) $Source: /usr/local/src/bin/calc/cal/RCS/test8900.cal,v $ * * Under source code control: 2013/08/11 01:31:28 @@ -43,1304 +43,2582 @@ read -once specialfunctions.cal; read -once statistics.cal; read -once toomcook.cal; read -once zeta2.cal; +read -once intnum.cal; /* * tests of correctness of the functions implemented by the above listed * author. All values tested against have been computed with at least two * independant algorithms where possible (indicated if not). - * - * test 01 tests gamma(z) for the following values - * - * z gamma(z) - * 5 24 - * -5 error - * -5.5 0.01091265478190986298673234429 - * 5.5 52.34277778455352018114900849 - * 5.5+5.5i -3.760669488993539011972109411 - 1.068828791178021218008599278i - * -5.5+5.5i -0.0000000031513765339396-0.00000000565396294185819i - * -5.5-5.5i -0.0000000031513765339396+0.00000000565396294185819i */ -define t01(){ - local eps; - eps = epsilon(1e-20); - if(gamma( 5 ) != 24){ +define t01() +{ + local eps; + eps = epsilon(1e-20); + if (gamma(5) != 24) { + epsilon(eps); + return 1; + } + if (!iserror(gamma(-5))) { + epsilon(eps); + return 2; + } + if (abs(gamma(-5.5) - 0.01091265478190986298673234429) > __CZ__eps) { + epsilon(eps); + return 3; + } + if (abs + (gamma(5.5 + 5.5i) - + (-3.760669488993539011972109411 - 1.068828791178021218008599278i)) > + __CZ__eps) { + epsilon(eps); + return 4; + } + if (abs + (gamma(-5.5 + 5.5i) - + (-0.0000000031513765339396 - 0.00000000565396294185819i)) > + __CZ__eps) { + epsilon(eps); + return 5; + } + if (abs + (gamma(-5.5 - 5.5i) - + (-0.0000000031513765339396 + 0.00000000565396294185819i)) > + __CZ__eps) { + epsilon(eps); + return 5; + } epsilon(eps); - return 1; - } - if(!iserror(gamma( -5 ))){ - epsilon(eps); - return 2; - } - if( abs(gamma( -5.5 ) - 0.01091265478190986298673234429) > __CZ__eps){ - epsilon(eps); - return 3; - } - if( abs(gamma( 5.5+5.5i ) - ( -3.760669488993539011972109411 - 1.068828791178021218008599278i) ) > __CZ__eps ){ - epsilon(eps); - return 4; - } - if( abs(gamma(-5.5+5.5i ) - ( -0.0000000031513765339396-0.00000000565396294185819i)) > __CZ__eps ){ - epsilon(eps); - return 5; - } - if( abs(gamma(-5.5-5.5i ) - ( -0.0000000031513765339396+0.00000000565396294185819i)) > __CZ__eps ){ - epsilon(eps); - return 5; - } - epsilon(eps); - return 0; + return 0; } /* test 02 tests lngamma(z) as ln(gamma(z))for a lot of values. Twice. */ -define t02(type){ - local eps k; - eps = epsilon(1e-20); +define t02(type) +{ + local eps k; + eps = epsilon(1e-20); - if(!isnull(type)){ - /* test lngamma to higher precision */ - epsilon(1e-50) - } + if (!isnull(type)) { + /* test lngamma to higher precision */ + epsilon(1e-50) + } + + if (!iserror(lngamma(-5))) { + epsilon(eps); + return 1; + } + + if (abs + (lngamma(-4.400) - + (-2.602796356578054085860353775504851660134124890968895 + + 9.424777960769379715387930149838508652591508198125317i)) > + __CZ__eps) { + epsilon(eps); + return 2; + } + if (abs + (lngamma(-3.400) - + (-1.121191815653838606981937409307733431762519256939740 + + 12.566370614359172953850573533118011536788677597500423i)) > + __CZ__eps) { + epsilon(eps); + return 3; + } + if (abs + (lngamma(-2.400) - + (0.1025836159682770986668378753392054643000824013774864 + + 3.1415926535897932384626433832795028841971693993751058i)) > + __CZ__eps) { + epsilon(eps); + return 4; + } + if (abs + (lngamma(-1.400) - + (0.9780523533221770342957880219518966655729718736522287 + + 6.2831853071795864769252867665590057683943387987502116i)) > + __CZ__eps) { + epsilon(eps); + return 5; + } + if (abs + (lngamma(-0.4000) - + (1.3145245899433899648003814321688887556844552489655721 - + 3.1415926535897932384626433832795028841971693993751058i)) > + __CZ__eps) { + epsilon(eps); + return 6; + } + if (abs + (lngamma(0.6000) - + (0.3982338580692348996168542204008776842343540290573096)) > + __CZ__eps) { + epsilon(eps); + return 7; + } + if (abs + (lngamma(1.600) - + (-0.112591765696755783588659875902784250643756767388458)) > + __CZ__eps) { + epsilon(eps); + return 8; + } + if (abs + (lngamma(2.600) - + (0.3574118635489797700622771552455578140571422814237894)) > + __CZ__eps) { + epsilon(eps); + return 9; + } + if (abs + (lngamma(3.600) - + (1.3129233085764161315150052635846887793368088719154788)) > + __CZ__eps) { + epsilon(eps); + return 10; + } + if (abs + (lngamma(4.600) - + (2.5938571540384804491219685256617291171816887676527152)) > + __CZ__eps) { + epsilon(eps); + return 11; + } + if (abs + (lngamma(5.600) - + (4.1199134575335297653279620242457375960984677282246333)) > + __CZ__eps) { + epsilon(eps); + return 12; + } + if (abs + (lngamma(55.60) - + (166.72233170723938827069082693550384745200937091660266)) > + __CZ__eps) { + epsilon(eps); + return 13; + } + if (abs + (lngamma(56.60) - + (170.74051490849592496269608464261138016300186635704956)) > + __CZ__eps) { + epsilon(eps); + return 14; + } + if (abs + (lngamma(57.60) - + (174.77652389370506221274131245618033272827669850568250)) > + __CZ__eps) { + epsilon(eps); + return 15; + } + if (abs + (lngamma(58.60) - + (178.83004646140690776801720420409007933842357893886075)) > + __CZ__eps) { + epsilon(eps); + return 16; + } + if (abs + (lngamma(59.60) - + (182.90078115798987469935628513367638988912775224248394)) > + __CZ__eps) { + epsilon(eps); + return 17; + } + if (abs + (lngamma(60.60) - + (186.98843673206117877516518619701249930553373579376865)) > + __CZ__eps) { + epsilon(eps); + return 18; + } + if (abs + (lngamma(61.60) - + (191.09273162513644754284387036762182652754650758452049)) > + __CZ__eps) { + epsilon(eps); + return 19; + } + if (abs + (lngamma(62.60) - + (195.21339349567592163624487159872030105363069808249176)) > + __CZ__eps) { + epsilon(eps); + return 20; + } + if (abs + (lngamma(63.60) - + (199.35015877378197447832287757475132376767819599656051)) > + __CZ__eps) { + epsilon(eps); + return 21; + } + if (abs + (lngamma(64.60) - + (203.50277224412805093867906473893489617123556308738621)) > + __CZ__eps) { + epsilon(eps); + return 22; + } + if (abs + (lngamma(65.60) - + (207.67098665491660710433686745546968860453554400700257)) > + __CZ__eps) { + epsilon(eps); + return 23; + } + if (abs + (lngamma(-4.400 + 0.3000i) - + (-3.012170168780542935643977654089900903230224118194902 - + 14.995647773931851220184151830452947610096345479769497i)) > + __CZ__eps) { + epsilon(eps); + return 24; + } + if (abs + (lngamma(-3.400 + 0.3000i) - + (-1.528246633748315285937279325345084965509129720585190 - + 11.922131578600057457117323569444702920656889937242177i)) > + __CZ__eps) { + epsilon(eps); + return 25; + } + if (abs + (lngamma(-2.400 + 0.3000i) - + (-0.300593543742460500003778676081911614052942606849246 - + 8.8685462985380049870334027293206734277553648141421909i)) > + __CZ__eps) { + epsilon(eps); + return 26; + } + if (abs + (lngamma(-1.400 + 0.3000i) - + (0.5826272868794220627005984935520030051588811118590927 - + 5.8513086394949731836021141952050415691313656065368892i)) > + __CZ__eps) { + epsilon(eps); + return 27; + } + if (abs + (lngamma(-0.4000 + 0.3000i) - + (0.9415471834545804679163683919994364115087855350642294 - + 2.9208093191279264919817355540741378979796654077163755i)) > + __CZ__eps) { + epsilon(eps); + return 28; + } + if (abs + (lngamma(0.6000 + 0.3000i) - + (0.2484000028946351584991362705412598434332854007039741 - + 0.4227177743314176403219013995119576518240065994565821i)) > + __CZ__eps) { + epsilon(eps); + return 29; + } + if (abs + (lngamma(1.600 + 0.3000i) - + (-0.150853845214250646823230280607484839757524852967790 + + 0.0409298346693884758923548319492567502045304548295381i)) > + __CZ__eps) { + epsilon(eps); + return 30; + } + if (abs + (lngamma(2.600 + 0.3000i) - + (0.3364259747848147735313925008357736575841632119933041 + + 0.2262777846650832407783807931778013947197968935401072i)) > + __CZ__eps) { + epsilon(eps); + return 31; + } + if (abs + (lngamma(3.600 + 0.3000i) - + (1.2985503009218817344713757767544359650274299875210727 + + 0.3411543900819823748030570769218348455327276444896884i)) > + __CZ__eps) { + epsilon(eps); + return 32; + } + if (abs + (lngamma(4.600 + 0.3000i) - + (2.582944367806232942740645241786647084583876190810680103 + + 0.4242956219704236047137253915726161430638589851177078492i)) > + __CZ__eps) { + epsilon(eps); + return 33; + } + if (abs + (lngamma(5.600 + 0.3000i) - + (4.111122815491445860748560095878127604065278239877556104 + + 0.4894207853048094882972548755277837179650295466696997973i)) > + __CZ__eps) { + epsilon(eps); + return 34; + } + if (abs + (lngamma(0.6000 - 4.700i) - + (-6.309230474426685182917699027589840248465208901823736044 - + 2.738444603265429259406748249023722438146218314171151425i)) > + __CZ__eps) { + epsilon(eps); + return 35; + } + if (abs + (lngamma(0.6000 - 3.700i) - + (-4.762470602521331200619631143446813610218360030381255868 - + 1.307861859626688811743330143389568763790196226980935860i)) > + __CZ__eps) { + epsilon(eps); + return 36; + } + if (abs + (lngamma(0.6000 - 2.700i) - + (-3.223449159729432378435059551332376261824297133470481664 - + 0.1525473639596832094518944287785664759918133343972275457i)) > + __CZ__eps) { + epsilon(eps); + return 37; + } + if (abs + (lngamma(0.6000 - 1.700i) - + (-1.699851882736550416690203691424396333903393386464266356 + + 0.6188153536675997046951505463300498363352953733225308151i)) > + __CZ__eps) { + epsilon(eps); + return 38; + } + if (abs + (lngamma(0.6000 - 0.7000i) - + (-0.2316312495202586116986763277644377512618333134657045421 + + 0.7368909799768367142682353753277667339824288570492360448i)) > + __CZ__eps) { + epsilon(eps); + return 39; + } + if (abs + (lngamma(0.6000 + 0.3000i) - + (0.2484000028946351584991362705412598434332854007039741619 - + 0.4227177743314176403219013995119576518240065994565821579i)) > + __CZ__eps) { + epsilon(eps); + return 40; + } + if (abs + (lngamma(0.6000 + 1.300i) - + (-1.099689479936482253001126014071250387866864940802593030 - + 0.7725489931464399068598744386748572974573591452933440189i)) > + __CZ__eps) { + epsilon(eps); + return 41; + } + if (abs + (lngamma(0.6000 + 2.300i) - + (-2.611386294578008388513457987969729601048026532835562114 - + 0.2111094845860104400425314901146665256344806614559790152i)) > + __CZ__eps) { + epsilon(eps); + return 42; + } + if (abs + (lngamma(0.6000 + 3.300i) - + (-4.145670522984067490152016613422534092269675011415945298 + + 0.8081928951523762121254890981027647840025857144095024771i)) > + __CZ__eps) { + epsilon(eps); + return 43; + } + if (abs + (lngamma(0.6000 + 4.300i) - + (-5.689842576036527320491763306963824853139907301029281610 + + 2.137677242374957442527694027866746053575410791317320138i)) > + __CZ__eps) { + epsilon(eps); + return 44; + } + if (abs + (lngamma(0.6000 + 5.300i) - + (-7.239654605052715210182073623536904206104308839659326676 + + 3.702857758072432142072497796069521049678127217607403327i)) > + __CZ__eps) { + epsilon(eps); + return 45; + } + if (abs + (lngamma(-4.400 - 4.700i) - + (-14.73413592903136179653960750100174060012531669119348359 + + 7.340768981905845672138265648506833394433043135824981559i)) > + __CZ__eps) { + epsilon(eps); + return 46; + } + if (abs + (lngamma(-3.400 - 3.700i) - + (-10.55018529022399813119005433743831737900085357229525796 + + 6.763336971725381912118912702208512629733112628981673298i)) > + __CZ__eps) { + epsilon(eps); + return 47; + } + if (abs + (lngamma(-2.400 - 2.700i) - + (-6.624262018571684573249747079902924251345023570085621326 + + 5.911914743873792313808731773611192661709672638901754910i)) > + __CZ__eps) { + epsilon(eps); + return 48; + } + if (abs + (lngamma(-1.400 - 1.700i) - + (-3.046912030520906458689035477846643788289090086345259335 + + 4.680423062668151424886705499811285399248102868605621987i)) > + __CZ__eps) { + epsilon(eps); + return 49; + } + if (abs + (lngamma(-0.4000 - 0.7000i) - + (-0.01623979147403148300780826047582666582616647435129398527 + + 2.826833421018256285271011446520969788549353956082297248i)) > + __CZ__eps) { + epsilon(eps); + return 50; + } + if (abs + (lngamma(0.6000 + 0.3000i) - + (0.2484000028946351584991362705412598434332854007039741619 - + 0.4227177743314176403219013995119576518240065994565821579i)) > + __CZ__eps) { + epsilon(eps); + return 51; + } + if (abs + (lngamma(1.600 + 1.300i) - + (-0.7407695833613238477853561156238169815169605175974563292 + + 0.3658395580779188724109027663961707196451841638334886679i)) > + __CZ__eps) { + epsilon(eps); + return 52; + } + if (abs + (lngamma(2.600 + 2.300i) - + (-0.7153017561016750689453931991025219163388411460412682694 + + 2.067498782269003991801228117457494590355245722719424742i)) > + __CZ__eps) { + epsilon(eps); + return 53; + } + if (abs + (lngamma(3.600 + 3.300i) - + (-0.2006290139452759775010107586460283514303264993274887714 + + 4.221969149213679168621678150696738907045553787288427746i)) > + __CZ__eps) { + epsilon(eps); + return 54; + } + if (abs + (lngamma(4.600 + 4.300i) - + (0.6404767304085869581018213364351326853699331839312207180 + + 6.685149323469513776483323494807052342570441936959315816i)) > + __CZ__eps) { + epsilon(eps); + return 55; + } + if (abs + (lngamma(5.600 + 5.300i) - + (1.727112476786098959996727579157495580048033035060833670 + + 9.383383918093155327986445451264543368751338171298232916i)) > + __CZ__eps) { + epsilon(eps); + return 56; + } + if (abs + (lngamma(55.60 + 0.3000i) - + (166.7215150367733897769155930653789348483780044274716818 + + 1.202750513929718332820270669742686561426457642272968981i)) > + __CZ__eps) { + epsilon(eps); + return 57; + } + if (abs + (lngamma(56.60 + 0.3000i) - + (170.7397127945179968376917410624766834622909691036136375 + + 1.208146145021640303895693686064781770317635078049891748i)) > + __CZ__eps) { + epsilon(eps); + return 58; + } + if (abs + (lngamma(57.60 + 0.3000i) - + (174.7757358264026770962028712327193919190938819848539820 + + 1.213446448743774292811195505423481449339002192187714949i)) > + __CZ__eps) { + epsilon(eps); + return 59; + } + if (abs + (lngamma(58.60 + 0.3000i) - + (178.8292719572886165808686582437464130998008894472168186 + + 1.218654734982846161251085553080214761347285268088604785i)) > + __CZ__eps) { + epsilon(eps); + return 60; + } + if (abs + (lngamma(59.60 + 0.3000i) - + (182.9000197581041057641595126649840680882966589651420637 + + 1.223774144183534973445316592347337056808910609419286930i)) > + __CZ__eps) { + epsilon(eps); + return 61; + } + if (abs + (lngamma(60.60 + 0.3000i) - + (186.9876880003631981031020807195926428903734785341818284 + + 1.228807658719925269995511830298415601718771597558190350i)) > + __CZ__eps) { + epsilon(eps); + return 62; + } + if (abs + (lngamma(61.60 + 0.3000i) - + (191.0919951469889337316641602771633017764510692037723749 + + 1.233758113328768712483862353815791968059294457847368072i)) > + __CZ__eps) { + epsilon(eps); + return 63; + } + if (abs + (lngamma(62.60 + 0.3000i) - + (195.2126688764702481772276457650023207176714432948785485 + + 1.238628204695931980600482702688969918429374403006592554i)) > + __CZ__eps) { + epsilon(eps); + return 64; + } + if (abs + (lngamma(63.60 + 0.3000i) - + (199.3494456376687238313417632202369605922807314239672719 + + 1.243420500277190605198320894289870930154643596582155076i)) > + __CZ__eps) { + epsilon(eps); + return 65; + } + if (abs + (lngamma(64.60 + 0.3000i) - + (203.5020702328465376706204035728796350972376926574607893 + + 1.248137446425596312819515029227444652080011390838575181i)) > + __CZ__eps) { + epsilon(eps); + return 66; + } + if (abs + (lngamma(65.60 + 0.3000i) - + (207.6702954267142863859185793548246421433863939380928954 + + 1.252781375889819416329161991660565854615382764835522506i)) > + __CZ__eps) { + epsilon(eps); + return 67; + } + if (abs + (lngamma(55.60 - 4.700i) - + (166.5221258272035253961542734005976077004749775938844000 - + 18.84875483296568553194454925345602004591801239160222174i)) > + __CZ__eps) { + epsilon(eps); + return 68; + } + if (abs + (lngamma(56.60 - 3.700i) - + (170.6185921690853207517443064939778892985245375960964842 - + 14.90313021223193465377855573208445845565931668639004077i)) > + __CZ__eps) { + epsilon(eps); + return 69; + } + if (abs + (lngamma(57.60 - 2.700i) - + (174.7127139121008307648437631979262499901446251937177073 - + 10.92201102864604767334040466047947450750373806537116051i)) > + __CZ__eps) { + epsilon(eps); + return 70; + } + if (abs + (lngamma(58.60 - 1.700i) - + (178.8051797102056562439362100160978710660289490095968327 - + 6.905945104548951236229262516275118301863000955218208856i)) > + __CZ__eps) { + epsilon(eps); + return 71; + } + if (abs + (lngamma(59.60 - 0.7000i) - + (182.8966358377199778625865269072085032936485484956150669 - + 2.855486362253577342667404413778192112579790386732841204i)) > + __CZ__eps) { + epsilon(eps); + return 72; + } + if (abs + (lngamma(60.60 + 0.3000i) - + (186.9876880003631981031020807195926428903734785341818284 + + 1.228807658719925269995511830298415601718771597558190350i)) > + __CZ__eps) { + epsilon(eps); + return 73; + } + if (abs + (lngamma(61.60 + 1.300i) - + (191.0789031896982469942903294770974306494712752019213395 + + 5.346377998474074192830409565498522421021695288142347615i)) > + __CZ__eps) { + epsilon(eps); + return 74; + } + if (abs + (lngamma(62.60 + 2.300i) - + (195.1708115544608858783580589279983618518227865792619427 + + 9.496666208022148051357709844128014322980249562957453155i)) > + __CZ__eps) { + epsilon(eps); + return 75; + } + if (abs + (lngamma(63.60 + 3.300i) - + (199.2639082667972359747356775354901044881033064193665592 + + 13.67911603585439751926438073480939520547347569839795064i)) > + __CZ__eps) { + epsilon(eps); + return 76; + } + if (abs + (lngamma(64.60 + 4.300i) - + (203.3586553654963869814883298543618854726441450377694569 + + 17.89317489050227754715433149549722038188972541358048335i)) > + __CZ__eps) { + epsilon(eps); + return 77; + } + if (abs + (lngamma(65.60 + 5.300i) - + (207.4554835618873492047512087924156663776620358356581503 + + 22.13829509931977678201875089030163451926720764548437834i)) > + __CZ__eps) { + epsilon(eps); + return 78; + } + if (abs + (lngamma(0.6000 + 55.30i) - + (-85.54482235577983941284251852323648610691188392673393393 + + 166.7640845362830899082977628513038941147191508645382670i)) > + __CZ__eps) { + epsilon(eps); + return 79; + } + if (abs + (lngamma(0.6000 + 56.30i) - + (-87.11382647385499402990266927218873826677912515510914330 + + 170.7858332456548897964755419202916477033408200711519690i)) > + __CZ__eps) { + epsilon(eps); + return 80; + } + if (abs + (lngamma(0.6000 + 57.30i) - + (-88.68286214812485690627962462529848906043953388486922638 + + 174.8253452895478184840703539752269094932785103410249518i)) > + __CZ__eps) { + epsilon(eps); + return 81; + } + if (abs + (lngamma(0.6000 + 58.30i) - + (-90.25192828651651583800480958344256221682554088740576313 + + 178.8823106163841131771861511088137077830986146286084489i)) > + __CZ__eps) { + epsilon(eps); + return 82; + } + if (abs + (lngamma(0.6000 + 59.30i) - + (-91.82102385268587759734139136217993540696936010920994984 + + 182.9564298132977973838333574465352695792546867284831679i)) > + __CZ__eps) { + epsilon(eps); + return 83; + } + if (abs + (lngamma(0.6000 + 60.30i) - + (-93.39014786228910598458529398231928177449383105033168028 + + 187.0474135677690289293542062291360648608774972285628443i)) > + __CZ__eps) { + epsilon(eps); + return 84; + } + if (abs + (lngamma(0.6000 + 61.30i) - + (-94.95929937956076993888890535139227785932447324700640489 + + 191.1549821649831349987910547767822679603735412036380108i)) > + __CZ__eps) { + epsilon(eps); + return 85; + } + if (abs + (lngamma(0.6000 + 62.30i) - + (-96.52847751416891464599424930795884732518087496093651555 + + 195.2788650179992458972186470030422322640959550214072444i)) > + __CZ__eps) { + epsilon(eps); + return 86; + } + if (abs + (lngamma(0.6000 + 63.30i) - + (-98.09768141832058996231194071903760307280235519603364210 + + 199.4188002280943140128727971292337826315387363387763786i)) > + __CZ__eps) { + epsilon(eps); + return 87; + } + if (abs + (lngamma(0.6000 + 64.30i) - + (-99.66691028409427522125385963825011409754630863598190917 + + 203.5745341728981030650825963445356527935331129342248469i)) > + __CZ__eps) { + epsilon(eps); + return 88; + } + if (abs + (lngamma(0.6000 + 65.30i) - + (-101.2361633409781854893699037629524761308029390440175099 + + 207.7458211201573236805249632667291754315339341665724958i)) > + __CZ__eps) { + epsilon(eps); + return 89; + } + if (abs + (lngamma(55.60 + 60.30i) - + (138.3405218869058217717201182836422027677382184890964165 + + 250.9485307086751713133102893231808151265549690071705472i)) > + __CZ__eps) { + epsilon(eps); + return 90; + } + if (abs + (lngamma(56.60 + 60.30i) - + (142.7474976121018701984157500679190442966110797769323173 + + 251.7744588650459198825346353772080509751313819470548658i)) > + __CZ__eps) { + epsilon(eps); + return 91; + } + if (abs + (lngamma(57.60 + 60.30i) - + (147.1627435319602425515209166358781832064023544924212637 + + 252.5914974493805839443768868968642526869013797892608722i)) > + __CZ__eps) { + epsilon(eps); + return 92; + } + if (abs + (lngamma(58.60 + 60.30i) - + (151.5862689029682042031606617640450220740985775964639233 + + 253.3997923739994162421416717294147634900873392644324912i)) > + __CZ__eps) { + epsilon(eps); + return 93; + } + if (abs + (lngamma(59.60 + 60.30i) - + (156.0180803184689022095120622630277425180433295653817951 + + 254.1994872924291535134537002289372877256760561545266240i)) > + __CZ__eps) { + epsilon(eps); + return 94; + } + if (abs + (lngamma(60.60 + 60.30i) - + (160.4581818322128207752571131620498333645831099884594593 + + 254.9907235879958949246830907372060458378867915677707498i)) > + __CZ__eps) { + epsilon(eps); + return 95; + } + if (abs + (lngamma(61.60 + 60.30i) - + (164.9065750781912363906196189745577497508505165621357938 + + 255.7736403669080425654455012237246051402306640891736322i)) > + __CZ__eps) { + epsilon(eps); + return 96; + } + if (abs + (lngamma(62.60 + 60.30i) - + (169.3632593867220799863942253592790131010186217605278241 + + 256.5483744554910528044048617005478717965073680654042053i)) > + __CZ__eps) { + epsilon(eps); + return 97; + } + if (abs + (lngamma(63.60 + 60.30i) - + (173.8282318967764198928263540479369804154959334380883398 + + 257.3150604012511380535676929646281795055983167823336193i)) > + __CZ__eps) { + epsilon(eps); + return 98; + } + if (abs + (lngamma(64.60 + 60.30i) - + (178.3014876645497005489995740718100489155558324227755847 + + 258.0738304774605436591436026066009539042787457216911291i)) > + __CZ__eps) { + epsilon(eps); + return 99; + } + if (abs + (lngamma(65.60 + 60.30i) - + (182.7830197682960267239662260557525833694506977039319737 + + 258.8248146909724805417993325211754807069936951454932977i)) > + __CZ__eps) { + epsilon(eps); + return 100; + } + if (abs + (lngamma(55.60 + 55.30i) - + (142.3862162791589253462657451176275726003857264651343509 + + 229.0474972316203435288188174128389032017308276896396827i)) > + __CZ__eps) { + epsilon(eps); + return 101; + } + if (abs + (lngamma(56.60 + 56.30i) - + (145.9655713474689753168556009847734887663033552824290632 + + 234.2012259525622513896404861908422505950646506577988340i)) > + __CZ__eps) { + epsilon(eps); + return 102; + } + if (abs + (lngamma(57.60 + 57.30i) - + (149.5627523253413003508200851967083007076485608754907532 + + 239.3727177204530395107173394215426561501560159557014103i)) > + __CZ__eps) { + epsilon(eps); + return 103; + } + if (abs + (lngamma(58.60 + 58.30i) - + (153.1774470047839472501216057736005131302626263510371392 + + 244.5616624984797644536433102063654140139237547865421532i)) > + __CZ__eps) { + epsilon(eps); + return 104; + } + if (abs + (lngamma(59.60 + 59.30i) - + (156.8093539260984043245770025957276995010069796775703177 + + 249.7677608875474964335171539461488545902215228674008981i)) > + __CZ__eps) { + epsilon(eps); + return 105; + } + if (abs + (lngamma(60.60 + 60.30i) - + (160.4581818322128207752571131620498333645831099884594593 + + 254.9907235879958949246830907372060458378867915677707498i)) > + __CZ__eps) { + epsilon(eps); + return 106; + } + if (abs + (lngamma(61.60 + 61.30i) - + (164.1236491593380218382957487779642572534385362007999916 + + 260.2302708970324395553848679531333038493595454481482560i)) > + __CZ__eps) { + epsilon(eps); + return 107; + } + if (abs + (lngamma(62.60 + 62.30i) - + (167.8054835609733823774016164868506426238263526697353479 + + 265.4861322389681286058365065491944749198017327500214219i)) > + __CZ__eps) { + epsilon(eps); + return 108; + } + if (abs + (lngamma(63.60 + 63.30i) - + (171.5034214625769205528980449555097665172285302158028025 + + 270.7580457256222186188843213325906832500862444373572311i)) > + __CZ__eps) { + epsilon(eps); + return 109; + } + if (abs + (lngamma(64.60 + 64.30i) - + (175.2172076444693933495200678808489471651335658562522069 + + 276.0457577445122795003295082894754935609216218032287116i)) > + __CZ__eps) { + epsilon(eps); + return 110; + } + if (abs + (lngamma(65.60 + 65.30i) - + (178.9465948507696967449494536146172974534191430062324139 + + 281.3490225726683461623186324992570909685317567794418009i)) > + __CZ__eps) { + epsilon(eps); + return 111; + } + if (abs + (lngamma(0.6000 + 4.700i) - + (-6.309230474426685182917699027589840248465208901823736044 + + 2.738444603265429259406748249023722438146218314171151425i)) > + __CZ__eps) { + epsilon(eps); + return 112; + } + if (abs + (lngamma(0.6000 + 3.700i) - + (-4.762470602521331200619631143446813610218360030381255868 + + 1.307861859626688811743330143389568763790196226980935860i)) > + __CZ__eps) { + epsilon(eps); + return 113; + } + if (abs + (lngamma(0.6000 + 2.700i) - + (-3.223449159729432378435059551332376261824297133470481664 + + 0.1525473639596832094518944287785664759918133343972275457i)) > + __CZ__eps) { + epsilon(eps); + return 114; + } + if (abs + (lngamma(0.6000 + 1.700i) - + (-1.699851882736550416690203691424396333903393386464266356 - + 0.6188153536675997046951505463300498363352953733225308151i)) > + __CZ__eps) { + epsilon(eps); + return 115; + } + if (abs + (lngamma(0.6000 + 0.7000i) - + (-0.2316312495202586116986763277644377512618333134657045421 - + 0.7368909799768367142682353753277667339824288570492360448i)) > + __CZ__eps) { + epsilon(eps); + return 116; + } + if (abs + (lngamma(0.6000 - 0.3000i) - + (0.2484000028946351584991362705412598434332854007039741619 + + 0.4227177743314176403219013995119576518240065994565821579i)) > + __CZ__eps) { + epsilon(eps); + return 117; + } + if (abs + (lngamma(0.6000 - 1.300i) - + (-1.099689479936482253001126014071250387866864940802593030 + + 0.7725489931464399068598744386748572974573591452933440189i)) > + __CZ__eps) { + epsilon(eps); + return 118; + } + if (abs + (lngamma(0.6000 - 2.300i) - + (-2.611386294578008388513457987969729601048026532835562114 + + 0.2111094845860104400425314901146665256344806614559790152i)) > + __CZ__eps) { + epsilon(eps); + return 119; + } + if (abs + (lngamma(0.6000 - 3.300i) - + (-4.145670522984067490152016613422534092269675011415945298 - + 0.8081928951523762121254890981027647840025857144095024771i)) > + __CZ__eps) { + epsilon(eps); + return 120; + } + if (abs + (lngamma(0.6000 - 4.300i) - + (-5.689842576036527320491763306963824853139907301029281610 - + 2.137677242374957442527694027866746053575410791317320138i)) > + __CZ__eps) { + epsilon(eps); + return 121; + } + if (abs + (lngamma(0.6000 - 5.300i) - + (-7.239654605052715210182073623536904206104308839659326676 - + 3.702857758072432142072497796069521049678127217607403327i)) > + __CZ__eps) { + epsilon(eps); + return 122; + } + if (abs + (lngamma(-4.400 + 4.700i) - + (-14.73413592903136179653960750100174060012531669119348359 - + 7.340768981905845672138265648506833394433043135824981559i)) > + __CZ__eps) { + epsilon(eps); + return 123; + } + if (abs + (lngamma(-3.400 + 3.700i) - + (-10.55018529022399813119005433743831737900085357229525796 - + 6.763336971725381912118912702208512629733112628981673298i)) > + __CZ__eps) { + epsilon(eps); + return 124; + } + if (abs + (lngamma(-2.400 + 2.700i) - + (-6.624262018571684573249747079902924251345023570085621326 - + 5.911914743873792313808731773611192661709672638901754910i)) > + __CZ__eps) { + epsilon(eps); + return 125; + } + if (abs + (lngamma(-1.400 + 1.700i) - + (-3.046912030520906458689035477846643788289090086345259335 - + 4.680423062668151424886705499811285399248102868605621987i)) > + __CZ__eps) { + epsilon(eps); + return 126; + } + if (abs + (lngamma(-0.4000 + 0.7000i) - + (-0.01623979147403148300780826047582666582616647435129398527 - + 2.826833421018256285271011446520969788549353956082297248i)) > + __CZ__eps) { + epsilon(eps); + return 127; + } + if (abs + (lngamma(0.6000 - 0.3000i) - + (0.2484000028946351584991362705412598434332854007039741619 + + 0.4227177743314176403219013995119576518240065994565821579i)) > + __CZ__eps) { + epsilon(eps); + return 128; + } + if (abs + (lngamma(1.600 - 1.300i) - + (-0.7407695833613238477853561156238169815169605175974563292 - + 0.3658395580779188724109027663961707196451841638334886679i)) > + __CZ__eps) { + epsilon(eps); + return 129; + } + if (abs + (lngamma(2.600 - 2.300i) - + (-0.7153017561016750689453931991025219163388411460412682694 - + 2.067498782269003991801228117457494590355245722719424742i)) > + __CZ__eps) { + epsilon(eps); + return 130; + } + if (abs + (lngamma(3.600 - 3.300i) - + (-0.2006290139452759775010107586460283514303264993274887714 - + 4.221969149213679168621678150696738907045553787288427746i)) > + __CZ__eps) { + epsilon(eps); + return 131; + } + if (abs + (lngamma(4.600 - 4.300i) - + (0.6404767304085869581018213364351326853699331839312207180 - + 6.685149323469513776483323494807052342570441936959315816i)) > + __CZ__eps) { + epsilon(eps); + return 132; + } + if (abs + (lngamma(5.600 - 5.300i) - + (1.727112476786098959996727579157495580048033035060833670 - + 9.383383918093155327986445451264543368751338171298232916i)) > + __CZ__eps) { + epsilon(eps); + return 133; + } + if (abs + (lngamma(55.60 - 0.3000i) - + (166.7215150367733897769155930653789348483780044274716818 - + 1.202750513929718332820270669742686561426457642272968981i)) > + __CZ__eps) { + epsilon(eps); + return 134; + } + if (abs + (lngamma(56.60 - 0.3000i) - + (170.7397127945179968376917410624766834622909691036136375 - + 1.208146145021640303895693686064781770317635078049891748i)) > + __CZ__eps) { + epsilon(eps); + return 135; + } + if (abs + (lngamma(57.60 - 0.3000i) - + (174.7757358264026770962028712327193919190938819848539820 - + 1.213446448743774292811195505423481449339002192187714949i)) > + __CZ__eps) { + epsilon(eps); + return 136; + } + if (abs + (lngamma(58.60 - 0.3000i) - + (178.8292719572886165808686582437464130998008894472168186 - + 1.218654734982846161251085553080214761347285268088604785i)) > + __CZ__eps) { + epsilon(eps); + return 137; + } + if (abs + (lngamma(59.60 - 0.3000i) - + (182.9000197581041057641595126649840680882966589651420637 - + 1.223774144183534973445316592347337056808910609419286930i)) > + __CZ__eps) { + epsilon(eps); + return 138; + } + if (abs + (lngamma(60.60 - 0.3000i) - + (186.9876880003631981031020807195926428903734785341818284 - + 1.228807658719925269995511830298415601718771597558190350i)) > + __CZ__eps) { + epsilon(eps); + return 139; + } + if (abs + (lngamma(61.60 - 0.3000i) - + (191.0919951469889337316641602771633017764510692037723749 - + 1.233758113328768712483862353815791968059294457847368072i)) > + __CZ__eps) { + epsilon(eps); + return 140; + } + if (abs + (lngamma(62.60 - 0.3000i) - + (195.2126688764702481772276457650023207176714432948785485 - + 1.238628204695931980600482702688969918429374403006592554i)) > + __CZ__eps) { + epsilon(eps); + return 141; + } + if (abs + (lngamma(63.60 - 0.3000i) - + (199.3494456376687238313417632202369605922807314239672719 - + 1.243420500277190605198320894289870930154643596582155076i)) > + __CZ__eps) { + epsilon(eps); + return 142; + } + if (abs + (lngamma(64.60 - 0.3000i) - + (203.5020702328465376706204035728796350972376926574607893 - + 1.248137446425596312819515029227444652080011390838575181i)) > + __CZ__eps) { + epsilon(eps); + return 143; + } + if (abs + (lngamma(65.60 - 0.3000i) - + (207.6702954267142863859185793548246421433863939380928954 - + 1.252781375889819416329161991660565854615382764835522506i)) > + __CZ__eps) { + epsilon(eps); + return 144; + } + if (abs + (lngamma(55.60 - 4.700i) - + (166.5221258272035253961542734005976077004749775938844000 - + 18.84875483296568553194454925345602004591801239160222174i)) > + __CZ__eps) { + epsilon(eps); + return 145; + } + if (abs + (lngamma(56.60 - 3.700i) - + (170.6185921690853207517443064939778892985245375960964842 - + 14.90313021223193465377855573208445845565931668639004077i)) > + __CZ__eps) { + epsilon(eps); + return 146; + } + if (abs + (lngamma(57.60 - 2.700i) - + (174.7127139121008307648437631979262499901446251937177073 - + 10.92201102864604767334040466047947450750373806537116051i)) > + __CZ__eps) { + epsilon(eps); + return 147; + } + if (abs + (lngamma(58.60 - 1.700i) - + (178.8051797102056562439362100160978710660289490095968327 - + 6.905945104548951236229262516275118301863000955218208856i)) > + __CZ__eps) { + epsilon(eps); + return 148; + } + if (abs + (lngamma(59.60 - 0.7000i) - + (182.8966358377199778625865269072085032936485484956150669 - + 2.855486362253577342667404413778192112579790386732841204i)) > + __CZ__eps) { + epsilon(eps); + return 149; + } + if (abs + (lngamma(60.60 + 0.3000i) - + (186.9876880003631981031020807195926428903734785341818284 + + 1.228807658719925269995511830298415601718771597558190350i)) > + __CZ__eps) { + epsilon(eps); + return 150; + } + if (abs + (lngamma(61.60 + 1.300i) - + (191.0789031896982469942903294770974306494712752019213395 + + 5.346377998474074192830409565498522421021695288142347615i)) > + __CZ__eps) { + epsilon(eps); + return 151; + } + if (abs + (lngamma(62.60 + 2.300i) - + (195.1708115544608858783580589279983618518227865792619427 + + 9.496666208022148051357709844128014322980249562957453155i)) > + __CZ__eps) { + epsilon(eps); + return 152; + } + if (abs + (lngamma(63.60 + 3.300i) - + (199.2639082667972359747356775354901044881033064193665592 + + 13.67911603585439751926438073480939520547347569839795064i)) > + __CZ__eps) { + epsilon(eps); + return 153; + } + if (abs + (lngamma(64.60 + 4.300i) - + (203.3586553654963869814883298543618854726441450377694569 + + 17.89317489050227754715433149549722038188972541358048335i)) > + __CZ__eps) { + epsilon(eps); + return 154; + } + if (abs + (lngamma(65.60 + 5.300i) - + (207.4554835618873492047512087924156663776620358356581503 + + 22.13829509931977678201875089030163451926720764548437834i)) > + __CZ__eps) { + epsilon(eps); + return 155; + } + if (abs + (lngamma(0.6000 - 55.30i) - + (-85.54482235577983941284251852323648610691188392673393393 - + 166.7640845362830899082977628513038941147191508645382670i)) > + __CZ__eps) { + epsilon(eps); + return 156; + } + if (abs + (lngamma(0.6000 - 56.30i) - + (-87.11382647385499402990266927218873826677912515510914330 - + 170.7858332456548897964755419202916477033408200711519690i)) > + __CZ__eps) { + epsilon(eps); + return 157; + } + if (abs + (lngamma(0.6000 - 57.30i) - + (-88.68286214812485690627962462529848906043953388486922638 - + 174.8253452895478184840703539752269094932785103410249518i)) > + __CZ__eps) { + epsilon(eps); + return 158; + } + if (abs + (lngamma(0.6000 - 58.30i) - + (-90.25192828651651583800480958344256221682554088740576313 - + 178.8823106163841131771861511088137077830986146286084489i)) > + __CZ__eps) { + epsilon(eps); + return 159; + } + if (abs + (lngamma(0.6000 - 59.30i) - + (-91.82102385268587759734139136217993540696936010920994984 - + 182.9564298132977973838333574465352695792546867284831679i)) > + __CZ__eps) { + epsilon(eps); + return 160; + } + if (abs + (lngamma(0.6000 - 60.30i) - + (-93.39014786228910598458529398231928177449383105033168028 - + 187.0474135677690289293542062291360648608774972285628443i)) > + __CZ__eps) { + epsilon(eps); + return 161; + } + if (abs + (lngamma(0.6000 - 61.30i) - + (-94.95929937956076993888890535139227785932447324700640489 - + 191.1549821649831349987910547767822679603735412036380108i)) > + __CZ__eps) { + epsilon(eps); + return 162; + } + if (abs + (lngamma(0.6000 - 62.30i) - + (-96.52847751416891464599424930795884732518087496093651555 - + 195.2788650179992458972186470030422322640959550214072444i)) > + __CZ__eps) { + epsilon(eps); + return 163; + } + if (abs + (lngamma(0.6000 - 63.30i) - + (-98.09768141832058996231194071903760307280235519603364210 - + 199.4188002280943140128727971292337826315387363387763786i)) > + __CZ__eps) { + epsilon(eps); + return 164; + } + if (abs + (lngamma(0.6000 - 64.30i) - + (-99.66691028409427522125385963825011409754630863598190917 - + 203.5745341728981030650825963445356527935331129342248469i)) > + __CZ__eps) { + epsilon(eps); + return 165; + } + if (abs + (lngamma(0.6000 - 65.30i) - + (-101.2361633409781854893699037629524761308029390440175099 - + 207.7458211201573236805249632667291754315339341665724958i)) > + __CZ__eps) { + epsilon(eps); + return 166; + } + if (abs + (lngamma(55.60 - 60.30i) - + (138.3405218869058217717201182836422027677382184890964165 - + 250.9485307086751713133102893231808151265549690071705472i)) > + __CZ__eps) { + epsilon(eps); + return 167; + } + if (abs + (lngamma(56.60 - 60.30i) - + (142.7474976121018701984157500679190442966110797769323173 - + 251.7744588650459198825346353772080509751313819470548658i)) > + __CZ__eps) { + epsilon(eps); + return 168; + } + if (abs + (lngamma(57.60 - 60.30i) - + (147.1627435319602425515209166358781832064023544924212637 - + 252.5914974493805839443768868968642526869013797892608722i)) > + __CZ__eps) { + epsilon(eps); + return 169; + } + if (abs + (lngamma(58.60 - 60.30i) - + (151.5862689029682042031606617640450220740985775964639233 - + 253.3997923739994162421416717294147634900873392644324912i)) > + __CZ__eps) { + epsilon(eps); + return 170; + } + if (abs + (lngamma(59.60 - 60.30i) - + (156.0180803184689022095120622630277425180433295653817951 - + 254.1994872924291535134537002289372877256760561545266240i)) > + __CZ__eps) { + epsilon(eps); + return 171; + } + if (abs + (lngamma(60.60 - 60.30i) - + (160.4581818322128207752571131620498333645831099884594593 - + 254.9907235879958949246830907372060458378867915677707498i)) > + __CZ__eps) { + epsilon(eps); + return 172; + } + if (abs + (lngamma(61.60 - 60.30i) - + (164.9065750781912363906196189745577497508505165621357938 - + 255.7736403669080425654455012237246051402306640891736322i)) > + __CZ__eps) { + epsilon(eps); + return 173; + } + if (abs + (lngamma(62.60 - 60.30i) - + (169.3632593867220799863942253592790131010186217605278241 - + 256.5483744554910528044048617005478717965073680654042053i)) > + __CZ__eps) { + epsilon(eps); + return 174; + } + if (abs + (lngamma(63.60 - 60.30i) - + (173.8282318967764198928263540479369804154959334380883398 - + 257.3150604012511380535676929646281795055983167823336193i)) > + __CZ__eps) { + epsilon(eps); + return 175; + } + if (abs + (lngamma(64.60 - 60.30i) - + (178.3014876645497005489995740718100489155558324227755847 - + 258.0738304774605436591436026066009539042787457216911291i)) > + __CZ__eps) { + epsilon(eps); + return 176; + } + if (abs + (lngamma(65.60 - 60.30i) - + (182.7830197682960267239662260557525833694506977039319737 - + 258.8248146909724805417993325211754807069936951454932977i)) > + __CZ__eps) { + epsilon(eps); + return 177; + } + if (abs + (lngamma(55.60 - 55.30i) - + (142.3862162791589253462657451176275726003857264651343509 - + 229.0474972316203435288188174128389032017308276896396827i)) > + __CZ__eps) { + epsilon(eps); + return 178; + } + if (abs + (lngamma(56.60 - 56.30i) - + (145.9655713474689753168556009847734887663033552824290632 - + 234.2012259525622513896404861908422505950646506577988340i)) > + __CZ__eps) { + epsilon(eps); + return 179; + } + if (abs + (lngamma(57.60 - 57.30i) - + (149.5627523253413003508200851967083007076485608754907532 - + 239.3727177204530395107173394215426561501560159557014103i)) > + __CZ__eps) { + epsilon(eps); + return 180; + } + if (abs + (lngamma(58.60 - 58.30i) - + (153.1774470047839472501216057736005131302626263510371392 - + 244.5616624984797644536433102063654140139237547865421532i)) > + __CZ__eps) { + epsilon(eps); + return 181; + } + if (abs + (lngamma(59.60 - 59.30i) - + (156.8093539260984043245770025957276995010069796775703177 - + 249.7677608875474964335171539461488545902215228674008981i)) > + __CZ__eps) { + epsilon(eps); + return 182; + } + if (abs + (lngamma(60.60 - 60.30i) - + (160.4581818322128207752571131620498333645831099884594593 - + 254.9907235879958949246830907372060458378867915677707498i)) > + __CZ__eps) { + epsilon(eps); + return 183; + } + if (abs + (lngamma(61.60 - 61.30i) - + (164.1236491593380218382957487779642572534385362007999916 - + 260.2302708970324395553848679531333038493595454481482560i)) > + __CZ__eps) { + epsilon(eps); + return 184; + } + if (abs + (lngamma(62.60 - 62.30i) - + (167.8054835609733823774016164868506426238263526697353479 - + 265.4861322389681286058365065491944749198017327500214219i)) > + __CZ__eps) { + epsilon(eps); + return 185; + } + if (abs + (lngamma(63.60 - 63.30i) - + (171.5034214625769205528980449555097665172285302158028025 - + 270.7580457256222186188843213325906832500862444373572311i)) > + __CZ__eps) { + epsilon(eps); + return 186; + } + if (abs + (lngamma(64.60 - 64.30i) - + (175.2172076444693933495200678808489471651335658562522069 - + 276.0457577445122795003295082894754935609216218032287116i)) > + __CZ__eps) { + epsilon(eps); + return 187; + } + if (abs + (lngamma(65.60 - 65.30i) - + (178.9465948507696967449494536146172974534191430062324139 - + 281.3490225726683461623186324992570909685317567794418009i)) > + __CZ__eps) { + epsilon(eps); + return 188; + } + + /* a large integer */ + + if (abs(lngamma(10 ^ 2 + 1) - (ln((10 ^ 2) !))) > __CZ__eps) { + epsilon(eps); + return 189; + } - if(!iserror(lngamma( -5 ))){ epsilon(eps); - return 1; - } + if (isnull(type)) + t02(1); -if(abs(lngamma(-4.400)-(-2.602796356578054085860353775504851660134124890968895310513467506473714622544820472104292219110230249 + 9.424777960769379715387930149838508652591508198125317462924833776923449218858626995884104476026351204i))>__CZ__eps){epsilon(eps);return 2;} -if(abs(lngamma(-3.400)-(-1.121191815653838606981937409307733431762519256939740603086867679323926364369546808053508062204356381 + 12.56637061435917295385057353311801153678867759750042328389977836923126562514483599451213930136846827i))>__CZ__eps){epsilon(eps);return 3;} -if(abs(lngamma(-2.400)-(0.1025836159682770986668378753392054643000824013774864622977221670841872237237267082284529277399669559 + 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117068i))>__CZ__eps){epsilon(eps);return 4;} -if(abs(lngamma(-1.400)-(0.9780523533221770342957880219518966655729718736522287003611286282342897731740673416836614584533568090 + 6.283185307179586476925286766559005768394338798750211641949889184615632812572417997256069650684234136i))>__CZ__eps){epsilon(eps);return 5;} -if(abs(lngamma(-0.4000)-(1.314524589943389964800381432168888755684455248965572166907870886697690648218478844841186078948048725 - 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117068i))>__CZ__eps){epsilon(eps);return 6;} -if(abs(lngamma(0.6000)-(0.3982338580692348996168542204008776842343540290573096991159030047169052824805157958169155278512878019))>__CZ__eps){epsilon(eps);return 7;} -if(abs(lngamma(1.600)-(-0.1125917656967557835886598759027842506437567673884585710620505531197794120085330019396025954281597201))>__CZ__eps){epsilon(eps);return 8;} -if(abs(lngamma(2.600)-(0.3574118635489797700622771552455578140571422814237894693873415838862224661928933802478535074679167317))>__CZ__eps){epsilon(eps);return 9;} -if(abs(lngamma(3.600)-(1.312923308576416131515005263584688779336808871915478863893739203075508145809645795017294292815226610))>__CZ__eps){epsilon(eps);return 10;} -if(abs(lngamma(4.600)-(2.593857154038480449121968525661729117181688767652715299571159988369711366508900679740255251345929864))>__CZ__eps){epsilon(eps);return 11;} -if(abs(lngamma(5.600)-(4.119913457533529765327962024245737596098467728224633319657147474378525624786041213308522465405745068))>__CZ__eps){epsilon(eps);return 12;} -if(abs(lngamma(55.60)-(166.7223317072393882706908269355038474520093709166026699584513154552836509334829850057167659670012639))>__CZ__eps){epsilon(eps);return 13;} -if(abs(lngamma(56.60)-(170.7405149084959249626960846426113801630018663570495614063334260781461204332651070777194774772127133))>__CZ__eps){epsilon(eps);return 14;} -if(abs(lngamma(57.60)-(174.7765238937050622127413124561803327282766985056825002949575310911332447187196730943026770843388737))>__CZ__eps){epsilon(eps);return 15;} -if(abs(lngamma(58.60)-(178.8300464614069077680172042040900793384235789388607577471176719144010224272977068414490913508552517))>__CZ__eps){epsilon(eps);return 16;} -if(abs(lngamma(59.60)-(182.9007811579898746993562851336763898891277522424839489727522724518580350673446123920541122890199408))>__CZ__eps){epsilon(eps);return 17;} -if(abs(lngamma(60.60)-(186.9884367320611787751651861970124993055337357937686536527498446663842215358944473992957092336243941))>__CZ__eps){epsilon(eps);return 18;} -if(abs(lngamma(61.60)-(191.0927316251364475428438703676218265275465075845204901325031564702495487250077424730438712170869034))>__CZ__eps){epsilon(eps);return 19;} -if(abs(lngamma(62.60)-(195.2133934956759216362448715987203010536306980824917612825098264568303104679047801204881771995770675))>__CZ__eps){epsilon(eps);return 20;} -if(abs(lngamma(63.60)-(199.3501587737819744783228775747513237676781959965605134887455422103180944212479269262219348433842737))>__CZ__eps){epsilon(eps);return 21;} -if(abs(lngamma(64.60)-(203.5027722441280509386790647389348961712355630873862180757363981319928079826720627026059399915871661))>__CZ__eps){epsilon(eps);return 22;} -if(abs(lngamma(65.60)-(207.6709866549166071043368674554696886045355440070025739596589482148102142728295335076020593653472294))>__CZ__eps){epsilon(eps);return 23;} -if(abs(lngamma(-4.400 + 0.3000i)-(-3.012170168780542935643977654089900903230224118194902800776851727432284095641464658518601854851344898 - 14.99564777393185122018415183045294761009634547976949786064819095927447593149803400353030993001915991i))>__CZ__eps){epsilon(eps);return 24;} -if(abs(lngamma(-3.400 + 0.3000i)-(-1.528246633748315285937279325345084965509129720585190019314960293887747778837456936578769751560985664 - 11.92213157860005745711732356944470292065688993724217768645448047733482574053965183811067307157775230i))>__CZ__eps){epsilon(eps);return 25;} -if(abs(lngamma(-2.400 + 0.3000i)-(-0.3005935437424605000037786760819116140529426068492461805203781927935976448288181308985439318381596952 - 8.868546298538004987033402729320673427755364814142190988797063840212310735937181268214394292554900060i))>__CZ__eps){epsilon(eps);return 26;} -if(abs(lngamma(-1.400 + 0.3000i)-(0.5826272868794220627005984935520030051588811118590927143468349409451458662284723277539288886528086450 - 5.851308639494973183602114195205041569131365606536889257737233367020216597078539028210070061526136323i))>__CZ__eps){epsilon(eps);return 27;} -if(abs(lngamma(-0.4000 + 0.3000i)-(0.9415471834545804679163683919994364115087855350642294160794624408446520586077774828141571932957935576 - 2.920809319127926491981735554074137897979665407716375596072277390961511222457641860173214769101172656i))>__CZ__eps){epsilon(eps);return 28;} -if(abs(lngamma(0.6000 + 0.3000i)-(0.2484000028946351584991362705412598434332854007039741619587824313512584366380827672082938662993748700 - 0.4227177743314176403219013995119576518240065994565821579629389173672072909830539502579967884603383370i))>__CZ__eps){epsilon(eps);return 29;} -if(abs(lngamma(1.600 + 0.3000i)-(-0.1508538452142506468232302806074848397575248529677905013835271902417303859668318638390206449299015341 + 0.04092983466938847589235483194925675020453045482953810584799417135299057318268775504260349552454955558i))>__CZ__eps){epsilon(eps);return 30;} -if(abs(lngamma(2.600 + 0.3000i)-(0.3364259747848147735313925008357736575841632119933041850635335895367888151813894675073790612700505879 + 0.2262777846650832407783807931778013947197968935401072992199235544837899389522014207849355554882625959i))>__CZ__eps){epsilon(eps);return 31;} -if(abs(lngamma(3.600 + 0.3000i)-(1.298550300921881734471375776754435965027429987521072727511666654821378388789308042958948517595253549 + 0.3411543900819823748030570769218348455327276444896884230183971946457411721008725773217180753903992058i))>__CZ__eps){epsilon(eps);return 32;} -if(abs(lngamma(4.600 + 0.3000i)-(2.582944367806232942740645241786647084583876190810680103630192209049779956753319578558317563774905357 + 0.4242956219704236047137253915726161430638589851177078492530246610417385784376111802634549132794141632i))>__CZ__eps){epsilon(eps);return 33;} -if(abs(lngamma(5.600 + 0.3000i)-(4.111122815491445860748560095878127604065278239877556104114455014234622116537919385723568609843827948 + 0.4894207853048094882972548755277837179650295466696997973257275457157790873793738934257725102317212982i))>__CZ__eps){epsilon(eps);return 34;} -if(abs(lngamma(0.6000 - 4.700i)-(-6.309230474426685182917699027589840248465208901823736044071406089970016624762071282414477519533446805 - 2.738444603265429259406748249023722438146218314171151425663490122832827447160142404453785215790720172i))>__CZ__eps){epsilon(eps);return 35;} -if(abs(lngamma(0.6000 - 3.700i)-(-4.762470602521331200619631143446813610218360030381255868867915275850062167138589945759181147587314347 - 1.307861859626688811743330143389568763790196226980935860137256735840654999917008199152740741948205653i))>__CZ__eps){epsilon(eps);return 36;} -if(abs(lngamma(0.6000 - 2.700i)-(-3.223449159729432378435059551332376261824297133470481664344109285143389820463721600269079600439653415 - 0.1525473639596832094518944287785664759918133343972275457487506548230474276833315783298300402230230813i))>__CZ__eps){epsilon(eps);return 37;} -if(abs(lngamma(0.6000 - 1.700i)-(-1.699851882736550416690203691424396333903393386464266356507295865152155081643217138332174570080627273 + 0.6188153536675997046951505463300498363352953733225308151601485284481801957104097451434473124727600220i))>__CZ__eps){epsilon(eps);return 38;} -if(abs(lngamma(0.6000 - 0.7000i)-(-0.2316312495202586116986763277644377512618333134657045421405330360600955017822181674931032957595291466 + 0.7368909799768367142682353753277667339824288570492360448564102775206851329939159562896886641611904396i))>__CZ__eps){epsilon(eps);return 39;} -if(abs(lngamma(0.6000 + 0.3000i)-(0.2484000028946351584991362705412598434332854007039741619587824313512584366380827672082938662993748700 - 0.4227177743314176403219013995119576518240065994565821579629389173672072909830539502579967884603383370i))>__CZ__eps){epsilon(eps);return 40;} -if(abs(lngamma(0.6000 + 1.300i)-(-1.099689479936482253001126014071250387866864940802593030985946176338010292319634681754351711277201146 - 0.7725489931464399068598744386748572974573591452933440189885272843948051378865258815608409462651759038i))>__CZ__eps){epsilon(eps);return 41;} -if(abs(lngamma(0.6000 + 2.300i)-(-2.611386294578008388513457987969729601048026532835562114605241252682747719092183552611868952700620418 - 0.2111094845860104400425314901146665256344806614559790152507363455424499006701362134714576901668862615i))>__CZ__eps){epsilon(eps);return 42;} -if(abs(lngamma(0.6000 + 3.300i)-(-4.145670522984067490152016613422534092269675011415945298652917864316934507837553864106231837873639178 + 0.8081928951523762121254890981027647840025857144095024771821231809903327928035320700978580016020901134i))>__CZ__eps){epsilon(eps);return 43;} -if(abs(lngamma(0.6000 + 4.300i)-(-5.689842576036527320491763306963824853139907301029281610305682566179799260941238598307788211198739464 + 2.137677242374957442527694027866746053575410791317320138931932495148003411548291173248963052605469029i))>__CZ__eps){epsilon(eps);return 44;} -if(abs(lngamma(0.6000 + 5.300i)-(-7.239654605052715210182073623536904206104308839659326676113824586592039321903083835369930675115629685 + 3.702857758072432142072497796069521049678127217607403327232198098820227725661161561592679775128000025i))>__CZ__eps){epsilon(eps);return 45;} -if(abs(lngamma(-4.400 - 4.700i)-(-14.73413592903136179653960750100174060012531669119348359739188295824251395007186551726647596156181555 + 7.340768981905845672138265648506833394433043135824981559003634708099656882118068273562871737379370475i))>__CZ__eps){epsilon(eps);return 46;} -if(abs(lngamma(-3.400 - 3.700i)-(-10.55018529022399813119005433743831737900085357229525796426165531407012201466806460571733582857505851 + 6.763336971725381912118912702208512629733112628981673298740213483902378792635376051758399397079352018i))>__CZ__eps){epsilon(eps);return 47;} -if(abs(lngamma(-2.400 - 2.700i)-(-6.624262018571684573249747079902924251345023570085621326982177263497895441273594383174099568266569519 + 5.911914743873792313808731773611192661709672638901754910693406148730587535650933379128561953202673305i))>__CZ__eps){epsilon(eps);return 48;} -if(abs(lngamma(-1.400 - 1.700i)-(-3.046912030520906458689035477846643788289090086345259335810096962280997399307737870754170013561799449 + 4.680423062668151424886705499811285399248102868605621987762747421929868283337463368954255366241853210i))>__CZ__eps){epsilon(eps);return 49;} -if(abs(lngamma(-0.4000 - 0.7000i)-(-0.01623979147403148300780826047582666582616647435129398527305183616134471962089965927196036143676539809 + 2.826833421018256285271011446520969788549353956082297248294374573272383543521074785692812327220178392i))>__CZ__eps){epsilon(eps);return 50;} -if(abs(lngamma(0.6000 + 0.3000i)-(0.2484000028946351584991362705412598434332854007039741619587824313512584366380827672082938662993748700 - 0.4227177743314176403219013995119576518240065994565821579629389173672072909830539502579967884603383370i))>__CZ__eps){epsilon(eps);return 51;} -if(abs(lngamma(1.600 + 1.300i)-(-0.7407695833613238477853561156238169815169605175974563292533186764385040999403295266941234066342162332 + 0.3658395580779188724109027663961707196451841638334886679433275092947016221102693596315391546217532826i))>__CZ__eps){epsilon(eps);return 52;} -if(abs(lngamma(2.600 + 2.300i)-(-0.7153017561016750689453931991025219163388411460412682694249821466060642237596449041248795522730872166 + 2.067498782269003991801228117457494590355245722719424742293508630734960101015275647841102899818854810i))>__CZ__eps){epsilon(eps);return 53;} -if(abs(lngamma(3.600 + 3.300i)-(-0.2006290139452759775010107586460283514303264993274887714022222695834519457636026071215877177908693236 + 4.221969149213679168621678150696738907045553787288427746366287484331266798399726999903762441109724197i))>__CZ__eps){epsilon(eps);return 54;} -if(abs(lngamma(4.600 + 4.300i)-(0.6404767304085869581018213364351326853699331839312207180878789327971980401993755873561609797726810192 + 6.685149323469513776483323494807052342570441936959315816148292880724186611261236847208887542115434303i))>__CZ__eps){epsilon(eps);return 55;} -if(abs(lngamma(5.600 + 5.300i)-(1.727112476786098959996727579157495580048033035060833670179296378163352191130662743702237851099320091 + 9.383383918093155327986445451264543368751338171298232916305123349159206537551156601182421044554298994i))>__CZ__eps){epsilon(eps);return 56;} -if(abs(lngamma(55.60 + 0.3000i)-(166.7215150367733897769155930653789348483780044274716818154610861234389078719805189264594918732382586 + 1.202750513929718332820270669742686561426457642272968981346017082644807076333571537491197745615077294i))>__CZ__eps){epsilon(eps);return 57;} -if(abs(lngamma(56.60 + 0.3000i)-(170.7397127945179968376917410624766834622909691036136375973004131040276663262707416475336111420149831 + 1.208146145021640303895693686064781770317635078049891748154048007544470593526254839683637064897097838i))>__CZ__eps){epsilon(eps);return 58;} -if(abs(lngamma(57.60 + 0.3000i)-(174.7757358264026770962028712327193919190938819848539820911816742522615118513515101187002268498256953 + 1.213446448743774292811195505423481449339002192187714949283070433230478839177211462927645118751139388i))>__CZ__eps){epsilon(eps);return 59;} -if(abs(lngamma(58.60 + 0.3000i)-(178.8292719572886165808686582437464130998008894472168186351028467401004239585080660700434170533848267 + 1.218654734982846161251085553080214761347285268088604785438095878385945771674273185064368369032315536i))>__CZ__eps){epsilon(eps);return 60;} -if(abs(lngamma(59.60 + 0.3000i)-(182.9000197581041057641595126649840680882966589651420637344563598630410760508053004418106210806480514 + 1.223774144183534973445316592347337056808910609419286930794193524682491346969634027786839155163892724i))>__CZ__eps){epsilon(eps);return 61;} -if(abs(lngamma(60.60 + 0.3000i)-(186.9876880003631981031020807195926428903734785341818284861483167023505345362582553713940653353951410 + 1.228807658719925269995511830298415601718771597558190350507883496810540525070275863955647504172442604i))>__CZ__eps){epsilon(eps);return 62;} -if(abs(lngamma(61.60 + 0.3000i)-(191.0919951469889337316641602771633017764510692037723749796543523708549224640669741133145902737781006 + 1.233758113328768712483862353815791968059294457847368072259148050293157549143123712613333613763784674i))>__CZ__eps){epsilon(eps);return 63;} -if(abs(lngamma(62.60 + 0.3000i)-(195.2126688764702481772276457650023207176714432948785485345860994461920670783769886309746108133330257 + 1.238628204695931980600482702688969918429374403006592554012319844898454093596574259217162870691749038i))>__CZ__eps){epsilon(eps);return 64;} -if(abs(lngamma(63.60 + 0.3000i)-(199.3494456376687238313417632202369605922807314239672719385369875900976176399328184235160742022894634 + 1.243420500277190605198320894289870930154643596582155076044919162631888476221718725167773691679060391i))>__CZ__eps){epsilon(eps);return 65;} -if(abs(lngamma(64.60 + 0.3000i)-(203.5020702328465376706204035728796350972376926574607893322136594379996117055188038514446315204059032 + 1.248137446425596312819515029227444652080011390838575181737724990020365851808034508613690412166704588i))>__CZ__eps){epsilon(eps);return 66;} -if(abs(lngamma(65.60 + 0.3000i)-(207.6702954267142863859185793548246421433863939380928954872956462639690979311998038217156277177658497 + 1.252781375889819416329161991660565854615382764835522506641801626851934424429479695919682707858812249i))>__CZ__eps){epsilon(eps);return 67;} -if(abs(lngamma(55.60 - 4.700i)-(166.5221258272035253961542734005976077004749775938844000662776938982124117149831619415891292027559084 - 18.84875483296568553194454925345602004591801239160222174651330953176747978241113581568341389313614184i))>__CZ__eps){epsilon(eps);return 68;} -if(abs(lngamma(56.60 - 3.700i)-(170.6185921690853207517443064939778892985245375960964842072277769261987939958711192180080496388759790 - 14.90313021223193465377855573208445845565931668639004077631447433024105216208357598284073272963526083i))>__CZ__eps){epsilon(eps);return 69;} -if(abs(lngamma(57.60 - 2.700i)-(174.7127139121008307648437631979262499901446251937177073309638635680981878307625357907205057992110826 - 10.92201102864604767334040466047947450750373806537116051068380101221240925743684470549656839673533788i))>__CZ__eps){epsilon(eps);return 70;} -if(abs(lngamma(58.60 - 1.700i)-(178.8051797102056562439362100160978710660289490095968327611173555143739460179913989993096167790463432 - 6.905945104548951236229262516275118301863000955218208856630289945072933677322889363909280822011545321i))>__CZ__eps){epsilon(eps);return 71;} -if(abs(lngamma(59.60 - 0.7000i)-(182.8966358377199778625865269072085032936485484956150669021166926511020935207431114192228211953931100 - 2.855486362253577342667404413778192112579790386732841204180813534474139545940894056117527731737226582i))>__CZ__eps){epsilon(eps);return 72;} -if(abs(lngamma(60.60 + 0.3000i)-(186.9876880003631981031020807195926428903734785341818284861483167023505345362582553713940653353951410 + 1.228807658719925269995511830298415601718771597558190350507883496810540525070275863955647504172442604i))>__CZ__eps){epsilon(eps);return 73;} -if(abs(lngamma(61.60 + 1.300i)-(191.0789031896982469942903294770974306494712752019213395010059816712212959534694477736544779643613606 + 5.346377998474074192830409565498522421021695288142347615450028628516451152858671821236062551519577511i))>__CZ__eps){epsilon(eps);return 74;} -if(abs(lngamma(62.60 + 2.300i)-(195.1708115544608858783580589279983618518227865792619427244597031395608221351124418855807139544387844 + 9.496666208022148051357709844128014322980249562957453155498216739528300001626643515787555547645875216i))>__CZ__eps){epsilon(eps);return 75;} -if(abs(lngamma(63.60 + 3.300i)-(199.2639082667972359747356775354901044881033064193665592320100330065828589091059656379848180952180576 + 13.67911603585439751926438073480939520547347569839795064532158720371833242545216773892848304348649828i))>__CZ__eps){epsilon(eps);return 76;} -if(abs(lngamma(64.60 + 4.300i)-(203.3586553654963869814883298543618854726441450377694569990857332006085635938056596309090099303930334 + 17.89317489050227754715433149549722038188972541358048335428889588525290414035694955077798780767484079i))>__CZ__eps){epsilon(eps);return 77;} -if(abs(lngamma(65.60 + 5.300i)-(207.4554835618873492047512087924156663776620358356581503938661139973023305384540970489546974722608112 + 22.13829509931977678201875089030163451926720764548437834522489362621805878564584156804449041165307769i))>__CZ__eps){epsilon(eps);return 78;} -if(abs(lngamma(0.6000 + 55.30i)-(-85.54482235577983941284251852323648610691188392673393393659117312998074429939423249453201268385415968 + 166.7640845362830899082977628513038941147191508645382670512065838817570593346370195934584098731608163i))>__CZ__eps){epsilon(eps);return 79;} -if(abs(lngamma(0.6000 + 56.30i)-(-87.11382647385499402990266927218873826677912515510914330975238159375338785735675613885474681911555455 + 170.7858332456548897964755419202916477033408200711519690015167519320073811710594461413312890867212396i))>__CZ__eps){epsilon(eps);return 80;} -if(abs(lngamma(0.6000 + 57.30i)-(-88.68286214812485690627962462529848906043953388486922638389109935077387260509105638054210646253252466 + 174.8253452895478184840703539752269094932785103410249518116087112411324582420889387891648827483331167i))>__CZ__eps){epsilon(eps);return 81;} -if(abs(lngamma(0.6000 + 58.30i)-(-90.25192828651651583800480958344256221682554088740576313673589889163710837899207764032711716706627583 + 178.8823106163841131771861511088137077830986146286084489346147229324383955058792053361236598271019023i))>__CZ__eps){epsilon(eps);return 82;} -if(abs(lngamma(0.6000 + 59.30i)-(-91.82102385268587759734139136217993540696936010920994984591658423038715645418137316213497147316787354 + 182.9564298132977973838333574465352695792546867284831679902458633771250846205990521337322037599865490i))>__CZ__eps){epsilon(eps);return 83;} -if(abs(lngamma(0.6000 + 60.30i)-(-93.39014786228910598458529398231928177449383105033168028035758106697089023386753079638127787148822458 + 187.0474135677690289293542062291360648608774972285628443252781312026960680153689550595593442583564361i))>__CZ__eps){epsilon(eps);return 84;} -if(abs(lngamma(0.6000 + 61.30i)-(-94.95929937956076993888890535139227785932447324700640489970555152485771091160984562939060645206100132 + 191.1549821649831349987910547767822679603735412036380108781321752841569185871421007366309694487409486i))>__CZ__eps){epsilon(eps);return 85;} -if(abs(lngamma(0.6000 + 62.30i)-(-96.52847751416891464599424930795884732518087496093651555404283351659612698836352323452352710420599104 + 195.2788650179992458972186470030422322640959550214072444870291693388786130688229112380191390257821807i))>__CZ__eps){epsilon(eps);return 86;} -if(abs(lngamma(0.6000 + 63.30i)-(-98.09768141832058996231194071903760307280235519603364210034375642851432112362859092795643468479700327 + 199.4188002280943140128727971292337826315387363387763786270696435128423987623771787363214987887073743i))>__CZ__eps){epsilon(eps);return 87;} -if(abs(lngamma(0.6000 + 64.30i)-(-99.66691028409427522125385963825011409754630863598190917300304121976114751378659089137971202438172887 + 203.5745341728981030650825963445356527935331129342248469636074322780853587222584902429706178725686242i))>__CZ__eps){epsilon(eps);return 88;} -if(abs(lngamma(0.6000 + 65.30i)-(-101.2361633409781854893699037629524761308029390440175099023860977120545945724838225634129393108607355 + 207.7458211201573236805249632667291754315339341665724958026196877950249917227554119187871060871559697i))>__CZ__eps){epsilon(eps);return 89;} -if(abs(lngamma(55.60 + 60.30i)-(138.3405218869058217717201182836422027677382184890964165590417353499219822226519181484044703575835292 + 250.9485307086751713133102893231808151265549690071705472539067848281998391909656358247103271742719578i))>__CZ__eps){epsilon(eps);return 90;} -if(abs(lngamma(56.60 + 60.30i)-(142.7474976121018701984157500679190442966110797769323173557040709858649026362568015560276025151255956 + 251.7744588650459198825346353772080509751313819470548658242804227289838197861524419605491386182133953i))>__CZ__eps){epsilon(eps);return 91;} -if(abs(lngamma(57.60 + 60.30i)-(147.1627435319602425515209166358781832064023544924212637636653157301087891743636771772442175547092138 + 252.5914974493805839443768868968642526869013797892608722844298827478025786612090804469713284568207639i))>__CZ__eps){epsilon(eps);return 92;} -if(abs(lngamma(58.60 + 60.30i)-(151.5862689029682042031606617640450220740985775964639233206719519919454468746790090892789062856833994 + 253.3997923739994162421416717294147634900873392644324912633837005280001593924100149032670755229086402i))>__CZ__eps){epsilon(eps);return 93;} -if(abs(lngamma(59.60 + 60.30i)-(156.0180803184689022095120622630277425180433295653817951699970902688810769976218882558288617606286722 + 254.1994872924291535134537002289372877256760561545266240447182119613107490480996768753107944444566663i))>__CZ__eps){epsilon(eps);return 94;} -if(abs(lngamma(60.60 + 60.30i)-(160.4581818322128207752571131620498333645831099884594593949166210067133473205367535408753892850882553 + 254.9907235879958949246830907372060458378867915677707498070916381728065006920567219761323639093065907i))>__CZ__eps){epsilon(eps);return 95;} -if(abs(lngamma(61.60 + 60.30i)-(164.9065750781912363906196189745577497508505165621357938820065182107142960571733194288330116576903125 + 255.7736403669080425654455012237246051402306640891736322674732329084396310656024722092859071945872444i))>__CZ__eps){epsilon(eps);return 96;} -if(abs(lngamma(62.60 + 60.30i)-(169.3632593867220799863942253592790131010186217605278241383032664772260920373282624028529879975286350 + 256.5483744554910528044048617005478717965073680654042053866320357723837630372594401312206968901830105i))>__CZ__eps){epsilon(eps);return 97;} -if(abs(lngamma(63.60 + 60.30i)-(173.8282318967764198928263540479369804154959334380883398727474568650558868155342724620418729191066897 + 257.3150604012511380535676929646281795055983167823336193389524424552595441364148246393785125517847376i))>__CZ__eps){epsilon(eps);return 98;} -if(abs(lngamma(64.60 + 60.30i)-(178.3014876645497005489995740718100489155558324227755847007898254349773686020549399461464731246888811 + 258.0738304774605436591436026066009539042787457216911291577832446476517821930895032617238958674099152i))>__CZ__eps){epsilon(eps);return 99;} -if(abs(lngamma(65.60 + 60.30i)-(182.7830197682960267239662260557525833694506977039319737802533196097442483852152832046887750759565943 + 258.8248146909724805417993325211754807069936951454932977542761597422795687852878109079207208588308147i))>__CZ__eps){epsilon(eps);return 100;} -if(abs(lngamma(55.60 + 55.30i)-(142.3862162791589253462657451176275726003857264651343509950957693660793746863734326554521916865294160 + 229.0474972316203435288188174128389032017308276896396827258188412666555426184444346078935151648963593i))>__CZ__eps){epsilon(eps);return 101;} -if(abs(lngamma(56.60 + 56.30i)-(145.9655713474689753168556009847734887663033552824290632709719191874805473283966808702482716223823799 + 234.2012259525622513896404861908422505950646506577988340677531054697523114853375505771896176207845654i))>__CZ__eps){epsilon(eps);return 102;} -if(abs(lngamma(57.60 + 57.30i)-(149.5627523253413003508200851967083007076485608754907532209664548084707244359306524068411586608941471 + 239.3727177204530395107173394215426561501560159557014103102685030670438401066317331091766069662051511i))>__CZ__eps){epsilon(eps);return 103;} -if(abs(lngamma(58.60 + 58.30i)-(153.1774470047839472501216057736005131302626263510371392880103904697841471694103329293425078496549758 + 244.5616624984797644536433102063654140139237547865421532878830803720762552799643139942619380524890401i))>__CZ__eps){epsilon(eps);return 104;} -if(abs(lngamma(59.60 + 59.30i)-(156.8093539260984043245770025957276995010069796775703177529274656935406571580476095484467127733135084 + 249.7677608875474964335171539461488545902215228674008981574984941307449419367892141512085156904698398i))>__CZ__eps){epsilon(eps);return 105;} -if(abs(lngamma(60.60 + 60.30i)-(160.4581818322128207752571131620498333645831099884594593949166210067133473205367535408753892850882553 + 254.9907235879958949246830907372060458378867915677707498070916381728065006920567219761323639093065907i))>__CZ__eps){epsilon(eps);return 106;} -if(abs(lngamma(61.60 + 61.30i)-(164.1236491593380218382957487779642572534385362007999916281283947968048913383213154195181013057822234 + 260.2302708970324395553848679531333038493595454481482560493315410820180244948561636909552645533403618i))>__CZ__eps){epsilon(eps);return 107;} -if(abs(lngamma(62.60 + 62.30i)-(167.8054835609733823774016164868506426238263526697353479782755961582196176989205680074917215202127864 + 265.4861322389681286058365065491944749198017327500214219083439023895059621709769558317157193105864721i))>__CZ__eps){epsilon(eps);return 108;} -if(abs(lngamma(63.60 + 63.30i)-(171.5034214625769205528980449555097665172285302158028025423161481941008052930058651761908875732005816 + 270.7580457256222186188843213325906832500862444373572311661827574319274457824608027119111557496467876i))>__CZ__eps){epsilon(eps);return 109;} -if(abs(lngamma(64.60 + 64.30i)-(175.2172076444693933495200678808489471651335658562522069741003825794583284267731429819984320358705804 + 276.0457577445122795003295082894754935609216218032287116765827545233934750440738775983322565095055686i))>__CZ__eps){epsilon(eps);return 110;} -if(abs(lngamma(65.60 + 65.30i)-(178.9465948507696967449494536146172974534191430062324139747191513973655253559309515112484546085877718 + 281.3490225726683461623186324992570909685317567794418009098339817182638759202079343286582580534821206i))>__CZ__eps){epsilon(eps);return 111;} -if(abs(lngamma(0.6000 + 4.700i)-(-6.309230474426685182917699027589840248465208901823736044071406089970016624762071282414477519533446805 + 2.738444603265429259406748249023722438146218314171151425663490122832827447160142404453785215790720172i))>__CZ__eps){epsilon(eps);return 112;} -if(abs(lngamma(0.6000 + 3.700i)-(-4.762470602521331200619631143446813610218360030381255868867915275850062167138589945759181147587314347 + 1.307861859626688811743330143389568763790196226980935860137256735840654999917008199152740741948205653i))>__CZ__eps){epsilon(eps);return 113;} -if(abs(lngamma(0.6000 + 2.700i)-(-3.223449159729432378435059551332376261824297133470481664344109285143389820463721600269079600439653415 + 0.1525473639596832094518944287785664759918133343972275457487506548230474276833315783298300402230230813i))>__CZ__eps){epsilon(eps);return 114;} -if(abs(lngamma(0.6000 + 1.700i)-(-1.699851882736550416690203691424396333903393386464266356507295865152155081643217138332174570080627273 - 0.6188153536675997046951505463300498363352953733225308151601485284481801957104097451434473124727600220i))>__CZ__eps){epsilon(eps);return 115;} -if(abs(lngamma(0.6000 + 0.7000i)-(-0.2316312495202586116986763277644377512618333134657045421405330360600955017822181674931032957595291466 - 0.7368909799768367142682353753277667339824288570492360448564102775206851329939159562896886641611904396i))>__CZ__eps){epsilon(eps);return 116;} -if(abs(lngamma(0.6000 - 0.3000i)-(0.2484000028946351584991362705412598434332854007039741619587824313512584366380827672082938662993748700 + 0.4227177743314176403219013995119576518240065994565821579629389173672072909830539502579967884603383370i))>__CZ__eps){epsilon(eps);return 117;} -if(abs(lngamma(0.6000 - 1.300i)-(-1.099689479936482253001126014071250387866864940802593030985946176338010292319634681754351711277201146 + 0.7725489931464399068598744386748572974573591452933440189885272843948051378865258815608409462651759038i))>__CZ__eps){epsilon(eps);return 118;} -if(abs(lngamma(0.6000 - 2.300i)-(-2.611386294578008388513457987969729601048026532835562114605241252682747719092183552611868952700620418 + 0.2111094845860104400425314901146665256344806614559790152507363455424499006701362134714576901668862615i))>__CZ__eps){epsilon(eps);return 119;} -if(abs(lngamma(0.6000 - 3.300i)-(-4.145670522984067490152016613422534092269675011415945298652917864316934507837553864106231837873639178 - 0.8081928951523762121254890981027647840025857144095024771821231809903327928035320700978580016020901134i))>__CZ__eps){epsilon(eps);return 120;} -if(abs(lngamma(0.6000 - 4.300i)-(-5.689842576036527320491763306963824853139907301029281610305682566179799260941238598307788211198739464 - 2.137677242374957442527694027866746053575410791317320138931932495148003411548291173248963052605469029i))>__CZ__eps){epsilon(eps);return 121;} -if(abs(lngamma(0.6000 - 5.300i)-(-7.239654605052715210182073623536904206104308839659326676113824586592039321903083835369930675115629685 - 3.702857758072432142072497796069521049678127217607403327232198098820227725661161561592679775128000025i))>__CZ__eps){epsilon(eps);return 122;} -if(abs(lngamma(-4.400 + 4.700i)-(-14.73413592903136179653960750100174060012531669119348359739188295824251395007186551726647596156181555 - 7.340768981905845672138265648506833394433043135824981559003634708099656882118068273562871737379370475i))>__CZ__eps){epsilon(eps);return 123;} -if(abs(lngamma(-3.400 + 3.700i)-(-10.55018529022399813119005433743831737900085357229525796426165531407012201466806460571733582857505851 - 6.763336971725381912118912702208512629733112628981673298740213483902378792635376051758399397079352018i))>__CZ__eps){epsilon(eps);return 124;} -if(abs(lngamma(-2.400 + 2.700i)-(-6.624262018571684573249747079902924251345023570085621326982177263497895441273594383174099568266569519 - 5.911914743873792313808731773611192661709672638901754910693406148730587535650933379128561953202673305i))>__CZ__eps){epsilon(eps);return 125;} -if(abs(lngamma(-1.400 + 1.700i)-(-3.046912030520906458689035477846643788289090086345259335810096962280997399307737870754170013561799449 - 4.680423062668151424886705499811285399248102868605621987762747421929868283337463368954255366241853210i))>__CZ__eps){epsilon(eps);return 126;} -if(abs(lngamma(-0.4000 + 0.7000i)-(-0.01623979147403148300780826047582666582616647435129398527305183616134471962089965927196036143676539809 - 2.826833421018256285271011446520969788549353956082297248294374573272383543521074785692812327220178392i))>__CZ__eps){epsilon(eps);return 127;} -if(abs(lngamma(0.6000 - 0.3000i)-(0.2484000028946351584991362705412598434332854007039741619587824313512584366380827672082938662993748700 + 0.4227177743314176403219013995119576518240065994565821579629389173672072909830539502579967884603383370i))>__CZ__eps){epsilon(eps);return 128;} -if(abs(lngamma(1.600 - 1.300i)-(-0.7407695833613238477853561156238169815169605175974563292533186764385040999403295266941234066342162332 - 0.3658395580779188724109027663961707196451841638334886679433275092947016221102693596315391546217532826i))>__CZ__eps){epsilon(eps);return 129;} -if(abs(lngamma(2.600 - 2.300i)-(-0.7153017561016750689453931991025219163388411460412682694249821466060642237596449041248795522730872166 - 2.067498782269003991801228117457494590355245722719424742293508630734960101015275647841102899818854810i))>__CZ__eps){epsilon(eps);return 130;} -if(abs(lngamma(3.600 - 3.300i)-(-0.2006290139452759775010107586460283514303264993274887714022222695834519457636026071215877177908693236 - 4.221969149213679168621678150696738907045553787288427746366287484331266798399726999903762441109724197i))>__CZ__eps){epsilon(eps);return 131;} -if(abs(lngamma(4.600 - 4.300i)-(0.6404767304085869581018213364351326853699331839312207180878789327971980401993755873561609797726810192 - 6.685149323469513776483323494807052342570441936959315816148292880724186611261236847208887542115434303i))>__CZ__eps){epsilon(eps);return 132;} -if(abs(lngamma(5.600 - 5.300i)-(1.727112476786098959996727579157495580048033035060833670179296378163352191130662743702237851099320091 - 9.383383918093155327986445451264543368751338171298232916305123349159206537551156601182421044554298994i))>__CZ__eps){epsilon(eps);return 133;} -if(abs(lngamma(55.60 - 0.3000i)-(166.7215150367733897769155930653789348483780044274716818154610861234389078719805189264594918732382586 - 1.202750513929718332820270669742686561426457642272968981346017082644807076333571537491197745615077294i))>__CZ__eps){epsilon(eps);return 134;} -if(abs(lngamma(56.60 - 0.3000i)-(170.7397127945179968376917410624766834622909691036136375973004131040276663262707416475336111420149831 - 1.208146145021640303895693686064781770317635078049891748154048007544470593526254839683637064897097838i))>__CZ__eps){epsilon(eps);return 135;} -if(abs(lngamma(57.60 - 0.3000i)-(174.7757358264026770962028712327193919190938819848539820911816742522615118513515101187002268498256953 - 1.213446448743774292811195505423481449339002192187714949283070433230478839177211462927645118751139388i))>__CZ__eps){epsilon(eps);return 136;} -if(abs(lngamma(58.60 - 0.3000i)-(178.8292719572886165808686582437464130998008894472168186351028467401004239585080660700434170533848267 - 1.218654734982846161251085553080214761347285268088604785438095878385945771674273185064368369032315536i))>__CZ__eps){epsilon(eps);return 137;} -if(abs(lngamma(59.60 - 0.3000i)-(182.9000197581041057641595126649840680882966589651420637344563598630410760508053004418106210806480514 - 1.223774144183534973445316592347337056808910609419286930794193524682491346969634027786839155163892724i))>__CZ__eps){epsilon(eps);return 138;} -if(abs(lngamma(60.60 - 0.3000i)-(186.9876880003631981031020807195926428903734785341818284861483167023505345362582553713940653353951410 - 1.228807658719925269995511830298415601718771597558190350507883496810540525070275863955647504172442604i))>__CZ__eps){epsilon(eps);return 139;} -if(abs(lngamma(61.60 - 0.3000i)-(191.0919951469889337316641602771633017764510692037723749796543523708549224640669741133145902737781006 - 1.233758113328768712483862353815791968059294457847368072259148050293157549143123712613333613763784674i))>__CZ__eps){epsilon(eps);return 140;} -if(abs(lngamma(62.60 - 0.3000i)-(195.2126688764702481772276457650023207176714432948785485345860994461920670783769886309746108133330257 - 1.238628204695931980600482702688969918429374403006592554012319844898454093596574259217162870691749038i))>__CZ__eps){epsilon(eps);return 141;} -if(abs(lngamma(63.60 - 0.3000i)-(199.3494456376687238313417632202369605922807314239672719385369875900976176399328184235160742022894634 - 1.243420500277190605198320894289870930154643596582155076044919162631888476221718725167773691679060391i))>__CZ__eps){epsilon(eps);return 142;} -if(abs(lngamma(64.60 - 0.3000i)-(203.5020702328465376706204035728796350972376926574607893322136594379996117055188038514446315204059032 - 1.248137446425596312819515029227444652080011390838575181737724990020365851808034508613690412166704588i))>__CZ__eps){epsilon(eps);return 143;} -if(abs(lngamma(65.60 - 0.3000i)-(207.6702954267142863859185793548246421433863939380928954872956462639690979311998038217156277177658497 - 1.252781375889819416329161991660565854615382764835522506641801626851934424429479695919682707858812249i))>__CZ__eps){epsilon(eps);return 144;} -if(abs(lngamma(55.60 - 4.700i)-(166.5221258272035253961542734005976077004749775938844000662776938982124117149831619415891292027559084 - 18.84875483296568553194454925345602004591801239160222174651330953176747978241113581568341389313614184i))>__CZ__eps){epsilon(eps);return 145;} -if(abs(lngamma(56.60 - 3.700i)-(170.6185921690853207517443064939778892985245375960964842072277769261987939958711192180080496388759790 - 14.90313021223193465377855573208445845565931668639004077631447433024105216208357598284073272963526083i))>__CZ__eps){epsilon(eps);return 146;} -if(abs(lngamma(57.60 - 2.700i)-(174.7127139121008307648437631979262499901446251937177073309638635680981878307625357907205057992110826 - 10.92201102864604767334040466047947450750373806537116051068380101221240925743684470549656839673533788i))>__CZ__eps){epsilon(eps);return 147;} -if(abs(lngamma(58.60 - 1.700i)-(178.8051797102056562439362100160978710660289490095968327611173555143739460179913989993096167790463432 - 6.905945104548951236229262516275118301863000955218208856630289945072933677322889363909280822011545321i))>__CZ__eps){epsilon(eps);return 148;} -if(abs(lngamma(59.60 - 0.7000i)-(182.8966358377199778625865269072085032936485484956150669021166926511020935207431114192228211953931100 - 2.855486362253577342667404413778192112579790386732841204180813534474139545940894056117527731737226582i))>__CZ__eps){epsilon(eps);return 149;} -if(abs(lngamma(60.60 + 0.3000i)-(186.9876880003631981031020807195926428903734785341818284861483167023505345362582553713940653353951410 + 1.228807658719925269995511830298415601718771597558190350507883496810540525070275863955647504172442604i))>__CZ__eps){epsilon(eps);return 150;} -if(abs(lngamma(61.60 + 1.300i)-(191.0789031896982469942903294770974306494712752019213395010059816712212959534694477736544779643613606 + 5.346377998474074192830409565498522421021695288142347615450028628516451152858671821236062551519577511i))>__CZ__eps){epsilon(eps);return 151;} -if(abs(lngamma(62.60 + 2.300i)-(195.1708115544608858783580589279983618518227865792619427244597031395608221351124418855807139544387844 + 9.496666208022148051357709844128014322980249562957453155498216739528300001626643515787555547645875216i))>__CZ__eps){epsilon(eps);return 152;} -if(abs(lngamma(63.60 + 3.300i)-(199.2639082667972359747356775354901044881033064193665592320100330065828589091059656379848180952180576 + 13.67911603585439751926438073480939520547347569839795064532158720371833242545216773892848304348649828i))>__CZ__eps){epsilon(eps);return 153;} -if(abs(lngamma(64.60 + 4.300i)-(203.3586553654963869814883298543618854726441450377694569990857332006085635938056596309090099303930334 + 17.89317489050227754715433149549722038188972541358048335428889588525290414035694955077798780767484079i))>__CZ__eps){epsilon(eps);return 154;} -if(abs(lngamma(65.60 + 5.300i)-(207.4554835618873492047512087924156663776620358356581503938661139973023305384540970489546974722608112 + 22.13829509931977678201875089030163451926720764548437834522489362621805878564584156804449041165307769i))>__CZ__eps){epsilon(eps);return 155;} -if(abs(lngamma(0.6000 - 55.30i)-(-85.54482235577983941284251852323648610691188392673393393659117312998074429939423249453201268385415968 - 166.7640845362830899082977628513038941147191508645382670512065838817570593346370195934584098731608163i))>__CZ__eps){epsilon(eps);return 156;} -if(abs(lngamma(0.6000 - 56.30i)-(-87.11382647385499402990266927218873826677912515510914330975238159375338785735675613885474681911555455 - 170.7858332456548897964755419202916477033408200711519690015167519320073811710594461413312890867212396i))>__CZ__eps){epsilon(eps);return 157;} -if(abs(lngamma(0.6000 - 57.30i)-(-88.68286214812485690627962462529848906043953388486922638389109935077387260509105638054210646253252466 - 174.8253452895478184840703539752269094932785103410249518116087112411324582420889387891648827483331167i))>__CZ__eps){epsilon(eps);return 158;} -if(abs(lngamma(0.6000 - 58.30i)-(-90.25192828651651583800480958344256221682554088740576313673589889163710837899207764032711716706627583 - 178.8823106163841131771861511088137077830986146286084489346147229324383955058792053361236598271019023i))>__CZ__eps){epsilon(eps);return 159;} -if(abs(lngamma(0.6000 - 59.30i)-(-91.82102385268587759734139136217993540696936010920994984591658423038715645418137316213497147316787354 - 182.9564298132977973838333574465352695792546867284831679902458633771250846205990521337322037599865490i))>__CZ__eps){epsilon(eps);return 160;} -if(abs(lngamma(0.6000 - 60.30i)-(-93.39014786228910598458529398231928177449383105033168028035758106697089023386753079638127787148822458 - 187.0474135677690289293542062291360648608774972285628443252781312026960680153689550595593442583564361i))>__CZ__eps){epsilon(eps);return 161;} -if(abs(lngamma(0.6000 - 61.30i)-(-94.95929937956076993888890535139227785932447324700640489970555152485771091160984562939060645206100132 - 191.1549821649831349987910547767822679603735412036380108781321752841569185871421007366309694487409486i))>__CZ__eps){epsilon(eps);return 162;} -if(abs(lngamma(0.6000 - 62.30i)-(-96.52847751416891464599424930795884732518087496093651555404283351659612698836352323452352710420599104 - 195.2788650179992458972186470030422322640959550214072444870291693388786130688229112380191390257821807i))>__CZ__eps){epsilon(eps);return 163;} -if(abs(lngamma(0.6000 - 63.30i)-(-98.09768141832058996231194071903760307280235519603364210034375642851432112362859092795643468479700327 - 199.4188002280943140128727971292337826315387363387763786270696435128423987623771787363214987887073743i))>__CZ__eps){epsilon(eps);return 164;} -if(abs(lngamma(0.6000 - 64.30i)-(-99.66691028409427522125385963825011409754630863598190917300304121976114751378659089137971202438172887 - 203.5745341728981030650825963445356527935331129342248469636074322780853587222584902429706178725686242i))>__CZ__eps){epsilon(eps);return 165;} -if(abs(lngamma(0.6000 - 65.30i)-(-101.2361633409781854893699037629524761308029390440175099023860977120545945724838225634129393108607355 - 207.7458211201573236805249632667291754315339341665724958026196877950249917227554119187871060871559697i))>__CZ__eps){epsilon(eps);return 166;} -if(abs(lngamma(55.60 - 60.30i)-(138.3405218869058217717201182836422027677382184890964165590417353499219822226519181484044703575835292 - 250.9485307086751713133102893231808151265549690071705472539067848281998391909656358247103271742719578i))>__CZ__eps){epsilon(eps);return 167;} -if(abs(lngamma(56.60 - 60.30i)-(142.7474976121018701984157500679190442966110797769323173557040709858649026362568015560276025151255956 - 251.7744588650459198825346353772080509751313819470548658242804227289838197861524419605491386182133953i))>__CZ__eps){epsilon(eps);return 168;} -if(abs(lngamma(57.60 - 60.30i)-(147.1627435319602425515209166358781832064023544924212637636653157301087891743636771772442175547092138 - 252.5914974493805839443768868968642526869013797892608722844298827478025786612090804469713284568207639i))>__CZ__eps){epsilon(eps);return 169;} -if(abs(lngamma(58.60 - 60.30i)-(151.5862689029682042031606617640450220740985775964639233206719519919454468746790090892789062856833994 - 253.3997923739994162421416717294147634900873392644324912633837005280001593924100149032670755229086402i))>__CZ__eps){epsilon(eps);return 170;} -if(abs(lngamma(59.60 - 60.30i)-(156.0180803184689022095120622630277425180433295653817951699970902688810769976218882558288617606286722 - 254.1994872924291535134537002289372877256760561545266240447182119613107490480996768753107944444566663i))>__CZ__eps){epsilon(eps);return 171;} -if(abs(lngamma(60.60 - 60.30i)-(160.4581818322128207752571131620498333645831099884594593949166210067133473205367535408753892850882553 - 254.9907235879958949246830907372060458378867915677707498070916381728065006920567219761323639093065907i))>__CZ__eps){epsilon(eps);return 172;} -if(abs(lngamma(61.60 - 60.30i)-(164.9065750781912363906196189745577497508505165621357938820065182107142960571733194288330116576903125 - 255.7736403669080425654455012237246051402306640891736322674732329084396310656024722092859071945872444i))>__CZ__eps){epsilon(eps);return 173;} -if(abs(lngamma(62.60 - 60.30i)-(169.3632593867220799863942253592790131010186217605278241383032664772260920373282624028529879975286350 - 256.5483744554910528044048617005478717965073680654042053866320357723837630372594401312206968901830105i))>__CZ__eps){epsilon(eps);return 174;} -if(abs(lngamma(63.60 - 60.30i)-(173.8282318967764198928263540479369804154959334380883398727474568650558868155342724620418729191066897 - 257.3150604012511380535676929646281795055983167823336193389524424552595441364148246393785125517847376i))>__CZ__eps){epsilon(eps);return 175;} -if(abs(lngamma(64.60 - 60.30i)-(178.3014876645497005489995740718100489155558324227755847007898254349773686020549399461464731246888811 - 258.0738304774605436591436026066009539042787457216911291577832446476517821930895032617238958674099152i))>__CZ__eps){epsilon(eps);return 176;} -if(abs(lngamma(65.60 - 60.30i)-(182.7830197682960267239662260557525833694506977039319737802533196097442483852152832046887750759565943 - 258.8248146909724805417993325211754807069936951454932977542761597422795687852878109079207208588308147i))>__CZ__eps){epsilon(eps);return 177;} -if(abs(lngamma(55.60 - 55.30i)-(142.3862162791589253462657451176275726003857264651343509950957693660793746863734326554521916865294160 - 229.0474972316203435288188174128389032017308276896396827258188412666555426184444346078935151648963593i))>__CZ__eps){epsilon(eps);return 178;} -if(abs(lngamma(56.60 - 56.30i)-(145.9655713474689753168556009847734887663033552824290632709719191874805473283966808702482716223823799 - 234.2012259525622513896404861908422505950646506577988340677531054697523114853375505771896176207845654i))>__CZ__eps){epsilon(eps);return 179;} -if(abs(lngamma(57.60 - 57.30i)-(149.5627523253413003508200851967083007076485608754907532209664548084707244359306524068411586608941471 - 239.3727177204530395107173394215426561501560159557014103102685030670438401066317331091766069662051511i))>__CZ__eps){epsilon(eps);return 180;} -if(abs(lngamma(58.60 - 58.30i)-(153.1774470047839472501216057736005131302626263510371392880103904697841471694103329293425078496549758 - 244.5616624984797644536433102063654140139237547865421532878830803720762552799643139942619380524890401i))>__CZ__eps){epsilon(eps);return 181;} -if(abs(lngamma(59.60 - 59.30i)-(156.8093539260984043245770025957276995010069796775703177529274656935406571580476095484467127733135084 - 249.7677608875474964335171539461488545902215228674008981574984941307449419367892141512085156904698398i))>__CZ__eps){epsilon(eps);return 182;} -if(abs(lngamma(60.60 - 60.30i)-(160.4581818322128207752571131620498333645831099884594593949166210067133473205367535408753892850882553 - 254.9907235879958949246830907372060458378867915677707498070916381728065006920567219761323639093065907i))>__CZ__eps){epsilon(eps);return 183;} -if(abs(lngamma(61.60 - 61.30i)-(164.1236491593380218382957487779642572534385362007999916281283947968048913383213154195181013057822234 - 260.2302708970324395553848679531333038493595454481482560493315410820180244948561636909552645533403618i))>__CZ__eps){epsilon(eps);return 184;} -if(abs(lngamma(62.60 - 62.30i)-(167.8054835609733823774016164868506426238263526697353479782755961582196176989205680074917215202127864 - 265.4861322389681286058365065491944749198017327500214219083439023895059621709769558317157193105864721i))>__CZ__eps){epsilon(eps);return 185;} -if(abs(lngamma(63.60 - 63.30i)-(171.5034214625769205528980449555097665172285302158028025423161481941008052930058651761908875732005816 - 270.7580457256222186188843213325906832500862444373572311661827574319274457824608027119111557496467876i))>__CZ__eps){epsilon(eps);return 186;} -if(abs(lngamma(64.60 - 64.30i)-(175.2172076444693933495200678808489471651335658562522069741003825794583284267731429819984320358705804 - 276.0457577445122795003295082894754935609216218032287116765827545233934750440738775983322565095055686i))>__CZ__eps){epsilon(eps);return 187;} -if(abs(lngamma(65.60 - 65.30i)-(178.9465948507696967449494536146172974534191430062324139747191513973655253559309515112484546085877718 - 281.3490225726683461623186324992570909685317567794418009098339817182638759202079343286582580534821206i))>__CZ__eps){epsilon(eps);return 188;} - - /* some large integers */ - if(abs(lngamma( 10^2 +1 )-( ln((10^2)!) ) ) > __CZ__eps ){epsilon(eps);return 189;} - ##if(abs(lngamma( 10^10 +1 )-( ln((10^10)!) ) > __CZ__eps ){epsilon(eps);return 190;} - ##epsilon(1e-140) if(abs(lngamma( 10^100 )-( ln((10^100)!) ) > __CZ__eps ){epsilon(eps);return 191;} - epsilon(eps); - if(isnull(type))t02(1); - - epsilon(eps); - return 0; + epsilon(eps); + return 0; } -/* test 03 tests psi(z) for the following values - * - * z psi(z) - * 5 1.506117668431800472726821243 - * -5 error - * -5.5 1.792911330399932941915445023 - * 5.5 1.611093148581751123733626842 - * 5.5+5.5i 2.005864860662911769895523042 + 0.8322301014098247099090843855i - * -5.5+5.5i 2.096773951572002678986432133 + 2.400271643089053271126857721i - * -5.5-5.5i 2.096773951572002678986432133 - 2.400271643089053271126857721i - */ -define t03(){ - local eps; - eps = epsilon(1e-20); - if( abs(psi( 5 ) - 1.506117668431800472726821243) > __CZ__eps ){ +define t03() +{ + local eps; + eps = epsilon(1e-20); + if (abs(psi(5) - 1.506117668431800472726821243) > __CZ__eps) { + epsilon(eps); + return 1; + } + if (!iserror(psi(-5))) { + epsilon(eps); + return 2; + } + if (abs(psi(-5.5) - (1.792911330399932941915445023)) > __CZ__eps) { + epsilon(eps); + return 3; + } + if (abs(psi(5.5) - (1.611093148581751123733626842)) > __CZ__eps) { + epsilon(eps); + return 4; + } + if (abs + (psi(5.5 + 5.5i) - + (2.005864860662911769895523042 + 0.8322301014098247099090843855i)) > + __CZ__eps) { + epsilon(eps); + return 5; + } + if (abs + (psi(-5.5 + 5.5i) - + (2.096773951572002678986432133 + 2.400271643089053271126857721i)) > + __CZ__eps) { + epsilon(eps); + return 6; + } + if (abs + (psi(-5.5 - 5.5i) - + (2.096773951572002678986432133 - 2.400271643089053271126857721i)) > + __CZ__eps) { + epsilon(eps); + return 7; + } epsilon(eps); - return 1; - } - if(!iserror(psi( -5 ))){ - epsilon(eps); - return 2; - } - if( abs(psi( -5.5 ) - (1.792911330399932941915445023)) > __CZ__eps){ - epsilon(eps); - return 3; - } - if( abs(psi( 5.5 ) - (1.611093148581751123733626842)) > __CZ__eps){ - epsilon(eps); - return 4; - } - if( abs(psi( 5.5+5.5i ) - ( 2.005864860662911769895523042 + 0.8322301014098247099090843855i )) > __CZ__eps ){ - epsilon(eps); - return 5; - } - if( abs(psi(-5.5+5.5i ) - ( 2.096773951572002678986432133 + 2.400271643089053271126857721i )) > __CZ__eps ){ - epsilon(eps); - return 6; - } - if( abs(psi(-5.5-5.5i ) - ( 2.096773951572002678986432133 - 2.400271643089053271126857721i )) > __CZ__eps ){ - epsilon(eps); - return 7; - } - epsilon(eps); - return 0; + return 0; } -/* test 04 tests polygamma(m,z) for the following values (m==0 gets computed by psi()) +/* test 04 tests polygamma(m,z) for the following values (m==0 gets computed + * by psi()). * Values tested against were computed with Mathematica(TM) only * (z in the left complex halfplane does not get computed yet) - * - * m z polygamma(m,z) - * 2 5 -0.048789732245114496725 - * 2 -5 error - * 2 -5.5 -0.02758791070687679879 - * 2 5.5 -0.03960894752130204297 - * 2 5.5+5.5i 0.00163921986957704426 + 0.01803230748452131112i - * 2 -5.5+5.5i -0.00136603933402926677 - 0.015027048280671555719i - * 2 -5.5-5.5i -0.00136603933402926677 + 0.015027048280671555719i - * - * - * 5.2+5.6i 2.2+2.6i -8.8027566465576501667921604e6-2.66541164009580321614666448e7i */ -define t04(){ - local eps; - eps = epsilon(1e-20); - if( abs(polygamma( 2,5 ) - (-0.048789732245114496725)) > __CZ__eps ){ +define t04() +{ + local eps; + eps = epsilon(1e-20); + if (abs(polygamma(2, 5) - (-0.048789732245114496725)) > __CZ__eps) { + epsilon(eps); + return 1; + } + if (!iserror(polygamma(2, -5))) { + epsilon(eps); + return 2; + } + if (abs(polygamma(2, -5.5) - (-0.02758791070687679879)) > __CZ__eps) { + epsilon(eps); + return 3; + } + if (abs(polygamma(2, 5.5) - (-0.03960894752130204297)) > __CZ__eps) { + epsilon(eps); + return 4; + } + if (abs + (polygamma(2, 5.5 + 5.5i) - + (0.00163921986957704426 + 0.01803230748452131112i)) > __CZ__eps) { + epsilon(eps); + return 5; + } + if (abs + (polygamma(2, -5.5 + 5.5i) - + (-0.00136603933402926677 - 0.015027048280671555719i)) > __CZ__eps) { + epsilon(eps); + return 6; + } + if (abs + (polygamma(2, -5.5 - 5.5i) - + (-0.00136603933402926677 + 0.015027048280671555719i)) > __CZ__eps) { + epsilon(eps); + return 7; + } epsilon(eps); - return 1; - } - if(!iserror(polygamma( 2,-5 ))){ - epsilon(eps); - return 2; - } - if( abs(polygamma( 2,-5.5 ) - ( -0.02758791070687679879 )) > __CZ__eps){ - epsilon(eps); - return 3; - } - if( abs(polygamma( 2,5.5 ) - ( -0.03960894752130204297 )) > __CZ__eps){ - epsilon(eps); - return 4; - } - if( abs(polygamma( 2,5.5+5.5i ) - ( 0.00163921986957704426 + 0.01803230748452131112i )) > __CZ__eps ){ - epsilon(eps); - return 5; - } - if( abs(polygamma( 2,-5.5+5.5i ) - ( -0.00136603933402926677 - 0.015027048280671555719i )) > __CZ__eps ){ - epsilon(eps); - return 6; - } - if( abs(polygamma( 2,-5.5-5.5i ) - ( -0.00136603933402926677 + 0.015027048280671555719i )) > __CZ__eps ){ - epsilon(eps); - return 7; - } - epsilon(eps); - return 0; + return 0; } -/* test 05 tests hurwitzzeta(s,a) for the following values. the first two test if - * the arguments are in the right order. - * - * s a hurwitzzeta(s,a) - * 2 5 0.2213229557371153253613040555 - * 5 2 0.03692775514336992633136548646 - * 2.2 5 0.1363459661171646798298971735 - * 2.2 5.2 0.1294703948013920875737274341 - * -2.2 5.2 -43.62740512741650992650645550 - * -2.2 -5.2 65.71970386778362403451264243 + 47.73828461458444658816112446i - * 2.2 5.2+5.6i 0.03844077315966546674827814485-0.06625016367377721995234763811i - * 2.2 5.2-5.6i 0.03844077315966546674827814485+0.06625016367377721995234763811i - * 2.2 -5.2+5.6i -0.06570771621451414059240507315-0.02045673968185922880458837166i - * 2.2 -5.2-5.6i -0.06570771621451414059240507315+0.02045673968185922880458837166i - * -2.2 5.2+5.6i 171.3023982201237034174265227 - 61.37099215219445965540875817i - * -2.2 5.2-5.6i 171.3023982201237034174265227 - 61.37099215219445965540875820i - * -2.2 -5.2+5.6i -69.18353604795857246443145272 - 231.4707567406623523296345557i - * -2.2 -5.2-5.6i -69.18353604795857246443145272 + 231.4707567406623523296345557i - * - * 5.2+5.6i 2.2 -0.002865569533484339556271871050+0.0148003604570643921348488531i - * 5.2-5.6i 2.2 -0.002865569533484339556271871050-0.0148003604570643921348488531i - * -5.2+5.6i 2.2 -1.837761873462765905576370048 + 3.192719531152431336748963871i - * -5.2-5.6i 2.2 -1.837761873462765905576346060 - 3.192719531152431336748963871i - * 5.2+5.6i -2.2 95348834359.70315397408796804 - 162510500631.4367394107265635i - * 5.2-5.6i -2.2 0.9651349278612417712864108926 - 3.036274517135684343726981739i - * -5.2+5.6i -2.2 2002299780.711849103677017204 - 1543130375.266699195007479145i - * -5.2-5.6i -2.2 -0.2104165672779048392846890114 + 1.106842659781205784424725697i - * - * 5.2+5.6i 2.2+2.6i 0.1022857746468810493351322652 + 0.2344359367956833252781356236 i - * 5.2+5.6i 2.2-2.6i -0.000005879828833971610476305738830 -0.000001047520361040864830120054308i - * 5.2+5.6i -2.2+2.6i 254.99648763579325576522195-33.268146747986445163579145i - * 5.5+5.6i -2.2-2.6i -0.00000006966837525188576927163757061-0.000000051720089075957906725862754i - * test all combinations? +/* test 05 tests hurwitzzeta(s,a) for the following values. the first two test + * if the arguments are in the right order. + * test all combinations? */ -define t05(){ - local eps; - eps = epsilon(1e-20); - if( abs(hurwitzzeta( 2,5 ) - ( 0.2213229557371153253613040555 )) > __CZ__eps){ - epsilon(eps); - return 1; - } - if( abs(hurwitzzeta( 5,2 ) - ( 0.03692775514336992633136548646 )) > __CZ__eps){ - epsilon(eps); - return 2; - } - if( abs(hurwitzzeta( 2.2,5 ) - ( 0.1363459661171646798298971735 )) > __CZ__eps){ - epsilon(eps); - return 3; - } - if( abs(hurwitzzeta( 2.2,5.2 ) - ( 0.1294703948013920875737274341 )) > __CZ__eps){ - epsilon(eps); - return 4; - } - if( abs(hurwitzzeta( -2.2,5.2 ) - ( -43.62740512741650992650645550 )) > __CZ__eps){ - epsilon(eps); - return 5; - } - if( abs(hurwitzzeta( -2.2,-5.2 ) - ( 65.71970386778362403451264243 + 47.73828461458444658816112446i )) > __CZ__eps){ - epsilon(eps); - return 6; - } - if( abs(hurwitzzeta( 2.2,5.2+5.6i ) - ( 0.038440773159665466748278144 - 0.0662501636737772199523476381i )) > __CZ__eps){ - epsilon(eps); - return 7; - } - if( abs(hurwitzzeta( 2.2,5.2-5.6i ) - ( 0.038440773159665466748278144 + 0.06625016367377721995234763811i )) > __CZ__eps){ - epsilon(eps); - return 8; - } - if( abs(hurwitzzeta( 2.2,-5.2+5.6i ) - ( -0.06570771621451414059240507315-0.02045673968185922880458837166i )) > __CZ__eps){ - epsilon(eps); - return 9; - } - if( abs(hurwitzzeta( 2.2,-5.2-5.6i ) - ( -0.06570771621451414059240507315+0.02045673968185922880458837166i )) > __CZ__eps){ - epsilon(eps); - return 10; - } - if( abs(hurwitzzeta( -2.2,5.2+5.6i ) - ( 171.3023982201237034174265227 - 61.37099215219445965540875817i )) > __CZ__eps){ - epsilon(eps); - return 11; - } - if( abs(hurwitzzeta( -2.2,5.2-5.6i ) - ( 171.3023982201237034174265227 + 61.37099215219445965540875820i )) > __CZ__eps){ - epsilon(eps); - return 12; - } - if( abs(hurwitzzeta( -2.2,-5.2+5.6i ) - ( -69.18353604795857246443145272 - 231.4707567406623523296345557i )) > __CZ__eps){ - epsilon(eps); - return 13; - } - if( abs(hurwitzzeta( -2.2,-5.2-5.6i ) - ( -69.18353604795857246443145272 + 231.4707567406623523296345557i )) > __CZ__eps){ - epsilon(eps); - return 14; - } - if( abs(hurwitzzeta( 5.2+5.6i,2.2 ) - ( -0.002865569533484339556271871050+0.0148003604570643921348488531i )) > __CZ__eps){ - epsilon(eps); - return 15; - } - if( abs(hurwitzzeta( 5.2-5.6i,2.2 ) - ( -0.002865569533484339556271871050-0.0148003604570643921348488531i )) > __CZ__eps){ - epsilon(eps); - return 16; - } - if( abs(hurwitzzeta( -5.2+5.6i,2.2 ) - ( -1.837761873462765905576370048 + 3.192719531152431336748963871i )) > __CZ__eps){ - epsilon(eps); - return 17; - } - if( abs(hurwitzzeta( -5.2-5.6i,2.2 ) - ( -1.837761873462765905576346060 - 3.192719531152431336748963871i )) > __CZ__eps){ - epsilon(eps); - return 18; - } +define t05() +{ + local eps; + eps = epsilon(1e-20); + if (abs(hurwitzzeta(2, 5) - (0.2213229557371153253613040555)) > __CZ__eps) { + epsilon(eps); + return 1; + } + if (abs(hurwitzzeta(5, 2) - (0.03692775514336992633136548646)) > __CZ__eps){ + epsilon(eps); + return 2; + } + if (abs(hurwitzzeta(2.2, 5) - (0.1363459661171646798298971735))> __CZ__eps){ + epsilon(eps); + return 3; + } + if (abs(hurwitzzeta(2.2, 5.2) - (0.1294703948013920875737274341)) > + __CZ__eps) { + epsilon(eps); + return 4; + } + if (abs(hurwitzzeta(-2.2, 5.2) - (-43.62740512741650992650645550)) > + __CZ__eps) { + epsilon(eps); + return 5; + } + if (abs + (hurwitzzeta(-2.2, -5.2) - + (65.71970386778362403451264243 + 47.73828461458444658816112446i)) > + __CZ__eps) { + epsilon(eps); + return 6; + } + if (abs + (hurwitzzeta(2.2, 5.2 + 5.6i) - + (0.038440773159665466748278144 - 0.0662501636737772199523476381i)) > + __CZ__eps) { + epsilon(eps); + return 7; + } + if (abs + (hurwitzzeta(2.2, 5.2 - 5.6i) - + (0.038440773159665466748278144 + 0.06625016367377721995234763811i)) > + __CZ__eps) { + epsilon(eps); + return 8; + } + if (abs + (hurwitzzeta(2.2, -5.2 + 5.6i) - + (-0.06570771621451414059240507315 - + 0.02045673968185922880458837166i)) > __CZ__eps) { + epsilon(eps); + return 9; + } + if (abs + (hurwitzzeta(2.2, -5.2 - 5.6i) - + (-0.06570771621451414059240507315 + + 0.02045673968185922880458837166i)) > __CZ__eps) { + epsilon(eps); + return 10; + } + if (abs + (hurwitzzeta(-2.2, 5.2 + 5.6i) - + (171.3023982201237034174265227 - 61.37099215219445965540875817i)) > + __CZ__eps) { + epsilon(eps); + return 11; + } + if (abs + (hurwitzzeta(-2.2, 5.2 - 5.6i) - + (171.3023982201237034174265227 + 61.37099215219445965540875820i)) > + __CZ__eps) { + epsilon(eps); + return 12; + } + if (abs + (hurwitzzeta(-2.2, -5.2 + 5.6i) - + (-69.18353604795857246443145272 - 231.4707567406623523296345557i)) > + __CZ__eps) { + epsilon(eps); + return 13; + } + if (abs + (hurwitzzeta(-2.2, -5.2 - 5.6i) - + (-69.18353604795857246443145272 + 231.4707567406623523296345557i)) > + __CZ__eps) { + epsilon(eps); + return 14; + } + if (abs + (hurwitzzeta(5.2 + 5.6i, 2.2) - + (-0.002865569533484339556271871050 + + 0.0148003604570643921348488531i)) > __CZ__eps) { + epsilon(eps); + return 15; + } + if (abs + (hurwitzzeta(5.2 - 5.6i, 2.2) - + (-0.002865569533484339556271871050 - + 0.0148003604570643921348488531i)) > __CZ__eps) { + epsilon(eps); + return 16; + } + if (abs + (hurwitzzeta(-5.2 + 5.6i, 2.2) - + (-1.837761873462765905576370048 + 3.192719531152431336748963871i)) > + __CZ__eps) { + epsilon(eps); + return 17; + } + if (abs + (hurwitzzeta(-5.2 - 5.6i, 2.2) - + (-1.837761873462765905576346060 - 3.192719531152431336748963871i)) > + __CZ__eps) { + epsilon(eps); + return 18; + } - if( abs(hurwitzzeta( 5.2+5.6i,-2.2 ) - ( 95348834359.70315397408796804 - 162510500631.4367394107265635i )) > __CZ__eps){ - epsilon(eps); - ##return 19; - } - if( abs(hurwitzzeta( 5.2-5.6i,-2.2 ) - ( 0.9651349278612417712864108926 - 3.036274517135684343726981739i )) > __CZ__eps){ - epsilon(eps); - return 20; - } + if (abs + (hurwitzzeta(5.2 + 5.6i, -2.2) - + (95348834359.70315397408796804 - 162510500631.4367394107265635i)) > + __CZ__eps) { + epsilon(eps); +##return 19; + } + if (abs + (hurwitzzeta(5.2 - 5.6i, -2.2) - + (0.9651349278612417712864108926 - 3.036274517135684343726981739i)) > + __CZ__eps) { + epsilon(eps); + return 20; + } - if( abs(hurwitzzeta( -5.2+5.6i,-2.2 ) - ( 2002299780.711849103677017204 - 1543130375.266699195007479145i )) > __CZ__eps){ + if (abs + (hurwitzzeta(-5.2 + 5.6i, -2.2) - + (2002299780.711849103677017204 - 1543130375.266699195007479145i)) > + __CZ__eps) { + epsilon(eps); +##return 21; + } + if (abs + (hurwitzzeta(-5.2 - 5.6i, -2.2) - + (-0.2104165672779048392846890114 + 1.106842659781205784424725697i)) > + __CZ__eps) { + epsilon(eps); + return 22; + } + if (abs + (hurwitzzeta(5.2 + 5.6i, 2.2 + 2.6i) - + (0.10228577464688104933513226525 + 0.2344359367956833252781356235i)) > + __CZ__eps) { + epsilon(eps); + return 23; + } + if (abs + (hurwitzzeta(5.2 + 5.6i, 2.2 - 2.6i) - + (-0.000005879828833971610476305738830 - + 0.000001047520361040864830120054308i)) > __CZ__eps) { + epsilon(eps); + return 24; + } + if (abs + (hurwitzzeta(5.2 + 5.6i, -2.2 + 2.6i) - + (330.37403168831191021183 + 207.41259747950966196661i)) > __CZ__eps) { + epsilon(eps); +##return 25; + } + if (abs + (hurwitzzeta(5.2 + 5.6i, -2.2 - 2.6i) - + (-0.0000000696683752518857692716375 - + 0.0000000517200890759579067258627i)) > __CZ__eps) { + epsilon(eps); +##return 26; + } epsilon(eps); - ##return 21; - } - if( abs(hurwitzzeta( -5.2-5.6i,-2.2 ) - ( -0.2104165672779048392846890114 + 1.106842659781205784424725697i )) > __CZ__eps){ - epsilon(eps); - return 22; - } - if( abs(hurwitzzeta( 5.2+5.6i,2.2+2.6i ) - ( 0.10228577464688104933513226525 + 0.2344359367956833252781356235i )) > __CZ__eps){ - epsilon(eps); - return 23; - } - if( abs(hurwitzzeta( 5.2+5.6i,2.2-2.6i ) - ( -0.000005879828833971610476305738830 -0.000001047520361040864830120054308i )) > __CZ__eps){ - epsilon(eps); - return 24; - } - if( abs(hurwitzzeta( 5.2+5.6i,-2.2+2.6i ) - ( 330.37403168831191021183 + 207.41259747950966196661i )) > __CZ__eps){ - epsilon(eps); - ##return 25; - } - if( abs(hurwitzzeta( 5.2+5.6i,-2.2-2.6i ) - ( -0.0000000696683752518857692716375 - 0.0000000517200890759579067258627i )) > __CZ__eps){ - epsilon(eps); - ##return 26; - } - epsilon(eps); - return 0; + return 0; } -/* test 06 tests zeta(s) for the following values. - * - * 2 1.644934066848226436472415167 - * 1 error - * 3 1.202056903159594285399738162 - * -3 1/120 - * 5.5+5.6i 0.9829916458246897306781279065 + 0.01804690180657353497603622245i - * 5.2-5.6i 0.9829916458246897306781279065 - 0.01804690180657353497603622245 - * -5.2+5.6i -1.101851386544252162781870264 - 0.1426833937495229821744935458i - * -5.2-5.6i -1.101851386544252162781870264 + 0.1426833937495229821744935458i +/* test 06 tests zeta(s) * * Zero with smallest imaginary part * 1/2+14.13472514173469379045725198i 0 */ -define t06(){ - local eps; - eps = epsilon(1e-20); - if( abs(zeta( 2 )-( 1.644934066848226436472415167)) > __CZ__eps){ +define t06() +{ + local eps; + eps = epsilon(1e-20); + if (abs(zeta(2) - (1.644934066848226436472415167)) > __CZ__eps) { + epsilon(eps); + return 1; + } + if (!iserror(zeta(1))) { + epsilon(eps); + return 2; + } + if (abs(zeta(3) - (1.202056903159594285399738162)) > __CZ__eps) { + epsilon(eps); + return 3; + } + if (abs(zeta(-3) - (1 / 120)) > __CZ__eps) { + epsilon(eps); + return 4; + } + if (abs + (zeta(5.5 + 5.6i) - + (0.985921045907062298613817 + 0.014724913951794894908415i)) > + __CZ__eps) { + epsilon(eps); + return 5; + } + if (abs + (zeta(5.2 - 5.6i) - + (0.9829916458246897306781279065 - 0.01804690180657353497603622245i)) > + __CZ__eps) { + epsilon(eps); + return 6; + } + if (abs + (zeta(-5.2 + 5.6i) - + (-1.101851386544252162781870264 - 0.1426833937495229821744935458i)) > + __CZ__eps) { + epsilon(eps); + return 7; + } + if (abs + (zeta(-5.2 - 5.6i) - + (-1.101851386544252162781870264 + 0.1426833937495229821744935458i)) > + __CZ__eps) { + epsilon(eps); + return 8; + } epsilon(eps); - return 1; - } - if( !iserror(zeta( 1 ) )){ - epsilon(eps); - return 2; - } - if( abs(zeta( 3 )-( 1.202056903159594285399738162)) > __CZ__eps){ - epsilon(eps); - return 3; - } - if( abs(zeta( -3 )-( 1/120)) > __CZ__eps){ - epsilon(eps); - return 4; - } - if( abs(zeta( 5.5+5.6i )-( 0.985921045907062298613817 + 0.014724913951794894908415i )) > __CZ__eps){ - epsilon(eps); - return 5; - } - if( abs(zeta( 5.2-5.6i )-( 0.9829916458246897306781279065 - 0.01804690180657353497603622245i)) > __CZ__eps){ - epsilon(eps); - return 6; - } - if( abs(zeta( -5.2+5.6i )-( -1.101851386544252162781870264 - 0.1426833937495229821744935458i)) > __CZ__eps){ - epsilon(eps); - return 7; - } - if( abs(zeta( -5.2-5.6i )-( -1.101851386544252162781870264 + 0.1426833937495229821744935458i)) > __CZ__eps){ - epsilon(eps); - return 8; - } - epsilon(eps); - return 0; + return 0; } -/* test 07 tests harmonic(limit) for the following values. - * - * 0 error - * 1 1 - * 3 11/6 - * 10 7381/2520 - * 100 14466636279520351160221518043104131447711/2788815009188499086581352357412492142272 - */ -define t07(){ - local eps; - eps = epsilon(1e-20); - if( !iserror(harmonic( 0 ) )){ +define t07() +{ + local eps; + eps = epsilon(1e-20); + if (!iserror(harmonic(0))) { + epsilon(eps); + return 1; + } + if (harmonic(1) - 1 != 0) { + epsilon(eps); + return 2; + } + if (harmonic(3) - 11 / 6 != 0) { + epsilon(eps); + return 3; + } + if (harmonic(10) - 7381 / 2520 != 0) { + epsilon(eps); + return 4; + } + if (harmonic(100) - (14466636279520351160221518043104131447711 / + 2788815009188499086581352357412492142272) != 0) { + epsilon(eps); + return 5; + } epsilon(eps); - return 1; - } - if( harmonic( 1 ) - 1 != 0){ + return 0; +} +define t08() +{ + local eps; + eps = epsilon(1e-20); + if ((doublefactorial(10) - 3840) != 0) { + epsilon(eps); + return 1; + } + + if ((doublefactorial(11) - 10395) != 0) { + epsilon(eps); + return 2; + } + + if (abs((doublefactorial(-11) - (-1 / 945))) > __CZ__eps) { + epsilon(eps); + return 3; + } + + if (!iserror(doublefactorial(-10))) { + epsilon(eps); + return 4; + } + + if (abs + ((doublefactorial(5.2) - + 18.37288214375756118207669378072506887684550012806364822857845)) > + __CZ__eps) { + epsilon(eps); + return 7; + } + if (abs + ((doublefactorial(-5.2) - + 0.310704476688173329838586027938765271259515590892296917353047)) > + __CZ__eps) { + epsilon(eps); + return 8; + } epsilon(eps); - return 2; - } - if( harmonic( 3 ) - 11/6 != 0){ + return 0; +} +define t09() +{ + local eps; + eps = epsilon(1e-20); + if ((stirling1(10, 0) - (0)) != 0) { + epsilon(eps); + return 1; + } + if ((stirling1(0, 10) - (0)) != 0) { + epsilon(eps); + return 2; + } + if ((stirling1(0, 0) - (1)) != 0) { + epsilon(eps); + return 3; + } + if ((stirling1(10, 10) - (1)) != 0) { + epsilon(eps); + return 4; + } + if ((stirling1(10, 1) - (-362880)) != 0) { + epsilon(eps); + return 5; + } + if ((stirling1(10, 5) - (-269325)) != 0) { + epsilon(eps); + return 6; + } epsilon(eps); - return 3; - } - if( harmonic( 10 ) - 7381/2520 != 0){ - epsilon(eps); - return 4; - } - if( harmonic( 100 ) - (14466636279520351160221518043104131447711/2788815009188499086581352357412492142272) != 0){ - epsilon(eps); - return 5; - } - epsilon(eps); - return 0; + return 0; } -/* test 08 tests doublefactorial(n) for the following values - * - * 10 3840 - * 11 10395 - * -11 1/3 - * -10 error - * 111 3853986162502645785712150546541904653309504195240303679678670940619904075006404195556640625 - * -111 -1/34720596058582394465875230149026168047833371128291024141249287753332469144201839599609375 - * 5.2 18.37288214375756118207669378072506887684550012806364822857845 - * -5.2 0.310704476688173329838586027938765271259515590892296917353047 - * - */ -define t08(){ - local eps; - eps = epsilon(1e-20); - if( (doublefactorial( 10 ) - 3840) != 0){ +define t010() +{ + local eps; + eps = epsilon(1e-20); + if ((stirling2(10, 0) - (0)) != 0) { + epsilon(eps); + return 1; + } + if ((stirling2(0, 10) - (0)) != 0) { + epsilon(eps); + return 2; + } + if ((stirling2(0, 0) - (1)) != 0) { + epsilon(eps); + return 3; + } + if ((stirling2(10, 10) - (1)) != 0) { + epsilon(eps); + return 4; + } + if ((stirling2(10, 1) - (1)) != 0) { + epsilon(eps); + return 5; + } + if ((stirling2(10, 5) - (42525)) != 0) { + epsilon(eps); + return 6; + } epsilon(eps); - return 1; - } - - if( (doublefactorial(11 ) - 10395) != 0){ + return 0; +} +define t011() +{ + local eps; + eps = epsilon(1e-20); + if ((stirling2caching(10, 0) - (0)) != 0) { + epsilon(eps); + return 1; + } + if ((stirling2caching(0, 10) - (0)) != 0) { + epsilon(eps); + return 2; + } + if ((stirling2caching(0, 0) - (1)) != 0) { + epsilon(eps); + return 3; + } + if ((stirling2caching(10, 10) - (1)) != 0) { + epsilon(eps); + return 4; + } + if ((stirling2caching(10, 1) - (1)) != 0) { + epsilon(eps); + return 5; + } + if ((stirling2caching(10, 5) - (42525)) != 0) { + epsilon(eps); + return 6; + } epsilon(eps); - return 2; - } - - if( abs((doublefactorial(-11 ) - (-1/945))) > __CZ__eps){ - epsilon(eps); - return 3; - } - - if( !iserror(doublefactorial(-10))){ - epsilon(eps); - return 4; - } - - if( (doublefactorial(111 ) - 3853986162502645785712150546541904653309504195240303679678670940619904075006404195556640625) != 0){ - epsilon(eps); - return 5; - } - - if( abs((doublefactorial(-111 ) - -1/34720596058582394465875230149026168047833371128291024141249287753332469144201839599609375))> __CZ__eps){ - epsilon(eps); - return 6; - } - - if( abs((doublefactorial(5.2 ) - 18.37288214375756118207669378072506887684550012806364822857845))> __CZ__eps ){ - epsilon(eps); - return 7; - } - if( abs((doublefactorial(-5.2 ) - 0.310704476688173329838586027938765271259515590892296917353047))> __CZ__eps ){ - epsilon(eps); - return 8; - } - epsilon(eps); - return 0; + return 0; } -/* test 09 tests stirling1(n,m) for the following values - * - * n m - * 10 0 0 - * 0 10 0 - * 0 0 1 - * 10 10 1 - * 10 1 -362880 - * 10 5 -269325 - * 100 50 3183222782352964384744354120729686064175609439397055063\ - * 717578668769227113071836382198739697421125692626030268475 - */ -define t09(){ - local eps; - eps = epsilon(1e-20); - if( (stirling1(10,0)-(0))!=0){ +define t012() +{ + local eps; + eps = epsilon(1e-20); + if ((bell(0) - (1)) != 0) { + epsilon(eps); + return 1; + } + if ((bell(1) - (1)) != 0) { + epsilon(eps); + return 2; + } epsilon(eps); - return 1; - } - if( (stirling1(0,10)-(0))!=0){ - epsilon(eps); - return 2; - } - if( (stirling1(0,0)-(1))!=0){ - epsilon(eps); - return 3; - } - if( (stirling1(10,10)-(1))!=0){ - epsilon(eps); - return 4; - } - if( (stirling1(10,1)-(-362880))!=0){ - epsilon(eps); - return 5; - } - if( (stirling1(10,5)-(-269325))!=0){ - epsilon(eps); - return 6; - } - if( (stirling1(100,50)-(3183222782352964384744354120729686064175609439397055063717578668769227113071836382198739697421125692626030268475))!=0){ - epsilon(eps); - return 7; - } - epsilon(eps); - return 0; + if ((bell(2) - (2)) != 0) { + epsilon(eps); + return 3; + } + if ((bell(5) - (52)) != 0) { + epsilon(eps); + return 4; + } + if ((bell(10) - (115975)) != 0) { + epsilon(eps); + return 5; + } + return 0; } -/* test 10 tests stirling2(n,m) for the following values - * - * n m - * 10 0 1 - * 0 10 0 - * 0 0 1 - * 10 10 1 - * 10 1 1 - * 10 5 42525 - * 100 50 43098323700936634042151430154725869594352028961434061391244174113128031\ - * 9058853783145598261659992013900 - */ -define t010(){ - local eps; - eps = epsilon(1e-20); - if( (stirling2(10,0)-(0))!=0){ +define t013() +{ + local eps; + eps = epsilon(1e-20); + if ((subfactorial(0) - (1)) != 0) { + epsilon(eps); + return 1; + } + if ((subfactorial(1) - (0)) != 0) { + epsilon(eps); + return 2; + } + if ((subfactorial(10) - (1334961)) != 0) { + epsilon(eps); + return 3; + } epsilon(eps); - return 1; - } - if( (stirling2(0,10)-(0))!=0){ - epsilon(eps); - return 2; - } - if( (stirling2(0,0)-(1))!=0){ - epsilon(eps); - return 3; - } - if( (stirling2(10,10)-(1))!=0){ - epsilon(eps); - return 4; - } - if( (stirling2(10,1)-(1))!=0){ - epsilon(eps); - return 5; - } - if( (stirling2(10,5)-(42525))!=0){ - epsilon(eps); - return 6; - } - if( (stirling2(100,50)-( 430983237009366340421514301547258695943520289614340613912441741131280319058853783145598261659992013900 ))!=0){ - epsilon(eps); - return 7; - } - epsilon(eps); - return 0; + return 0; } -/* test 11 tests stirling2caching(n,m) for the following values - * - * n m - * 10 0 0 - * 0 10 0 - * 0 0 1 - * 10 10 1 - * 10 1 1 - * 10 5 42525 - * 100 50 43098323700936634042151430154725869594352028961434061391244174113128031\ - * 9058853783145598261659992013900 - */ -define t011(){ - local eps; - eps = epsilon(1e-20); - if( (stirling2caching(10,0)-(0))!=0){ +define t014() +{ + local eps; + eps = epsilon(1e-20); + if ((risingfactorial(1, 0) - (1)) != 0) { + epsilon(eps); + return 1; + } + if ((risingfactorial(10, 5) - (240240)) != 0) { + epsilon(eps); + return 2; + } + if (abs(risingfactorial(10.5, 5.5) - (1153886.265503555482030983579)) > + __CZ__eps) { + epsilon(eps); +##return 3; + } + if (abs + (risingfactorial(5.5 + 5.6i, 2.2 + 2.6i) - + (3.368463696973104283045428256 + 14.07030243790744467421234172i)) > + __CZ__eps) { + epsilon(eps); + return 4; + } epsilon(eps); - return 1; - } - if( (stirling2caching(0,10)-(0))!=0){ - epsilon(eps); - return 2; - } - if( (stirling2caching(0,0)-(1))!=0){ - epsilon(eps); - return 3; - } - if( (stirling2caching(10,10)-(1))!=0){ - epsilon(eps); - return 4; - } - if( (stirling2caching(10,1)-(1))!=0){ - epsilon(eps); - return 5; - } - if( (stirling2caching(10,5)-(42525))!=0){ - epsilon(eps); - return 6; - } - if( (stirling2caching(100,50)-( 430983237009366340421514301547258695943520289614340613912441741131280319058853783145598261659992013900 ))!=0){ - epsilon(eps); - return 7; - } - epsilon(eps); - return 0; + return 0; } -/* test 12 tests bell(n) for the following values - * - * 0 1 - * 1 1 - * 2 2 - * 5 52 - * 10 115975 - * 100 47585391276764833658790768841387207826363669686825611466616334637559114\ - * 497892442622672724044217756306953557882560751 - */ -define t012(){ - local eps; - eps = epsilon(1e-20); - if( (bell(0)-(1))!=0){ +define t015() +{ + local eps; + eps = epsilon(1e-20); + if ((bigcatalan(0) - (1)) != 0) { + epsilon(eps); + return 1; + } + if ((bigcatalan(1) - (1)) != 0) { + epsilon(eps); + return 2; + } + if ((bigcatalan(10) - (16796)) != 0) { + epsilon(eps); + return 3; + } + if ((bigcatalan(100) - + (896519947090131496687170070074100632420837521538745909320)) != 0) { + epsilon(eps); + return 4; + } epsilon(eps); - return 1; - } - if( (bell(1)-(1))!=0){ - epsilon(eps); - return 2; - } epsilon(eps); - if( (bell(2)-(2))!=0){ - epsilon(eps); - return 3; - } - if( (bell(5)-(52))!=0){ - epsilon(eps); - return 4; - } - if( (bell(10)-(115975))!=0){ - epsilon(eps); - return 5; - } - if( (bell(100)-( 47585391276764833658790768841387207826363669686825611466616334637559114497892442622672724044217756306953557882560751 ))!=0){ - epsilon(eps); - return 6; - } - return 0; + return 0; } -/* test 13 tests subfactorial(n) for the following values - * - * 0 1 - * 1 0 - * 10 1334961 - * 100 3433279598416380476519597752677614203236578380537578498354340028268\ - * 5180793327632432791396429850988990237345920155783984828001486412574\ - * 060553756854137069878601 - */ -define t013(){ - local eps; - eps = epsilon(1e-20); - if( (subfactorial(0)-(1))!=0){ +define t016() +{ + local eps; + eps = epsilon(1e-20); + if ((binomial(0, 0) - (1)) != 0) { + epsilon(eps); + return 1; + } + if ((binomial(1, 0) - (1)) != 0) { + epsilon(eps); + return 2; + } + if ((binomial(10, 5) - (252)) != 0) { + epsilon(eps); + return 3; + } + if ((binomial(100, 50) - (100891344545564193334812497256)) != 0) { + epsilon(eps); + return 4; + } + if ((binomial(1000, 500) - (comb(1000, 500))) != 0) { + epsilon(eps); + return 5; + } epsilon(eps); - return 1; - } - if( (subfactorial(1)-(0))!=0){ - epsilon(eps); - return 2; - } - if( (subfactorial(10)-(1334961))!=0){ - epsilon(eps); - return 3; - } - if( (subfactorial(100)-( 34332795984163804765195977526776142032365783805375784983543400282685180793327632432791396429850988990237345920155783984828001486412574060553756854137069878601 ))!=0){ - epsilon(eps); - return 4; - } - - epsilon(eps); - return 0; + return 0; } -/* test 14 tests risingfactorial(x,n) for the following values - * - * x n - * 1 0 1 - * 10 5 240240 - * 10.5 5.5 1153886.265503555482030983579 - * 5.5+5.6i 2.2+2.6i 3.368463696973104283045428256 + 14.07030243790744467421234172i - * - */ -define t014(){ - local eps; - eps = epsilon(1e-20); - if( (risingfactorial(1,0)-(1))!=0){ +define t017() +{ + local eps; + eps = epsilon(1e-20); + + if ((factorial(20) - (2432902008176640000)) != 0) { + epsilon(eps); + return 1; + } + if ((factorial(100) - (100 !)) != 0) { + epsilon(eps); + return 2; + } epsilon(eps); - return 1; - } - if( (risingfactorial(10,5)-(240240))!=0){ - epsilon(eps); - return 2; - } - if( abs(risingfactorial(10.5,5.5)-( 1153886.265503555482030983579 ))> __CZ__eps){ - epsilon(eps); - ##return 3; - } - if( abs(risingfactorial( 5.5+5.6i,2.2+2.6i )-( 3.368463696973104283045428256 + 14.07030243790744467421234172i )) > __CZ__eps){ - epsilon(eps); - return 4; - } - epsilon(eps); - return 0; + return 0; } -/* test 15 tests bigcatalan(n) for the following values - * - * 0 1 - * 1 1 - * 10 16796 - * 100 896519947090131496687170070074100632420837521538745909320 - * - */ -define t015(){ - local eps; - eps = epsilon(1e-20); - if( (bigcatalan(0)-(1))!=0){ +define t018() +{ + local eps; + eps = epsilon(1e-20); + if ((primorial(3, 100) - (1152783981972759212376551073665878035)) != 0) { + epsilon(eps); + return 1; + } + if ((primorial(0, 20000) - (pfact(20000))) != 0) { + epsilon(eps); + return 2; + } + if ((primorial(50, 100) - (3749562977351496827)) != 0) { + epsilon(eps); + return 3; + } epsilon(eps); - return 1; - } - if( (bigcatalan(1)-(1))!=0){ - epsilon(eps); - return 2; - } - if( (bigcatalan(10)-(16796 ))!=0){ - epsilon(eps); - return 3; - } - if( (bigcatalan(100)-( 896519947090131496687170070074100632420837521538745909320 ))!=0){ - epsilon(eps); - return 4; - } - epsilon(eps); - return 0; + return 0; } -/* test 16 tests binomial(n,k) for the following values - * - * n k - * 0 0 1 - * 1 0 1 - * 10 5 252 - * 100 50 100891344545564193334812497256 - * - */ -define t016(){ - local eps; - eps = epsilon(1e-20); - if( (binomial(0,0)-(1))!=0){ +define t019() +{ + local eps; + eps = epsilon(1e-20); + if ((toomcook3(161 !, 171 !) - (161 ! *171 !)) != 0) { + epsilon(eps); + return 1; + } epsilon(eps); - return 1; - } - if( (binomial(1,0)-(1))!=0){ - epsilon(eps); - return 2; - } - if( (binomial(10,5)-(252))!=0){ - epsilon(eps); - return 3; - } - if( (binomial(100,50)-( 100891344545564193334812497256 ))!=0){ - epsilon(eps); - return 4; - } - if( (binomial(1000,500)-( comb(1000,500) ))!=0){ - epsilon(eps); - return 5; - } - epsilon(eps); - return 0; + return 0; } -/* test 17 tests factorial(n) for the following values - * - * 20 2432902008176640000 - * 100 9332621544394415268169923885626670049071596826438162146859296389521\ - * 7599993229915608941463976156518286253697920827223758251185210916864\ - * 000000000000000000000000 - */ -define t017(){ - local eps; - eps = epsilon(1e-20); - - if( (factorial(20)-( 2432902008176640000 ))!=0){ +define t020() +{ + local eps; + eps = epsilon(1e-20); + if ((toomcook3square(161 !) - (161 ! ^2)) != 0) { + epsilon(eps); + return 1; + } epsilon(eps); - return 1; - } - if( (factorial(100)-(100!))!=0){ - epsilon(eps); - return 2; - } - epsilon(eps); - return 0; + return 0; } -/* test 18 tests primorial(a,b) for the following values - * - * a b - * 3 100 1152783981972759212376551073665878035 - * 0 100 2305567963945518424753102147331756070 - * 50 100 3749562977351496827 - * - */ -define t018(){ - local eps; - eps = epsilon(1e-20); - if( (primorial(3,100)-(1152783981972759212376551073665878035))!=0){ +define t021() +{ + local eps; + eps = epsilon(1e-20); + if ((toomcook4(561 !, 571 !) - (561 ! *571 !)) != 0) { + epsilon(eps); + return 1; + } epsilon(eps); - return 1; - } - if( (primorial(0,20000)-(pfact(20000)))!=0){ - epsilon(eps); - return 2; - } - if( (primorial(50,100)-(3749562977351496827))!=0){ - epsilon(eps); - return 3; - } - epsilon(eps); - return 0; + return 0; } -/* test 19 tests toomcook3(a,b) for the following value - * - * a b - * 161! 171! (161!*171!) - * - */ -define t019(){ - local eps; - eps = epsilon(1e-20); - if( ( toomcook3( 161!,171! )-( 161!*171! ))!=0){ +define t022() +{ + local eps; + eps = epsilon(1e-20); + if ((toomcook4square(561 !) - (561 ! ^2)) != 0) { + epsilon(eps); + return 1; + } epsilon(eps); - return 1; - } - epsilon(eps); - return 0; + return 0; } -/* test 20 tests toomcook3square(a) for the following value - * - * a - * 161! (161!^2) - * - */ -define t020(){ - local eps; - eps = epsilon(1e-20); - if( ( toomcook3square( 161! )-( 161!^2 ))!=0){ +define t023() +{ + local eps; + eps = epsilon(1e-20); + if ((fallingfactorial(1, 0) - (1)) != 0) { + epsilon(eps); + return 1; + } + if ((fallingfactorial(10, 5) - (30240)) != 0) { + epsilon(eps); + return 2; + } + if (abs(fallingfactorial(10.5, 5.5) - (99161.85903301873714177523949)) > + __CZ__eps) { + epsilon(eps); + return 3; + } + if (abs + (fallingfactorial(5.5 + 5.6i, 2.2 + 2.6i) - + (9.29931208830258420309197062886 + 1.28691176641462072673306933720i)) > + __CZ__eps) { + epsilon(eps); + return 4; + } epsilon(eps); - return 1; - } - epsilon(eps); - return 0; + return 0; } -/* test 21 tests toomcook4(a,b) for the following value - * - * a b - * 561! 571! (561!*571!) - * - */ -define t021(){ - local eps; - eps = epsilon(1e-20); - if( ( toomcook4( 561!,571! )-( 561!*571! ))!=0){ +define t024() +{ + local eps; + eps = epsilon(1e-20); + if (abs + (gammainc(10.5, 5.5) - + (1.0911054922884267714587707298319763515031034460618e6)) > __CZ__eps) { + epsilon(eps); + return 1; + } + + if (abs + (gammainc(-10.5, 5.5) - + (4.2078651459391823080015064331563180161168802280640e-12)) > + __CZ__eps) { + epsilon(eps); + return 2; + } + + if (abs + (gammainc(-10.5, -5.5) - + (-2.6401218205477163162463853253112404396824684325226e-7 - + 9.9525091595256241288827723005552353976489914201570e-7i)) > + __CZ__eps) { + epsilon(eps); + return 3; + } + if (abs + (gammainc(1.5, .5) - + (0.71009105827755696037984229929040777357378308627454)) > __CZ__eps) { + epsilon(eps); + return 4; + } + if (abs + (gammainc(1.5, -.5) - + (0.88622692545275801364908374167057259139877472806119 + + 0.32085932483101833896117715124223338525178610972460i)) > __CZ__eps) { + epsilon(eps); + return 5; + } + if (abs + (gammainc(-1.5, -.5) - + (2.3632718012073547030642233111215269103967326081632 + + 3.9644835083455478417145204862038235291784113581824i)) > __CZ__eps) { + epsilon(eps); + return 6; + } + if (abs + (gammainc(1.6 + 2.3i, 2.3 + 1.4i) - + (-0.023112977574442024349110845737131658924522434973607 + + 0.070013601354006150597855752670117927127985847641410i)) > + __CZ__eps) { + epsilon(eps); + return 7; + } + if (abs + (gammainc(-1.6 + 2.3i, 2.3 + 1.4i) - + (0.00129628045952650890786497724124399230099593819048313 + + 0.00015977289383944841440851534670535231366264702893907i)) > + __CZ__eps) { + epsilon(eps); + return 8; + } + if (abs + (gammainc(1.6 + 2.3i, -2.3 + 1.4i) - + (0.08011526555206793146266272247818512925483090324121 + + 0.18864341054002800687777400618294098230871057870324i)) > __CZ__eps) { + epsilon(eps); + return 9; + } + if (abs + (gammainc(-1.6 + 2.3i, -2.3 + 1.4i) - + (-0.0011066646302249434949283340601015297970855623709232 + + 0.0066140667340761534747256896056105993963563038859892i)) > + __CZ__eps) { + epsilon(eps); + return 10; + } + if (abs + (gammainc(-1.6 + 2.3i, -2.3 - 1.4i) - + (-192.26502410894853081990761345498010642885875566887 - + 9.20687819570448375251655049593050937346609469761i)) > __CZ__eps) { + epsilon(eps); + return 11; + } + if (abs + (gammainc(-1.6 - 2.3i, -2.3 - 1.4i) - + (-0.0011066646302249434949283340601015297970855623709232 - + 0.0066140667340761534747256896056105993963563038859892i)) > + __CZ__eps) { + epsilon(eps); + return 11; + } epsilon(eps); - return 1; - } - epsilon(eps); - return 0; + return 0; } -/* test 22 tests toomcook4square(a) for the following value - * - * a - * 561! (561!^2) - * - */ -define t022(){ - local eps; - eps = epsilon(1e-20); - if( ( toomcook4square( 561! )-( 561!^2 ))!=0){ +define t025() +{ + local eps; + eps = epsilon(1e-20); + if (abs + (expoint(12) - (14959.5326663975288522924618760575328096988328805595)) > + __CZ__eps) { + epsilon(eps); + return 1; + } + if (abs + (expoint(-12) - + (-4.75108182467249393259461269666144183573679127590926e-7)) > + __CZ__eps) { + epsilon(eps); + return 2; + } + if (abs + (expoint(1.2) - + (2.44209228519265163972909726430649285323724645317842)) > __CZ__eps) { + epsilon(eps); + return 3; + } + if (abs + (expoint(-1.2) - + (-0.158408436851462561424955970710861738534157976840579)) > + __CZ__eps) { + epsilon(eps); + return 4; + } + if (abs + (expoint(12 + 12i) - + (1705.83261134074122070523718220504604600321580158721 - + 9839.85856317985996646693634577761869375870438645474i)) > __CZ__eps) { + epsilon(eps); + return 5; + } + if (abs + (expoint(12 - 12i) - + (1705.83261134074122070523718220504604600321580158721 + + 9839.85856317985996646693634577761869375870438645474i)) > __CZ__eps) { + epsilon(eps); + return 6; + } + if (abs + (expoint(-12 + 12i) - + (-3.4169734885007076190668662199892409755505147e-7 + + 3.14159259071528119035402366471290026841357196537325i)) > __CZ__eps) { + epsilon(eps); + return 7; + } + if (abs + (expoint(12i) - + (-0.04978000688411367559592120873699061022711118653376 + + 3.07576756832126998975847022375791405102780057904392i)) > __CZ__eps) { + epsilon(eps); + return 8; + } + if (abs + (expoint(-12i) - + (-0.04978000688411367559592120873699061022711118653376 - + 3.07576756832126998975847022375791405102780057904392i)) > __CZ__eps) { + epsilon(eps); + return 9; + } + /* problem with checking, result is correct for more than 20 dec. + digits starting from the left */ + if (abs + (expoint(120 + 12i) - + (8.56859444638801538211461026892024105606765234361709e49 - + 6.74517461831409343681783273107064901497483026647260e49i)) > + __CZ__eps) { +##epsilon(eps); +##return 10; + } + if (abs + (expoint(-120 + 12i) - + (+3.14159265358979323846264338327950288419716939937511i)) > + __CZ__eps) { + epsilon(eps); + return 11; + } + if (abs + (expoint(-120 - 12i) - + (-3.14159265358979323846264338327950288419716939937511i)) > + __CZ__eps) { + epsilon(eps); + return 12; + } epsilon(eps); - return 1; - } - epsilon(eps); - return 0; + return 0; } -define t023(){ - local eps; - eps = epsilon(1e-20); - if( (fallingfactorial(1,0)-( 1 ))!=0){ +define t026() +{ + local eps; + eps = epsilon(1e-20); + + if (abs(erf(-120 - 12i) - (-1)) > __CZ__eps) { + epsilon(eps); + return 1; + } + if (abs(erf(99.99) - (1)) > __CZ__eps) { + epsilon(eps); + return 2; + } + /* 45 dec. digits for eps=1e-50 */ + if (abs(erf(9.99) - (0.9999999999999999999999999999999999999999999974468)) > + __CZ__eps) { + epsilon(eps); + return 3; + } + if (abs + (erf(-2.3 - 1.4i) - + (-0.99424424422056398724487886415624629344477362313756 - + 0.00438943284364679943396666714992729629504347523747i)) > __CZ__eps) { + epsilon(eps); + return 4; + } + if (abs(erf(-2.3) - (-0.99885682340264334853465254061923085980585130855731)) + > __CZ__eps) { + epsilon(eps); + return 5; + } + if (abs(erf(2.3) - (0.99885682340264334853465254061923085980585130855731)) > + __CZ__eps) { + epsilon(eps); + return 6; + } + if (abs(erf(.99) - (0.83850806955536980357979023052992329627081601140813)) > + __CZ__eps) { + epsilon(eps); + return 7; + } + epsilon(eps); - return 1; - } - if( (fallingfactorial(10,5)-( 30240 ))!=0){ - epsilon(eps); - return 2; - } - if( abs(fallingfactorial(10.5,5.5)-( 99161.85903301873714177523949 ))> __CZ__eps){ - epsilon(eps); - return 3; - } - if( abs(fallingfactorial( 5.5+5.6i,2.2+2.6i )-( 9.29931208830258420309197062886 + 1.28691176641462072673306933720i )) > __CZ__eps){ - epsilon(eps); - return 4; - } - epsilon(eps); - return 0; + return 0; } -/* lower incomplete gamma function g(a,z) for arbitrary a,z */ -define t024(){ - local eps; - eps = epsilon(1e-20); - if( abs(gammainc(10.5,5.5)-( 1.0911054922884267714587707298319763515031034460618e6 ))> __CZ__eps){ +/* The rest of the error functions are just slight variations and get only one + test to check if they are implemented at all. */ +define t027() +{ + local eps; + eps = epsilon(1e-20); + if (abs(erfc(.99) - (0.16149193044463019642020976947007670372918398859187)) + > __CZ__eps) { + epsilon(eps); + return 1; + } epsilon(eps); - return 1; - } - - if( abs(gammainc(-10.5,5.5)-( 4.2078651459391823080015064331563180161168802280640e-12 ))> __CZ__eps){ - epsilon(eps); - return 2; - } - - if( abs(gammainc( -10.5,-5.5 )-( -2.6401218205477163162463853253112404396824684325226e-7 - 9.9525091595256241288827723005552353976489914201570e-7i ))> __CZ__eps){ - epsilon(eps); - return 3; - } - if( abs(gammainc( 1.5,.5 )-( 0.71009105827755696037984229929040777357378308627454 ))> __CZ__eps){ - epsilon(eps); - return 4; - } - if( abs(gammainc( 1.5,-.5 )-( 0.88622692545275801364908374167057259139877472806119 + 0.32085932483101833896117715124223338525178610972460i ))> __CZ__eps){ - epsilon(eps); - return 5; - } - if( abs(gammainc( -1.5,-.5 )-( 2.3632718012073547030642233111215269103967326081632 + 3.9644835083455478417145204862038235291784113581824i ))> __CZ__eps){ - epsilon(eps); - return 6; - } - if( abs(gammainc( 1.6+2.3i, 2.3+1.4i)-( -0.023112977574442024349110845737131658924522434973607 + 0.070013601354006150597855752670117927127985847641410i ))> __CZ__eps){ - epsilon(eps); - return 7; - } - if( abs(gammainc( -1.6+2.3i, 2.3+1.4i )-( 0.00129628045952650890786497724124399230099593819048313 + 0.00015977289383944841440851534670535231366264702893907i ))> __CZ__eps){ - epsilon(eps); - return 8; - } - if( abs(gammainc( 1.6+2.3i, -2.3+1.4i )-( 0.08011526555206793146266272247818512925483090324121 + 0.18864341054002800687777400618294098230871057870324i ))> __CZ__eps){ - epsilon(eps); - return 9; - } - if( abs(gammainc( -1.6+2.3i, -2.3+1.4i )-( -0.0011066646302249434949283340601015297970855623709232 + 0.0066140667340761534747256896056105993963563038859892i ))> __CZ__eps){ - epsilon(eps); - return 10; - } - if( abs(gammainc( -1.6+2.3i, -2.3-1.4i )-( -192.26502410894853081990761345498010642885875566887 - 9.20687819570448375251655049593050937346609469761i ))> __CZ__eps){ - epsilon(eps); - return 11; - } - if( abs(gammainc( -1.6-2.3i, -2.3-1.4i )-( -0.0011066646302249434949283340601015297970855623709232 - 0.0066140667340761534747256896056105993963563038859892i ))> __CZ__eps){ - epsilon(eps); - return 11; - } - epsilon(eps); - return 0; + return 0; } -/* exponential integral Ei(z) for arbitrary z */ -define t025(){ - local eps; - eps = epsilon(1e-20); - if( abs(expoint( 12)-( 14959.5326663975288522924618760575328096988328805595 ))> __CZ__eps){ +define t028() +{ + local eps; + eps = epsilon(1e-20); + if (abs(erfi(.99) - (1.6200569163157349040754017322766470558922229178510)) > + __CZ__eps) { + epsilon(eps); + return 1; + } epsilon(eps); - return 1; - } - if( abs(expoint(-12 )-( -4.75108182467249393259461269666144183573679127590926e-7 ))> __CZ__eps){ - epsilon(eps); - return 2; - } - if( abs(expoint(1.2 )-( 2.44209228519265163972909726430649285323724645317842 ))> __CZ__eps){ - epsilon(eps); - return 3; - } - if( abs(expoint(-1.2 )-( -0.158408436851462561424955970710861738534157976840579 ))> __CZ__eps){ - epsilon(eps); - return 4; - } - if( abs(expoint( 12+12i)-( 1705.83261134074122070523718220504604600321580158721 -9839.85856317985996646693634577761869375870438645474i ))> __CZ__eps){ - epsilon(eps); - return 5; - } - if( abs(expoint(12-12i )-( 1705.83261134074122070523718220504604600321580158721 +9839.85856317985996646693634577761869375870438645474i ))> __CZ__eps){ - epsilon(eps); - return 6; - } - if( abs(expoint(-12+12i )-( -3.4169734885007076190668662199892409755505147e-7 +3.14159259071528119035402366471290026841357196537325i ))> __CZ__eps){ - epsilon(eps); - return 7; - } - if( abs(expoint(12i )-( -0.04978000688411367559592120873699061022711118653376 + 3.07576756832126998975847022375791405102780057904392i ))> __CZ__eps){ - epsilon(eps); - return 8; - } - if( abs(expoint( -12i)-( -0.04978000688411367559592120873699061022711118653376 - 3.07576756832126998975847022375791405102780057904392i ))> __CZ__eps){ - epsilon(eps); - return 9; - } - /* problem with checking, result is correct for more than 20 dec. digits starting from the left */ - if( abs(expoint( 120+12i)-( 8.56859444638801538211461026892024105606765234361709e49 - 6.74517461831409343681783273107064901497483026647260e49i ))> __CZ__eps){ - ##epsilon(eps); - ##return 10; - } - if( abs(expoint( -120+12i)-( + 3.14159265358979323846264338327950288419716939937511i ))> __CZ__eps){ - epsilon(eps); - return 11; - } - if( abs(expoint( -120-12i)-( - 3.14159265358979323846264338327950288419716939937511i ))> __CZ__eps){ - epsilon(eps); - return 12; - } - epsilon(eps); - return 0; + return 0; } -/* error function erf(z) -2.3-1.4*I */ -define t026(){ - local eps; - eps = epsilon(1e-20); - - if( abs(erf( -120-12i)-( -1 ))> __CZ__eps){ +define t029() +{ + local eps; + eps = epsilon(1e-20); + if (abs + (faddeeva(.99) - + (0.37527356961800734273134990254630990179418484551111 + + 0.60796454197014723823608088189149188617146675891187i)) > __CZ__eps) { + epsilon(eps); + return 1; + } epsilon(eps); - return 1; - } - if( abs(erf( 99.99)-( 1 ))> __CZ__eps){ - epsilon(eps); - return 2; - } - /* 45 dec. digits for eps=1e-50 */ - if( abs(erf( 9.99)-( 0.9999999999999999999999999999999999999999999974468 ))> __CZ__eps){ - epsilon(eps); - return 3; - } - if( abs(erf( -2.3-1.4i)-( -0.99424424422056398724487886415624629344477362313756 - 0.00438943284364679943396666714992729629504347523747i ))> __CZ__eps){ - epsilon(eps); - return 4; - } - if( abs(erf( -2.3)-( -0.99885682340264334853465254061923085980585130855731 ))> __CZ__eps){ - epsilon(eps); - return 5; - } - if( abs(erf( 2.3)-( 0.99885682340264334853465254061923085980585130855731 ))> __CZ__eps){ - epsilon(eps); - return 6; - } - if( abs(erf(.99)-( 0.83850806955536980357979023052992329627081601140813 ))> __CZ__eps){ - epsilon(eps); - return 7; - } - - epsilon(eps); - return 0; -} - -/* The rest of the error functions are just slight variations and get only one test - to check if they are implemented at all. */ -/* complementary error function erfc(z) */ -define t027(){ - local eps; - eps = epsilon(1e-20); - if( abs(erfc(.99)-( 0.16149193044463019642020976947007670372918398859187 ))> __CZ__eps){ - epsilon(eps); - return 1; - } - epsilon(eps); - return 0; -} - -/* imaginary error function erfi(z) */ -define t028(){ - local eps; - eps = epsilon(1e-20); - if( abs(erfi(.99)-( 1.6200569163157349040754017322766470558922229178510 ))> __CZ__eps){ - epsilon(eps); - return 1; - } - epsilon(eps); - return 0; -} - -/* complex error function or Faddeeva function w(z) */ -define t029(){ - local eps; - eps = epsilon(1e-20); - if( abs(faddeeva(.99)-( 0.37527356961800734273134990254630990179418484551111 + 0.60796454197014723823608088189149188617146675891187i ))> __CZ__eps){ - epsilon(eps); - return 1; - } - epsilon(eps); - return 0; + return 0; } /* @@ -1350,208 +2628,405 @@ define t029(){ raise the precision internally for the beta function. And the moral of the story is... */ -/* beta function */ -define t030(){ - local eps; - eps = epsilon(1e-20); - if( abs(beta( 1.3+2.4i,-4.5-5.6i )-( 0.000034922633369217658778094854951087306276597448077494 - 0.000016960351329535510681653275397511166236842713819260i ))> __CZ__eps){ +define t030() +{ + local eps; + eps = epsilon(1e-20); + if (abs + (beta(1.3 + 2.4i, -4.5 - 5.6i) - + (0.000034922633369217658778094854951087306276597448077494 - + 0.000016960351329535510681653275397511166236842713819260i)) > + __CZ__eps) { + epsilon(eps); + return 1; + } epsilon(eps); - return 1; - } - epsilon(eps); - return 0; + return 0; } -/* regularized incomplete beta function */ -define t031(){ - local eps ; - eps = epsilon(1e-20); - if( abs(betainc(1/2 , 3, 2 )-( 5/16 ))> __CZ__eps){ - epsilon(eps); - return 1; - } - if( abs(betainc(1/2 ,3.2 , 2.2 )-( 0.32023348284114229739228778858728452204329664688830 ))> __CZ__eps){ - epsilon(eps); - return 2; - } - if( abs(betainc(1/exp(1) , 3.2 ,2.2 )-( 0.143501414415760044882767192140002923147960247904570923787840 ))> __CZ__eps){ - epsilon(eps); - return 3; - } - if( abs(betainc(1/exp(1) ,3.2+2.2i , 2.2+3.2i )-( 0.1920631154241732316251688573913064389571283459161802570675+0.05732686873367104592514061113957628848615221217965454321767i ))> __CZ__eps){ - epsilon(eps); - return 4; - } - if( abs(betainc( 1/exp(1),3.2-2.2i,2.2+3.2i )-( -1.607827926223643076788007453936176458240169077851360442476+0.3252661246098073645694057662278573284778244036835313591942i ))> __CZ__eps){ - epsilon(eps); - return 5; - } - if( abs(betainc( 1/exp(1),3.2-2.2i,2.2-3.2i )-( 0.1920631154241732316251688573913064389571283459161802570675 -0.05732686873367104592514061113957628848615221217965454321767i ))> __CZ__eps){ - epsilon(eps); - return 6; - } +define t031() +{ + local eps; + eps = epsilon(1e-20); + if (abs(betainc(1 / 2, 3, 2) - (5 / 16)) > __CZ__eps) { + epsilon(eps); + return 1; + } + if (abs + (betainc(1 / 2, 3.2, 2.2) - + (0.32023348284114229739228778858728452204329664688830)) > __CZ__eps) { + epsilon(eps); + return 2; + } + if (abs + (betainc(1 / exp(1), 3.2, 2.2) - + (0.143501414415760044882767192140002923147960247904570923787840)) > + __CZ__eps) { + epsilon(eps); + return 3; + } + if (abs + (betainc(1 / exp(1), 3.2 + 2.2i, 2.2 + 3.2i) - + (0.1920631154241732316251688573913064389571283459161802570675 + + 0.05732686873367104592514061113957628848615221217965454321767i)) > + __CZ__eps) { + epsilon(eps); + return 4; + } + if (abs + (betainc(1 / exp(1), 3.2 - 2.2i, 2.2 + 3.2i) - + (-1.607827926223643076788007453936176458240169077851360442476 + + 0.3252661246098073645694057662278573284778244036835313591942i)) > + __CZ__eps) { + epsilon(eps); + return 5; + } + if (abs + (betainc(1 / exp(1), 3.2 - 2.2i, 2.2 - 3.2i) - + (0.1920631154241732316251688573913064389571283459161802570675 - + 0.05732686873367104592514061113957628848615221217965454321767i)) > + __CZ__eps) { + epsilon(eps); + return 6; + } - if( abs(betainc(.3+.2i ,3.2-2.2i,2.2-3.2i )-( 0.14627145927962494526466549157120107465791647692488861570015 +0.34598256304551640762453165549710979002810660424791884148625i ))> __CZ__eps){ + if (abs + (betainc(.3 + .2i, 3.2 - 2.2i, 2.2 - 3.2i) - + (0.14627145927962494526466549157120107465791647692488861570015 + + 0.34598256304551640762453165549710979002810660424791884148625i)) > + __CZ__eps) { + epsilon(eps); + return 7; + } epsilon(eps); - return 7; - } - epsilon(eps); - return 0; + return 0; } -/* Bernoully polynomials */ -define t032(){ - local eps; - eps = epsilon(1e-20); - if( abs( bernpoly(1,10) ) - ( 19/2 )> __CZ__eps){ - epsilon(eps); - return 1; - } - if( abs( bernpoly(10,10) ) - ( 379041290105/66 )> __CZ__eps){ - epsilon(eps); - return 2; - } - if( abs( bernpoly(-10,10) ) - ( 0.00000000015893950304018571788968681852452102762225 )> __CZ__eps){ - epsilon(eps); - return 3; - } - if( abs( bernpoly(1.1,10) ) - ( 11.89799882840077795855328366923295539944336494342302 )> __CZ__eps){ - epsilon(eps); - return 4; - } - if( abs( bernpoly(3,1.1) ) - ( 33/500 )> __CZ__eps){ - epsilon(eps); - return 5; - } - if( abs( bernpoly(3,1.1+2.2i) ) - ( -8.646-8.822i )> __CZ__eps){ - epsilon(eps); - return 6; - } +define t032() +{ + local eps; + eps = epsilon(1e-20); + if (abs(bernpoly(1, 10)) - (19 / 2) > __CZ__eps) { + epsilon(eps); + return 1; + } + if (abs(bernpoly(10, 10)) - (379041290105 / 66) > __CZ__eps) { + epsilon(eps); + return 2; + } + if (abs(bernpoly(-10, 10)) - + (0.00000000015893950304018571788968681852452102762225) > __CZ__eps) { + epsilon(eps); + return 3; + } + if (abs(bernpoly(1.1, 10)) - + (11.89799882840077795855328366923295539944336494342302) > __CZ__eps) { + epsilon(eps); + return 4; + } + if (abs(bernpoly(3, 1.1)) - (33 / 500) > __CZ__eps) { + epsilon(eps); + return 5; + } + if (abs(bernpoly(3, 1.1 + 2.2i)) - (-8.646 - 8.822i) > __CZ__eps) { + epsilon(eps); + return 6; + } - epsilon(eps); - return 0; + epsilon(eps); + return 0; } -/* Lambert's W function */ -define t033(){ - local eps epsexp EM1; - eps = epsilon(1e-20); - /* The Omega-constant */ - if( abs( lambertw(1,0) - (0.567143290409783872999968662210355549753815787186512508135131 ))> __CZ__eps){ - epsilon(eps); - return 1; - } - if( abs( lambertw(-1,0) - ( -0.3181315052047641353126542515876645172035176138713998669223 +1.337235701430689408901162143193710612539502138460512418876i ))> __CZ__eps){ - epsilon(eps); - return 2; - } - if( abs( lambertw(-exp(-1),0) - ( -1 ))> __CZ__eps){ - epsilon(eps); - return 3; - } +define t033() +{ + local eps epsexp EM1; + eps = epsilon(1e-20); + /* The Omega-constant */ + if (abs + (lambertw(1, 0) - + (0.567143290409783872999968662210355549753815787186512508135131)) > + __CZ__eps) { + epsilon(eps); + return 1; + } + if (abs + (lambertw(-1, 0) - + (-0.3181315052047641353126542515876645172035176138713998669223 + + 1.337235701430689408901162143193710612539502138460512418876i)) > + __CZ__eps) { + epsilon(eps); + return 2; + } + if (abs(lambertw(-exp(-1), 0) - (-1)) > __CZ__eps) { + epsilon(eps); + return 3; + } /* We have to calculate -exp(1-) with higher precision here because the numbers we test against have been calculated with Mathematica(tm) and, - where possible, with the series, too with epsilon = 1e-200. + where possible, with the series, too, with epsilon = 1e-200. */ - epsexp = epsilon(epsilon()*1e-10); - EM1 = -exp(-1); - epsilon(epsexp); - if( abs( lambertw(EM1+.001,0) - ( -0.92802015005456704876004302525492122474886334787070023086031 ))> __CZ__eps){ - epsilon(eps); - return 4; - } + epsexp = epsilon(epsilon() * 1e-10); + EM1 = -exp(-1); + epsilon(epsexp); + if (abs + (lambertw(EM1 + .001, 0) - + (-0.92802015005456704876004302525492122474886334787070023086031)) > + __CZ__eps) { + epsilon(eps); + return 4; + } - if( abs( lambertw(EM1-.001,0) - ( -0.998190161498609890007959968479276047800779184376006463826 +0.0736719118893463857740469900181632551190421844567768514726i))> __CZ__eps){ - epsilon(eps); - return 5; - } + if (abs + (lambertw(EM1 - .001, 0) - + (-0.998190161498609890007959968479276047800779184376006463826 + + 0.0736719118893463857740469900181632551190421844567768514726i)) > + __CZ__eps) { + epsilon(eps); + return 5; + } - if( abs( lambertw_series(EM1-.001,epsilon(),0) - ( -0.998190161498609890007959968479276047800779184376006463826 +0.0736719118893463857740469900181632551190421844567768514726i ))> __CZ__eps){ + if (abs + (lambertw_series(EM1 - .001, epsilon(), 0) - + (-0.998190161498609890007959968479276047800779184376006463826 + + 0.0736719118893463857740469900181632551190421844567768514726i)) > + __CZ__eps) { + epsilon(eps); + return 6; + } + if (abs + (lambertw(-2.2 - 3.2i, -3) - + (-1.6104280970561586263262514675217857074068306154494786722437 - + 19.368888979715570028505505411206710993669557347359767961957i)) > + __CZ__eps) { + epsilon(eps); + return 1; + } epsilon(eps); - return 6; - } - if( abs( lambertw(-2.2-3.2i,-3) - ( -1.6104280970561586263262514675217857074068306154494786722437 -19.368888979715570028505505411206710993669557347359767961957i ))> __CZ__eps){ - epsilon(eps); - return 1; - } - epsilon(eps); - return 0; + return 0; } /* Test the logarithm list, a bit different from the tests above.*/ -define t034(){ - local eps sum k; - eps = epsilon(1e-20); +define t034() +{ + local eps sum k; + eps = epsilon(1e-20); - sum = 0; - lnseries(10000); - for(k=1;k<10000;k++){ - sum +=lnfromseries(k); - } + sum = 0; + lnseries(10000); + for (k = 1; k < 10000; k++) { + sum += lnfromseries(k); + } - if( abs( sum - lngamma(10000) )> __CZ__eps){ + if (abs(sum - lngamma(10000)) > __CZ__eps) { + epsilon(eps); + return 1; + } epsilon(eps); - return 1; - } - epsilon(eps); - return 0; + return 0; } -/* */ -define t035(){ +define t035() +{ + local eps; + eps = epsilon(1e-20); + if (abs(invbetainc(0, 1, 2) - (0)) > __CZ__eps) { + epsilon(eps); + return 1; + } + if (abs(invbetainc(1, 1, 2) - (1)) > __CZ__eps) { + epsilon(eps); + return 2; + } + if (abs + (invbetainc(.6, 2, 2) - + (0.567068922852268236254340214074933386511229358602804986856523)) > + __CZ__eps) { + epsilon(eps); + return 3; + } + if (abs + (invbetainc(.6, 200, 200) - + 0.50633738276018061834297937341956576111427477636401902379793) > + __CZ__eps) { + epsilon(eps); + return 4; + } + if (abs + (invbetainc(.6, 200, 100) - + 0.673912010450469394843418496081985274734344595591643614514860) > + __CZ__eps) { + epsilon(eps); + return 5; + } + if (abs + (invbetainc(.6, 100, 200) - + 0.339884769324050809456643025345905001680568878491743324211449) > + __CZ__eps) { + epsilon(eps); + return 6; + } +/* Percentiles. Numbers shamlessly stolen from a question at stackoverflow*/ + if (abs + (invbetainc(0.025, 10008, 151744) - + 0.060703546312525377697082321820950758320207425674954679415395) > + __CZ__eps) { + epsilon(eps); + return 7; + } + if (abs + (invbetainc(0.5, 10008, 151744) - + 0.061870690413044293003568412977601333629269461143858842860376) > + __CZ__eps) { + epsilon(eps); + return 8; + } + if (abs + (invbetainc(0.975, 10008, 151744) - + 0.063051707940007549704137764265896313422520123493324715525400) > + __CZ__eps) { + epsilon(eps); + return 9; + } + /* 3 sigma. But _way_ too slow. */ + if (abs + (invbetainc(0.997, 10008, 151744) - + 0.06353033717730117616403237097166742264875876591597) > __CZ__eps) { + epsilon(eps); + return 10; + } + + epsilon(eps); + return 0; +} + +/* Quadrature. Test values stolen, without any shame, from mpmath*/ +define f(x){return sin(x);} +define t036(){ local eps; eps = epsilon(1e-20); - if( abs( invbetainc(0,1,2) - ( 0 ) )> __CZ__eps){ + + if( abs( quadts(0,pi()) - 2 )> __CZ__eps){ epsilon(eps); return 1; } - if( abs( invbetainc(1,1,2) - ( 1 ) )> __CZ__eps){ + if( abs( quadts(0,pi()) - 2 )> __CZ__eps){ epsilon(eps); return 2; } - if( abs( invbetainc(.6,2,2) - ( 0.567068922852268236254340214074933386511229358602804986856523 ) )> __CZ__eps){ + epsilon(eps); + return 0; +} +/* every test would need an extra file +define f(x){ return 2/(x**2+1);} +define t037(){ + local eps; + eps = epsilon(1e-20); + + if( abs( quadts(0,pinf()) - pi() )> __CZ__eps){ + epsilon(eps); - return 3; + return 1; } - if( abs( invbetainc(.6,200,200) - 0.50633738276018061834297937341956576111427477636401902379793 )> __CZ__eps){ + if( abs( quadgl(0,pinf()) - pi() )> __CZ__eps){ + epsilon(eps); - return 4; + return 2; } - if( abs( invbetainc(.6,200,100) - 0.673912010450469394843418496081985274734344595591643614514860 )> __CZ__eps){ + undefine f; + epsilon(eps); + return 0; +} +define f(x){ return exp(-x^2);} +define t038(){ + local eps; + eps = epsilon(1e-20); + if( abs( quadgl(ninf(),pinf()) - sqrt(pi()) )> __CZ__eps){ + epsilon(eps); - return 5; + return 1; } - if( abs( invbetainc(.6,100,200) - 0.339884769324050809456643025345905001680568878491743324211449 - )> __CZ__eps){ + if( abs( quadts(ninf(),pinf()) - sqrt(pi()) )> __CZ__eps){ + epsilon(eps); - return 6; + return 2; } -/* Percentiles. Numbers shamlessly stolen from a question at stackoverflow*/ - if( abs( invbetainc(0.025,10008, 151744) - 0.060703546312525377697082321820950758320207425674954679415395 )> __CZ__eps){ + undefine f; + epsilon(eps); + return 0; +} +define f(x){ return 1/x; } +define t039(){ + local eps; + eps = epsilon(1e-20); + if( abs( quadts(1,1,mat[3]={1i,-1,-1i}) - 2i*pi() )> __CZ__eps){ + epsilon(eps); - return 7; + return 1; } - if( abs( invbetainc(0.5,10008, 151744) - 0.061870690413044293003568412977601333629269461143858842860376 )> __CZ__eps){ + if( abs( quadgl(1,1,mat[3]={1i,-1,-1i}) - 2i*pi() )> __CZ__eps){ + epsilon(eps); - return 8; + return 2; } - if( abs( invbetainc(0.975,10008, 151744) - 0.063051707940007549704137764265896313422520123493324715525400 )> __CZ__eps){ + undefine f; + epsilon(eps); + return 0; +} +define f(x){ return abs(sin(x));} +define t040(){ + local eps; + eps = epsilon(1e-20); + if( abs( quadts(0,2*pi(),mat[1]={pi()}) - 4 )> __CZ__eps){ + epsilon(eps); return 9; } - /* 3 sigma. But _way_ too slow. */ - if( abs( invbetainc(0.997,10008, 151744) - 0.06353033717730117616403237097166742264875876591597)> __CZ__eps){ + if( abs( quadgl(0,2*pi(),mat[1]={pi()}) - 4 )> __CZ__eps){ + epsilon(eps); return 10; } + undefine f; + epsilon(eps); + return 0; +} +*/ +/* Symbolic infinities */ +define t037(){ + local eps; + eps = epsilon(1e-20); + if( !isinfinite(cinf()) ){ + epsilon(eps); + return 1; + } + if( !isinfinite(pinf()) ){ + epsilon(eps); + return 2; + } + if( !isinfinite(ninf())){ + epsilon(eps); + return 3; + } + if(!iscinf(cinf()) ){ + epsilon(eps); + return 4; + } + if( !ispinf(pinf())){ + epsilon(eps); + return 5; + } + if(!isninf(ninf()) ){ + epsilon(eps); + return 6; + } epsilon(eps); return 0; } /* */ -/*define t036(){ +/*define t038(){ local eps; eps = epsilon(1e-20); if( abs( ) - ( )> __CZ__eps){ @@ -1563,6 +3038,7 @@ define t035(){ return 0; }*/ + /* * The main test8900 test section harness * @@ -1570,72 +3046,75 @@ define t035(){ * * testnum = test8900(1,, 8903); */ -define test8900(verbose=0, tnum, testnum=8903) +define test8900(verbose = 0, tnum, testnum = 8903) { - local n; - local err;/* do not forget to delete!*/ - local i, old_errmax; + local n; + local err; /* do not forget to delete! */ + local i, old_errmax; - /* - * parse args - */ - n = 35; /* number of subtests */ - if (isnull(verbose)) { - verbose = 0; - } - if (isnull(tnum)) { - tnum = 1; /* initial test number */ - } + /* + * parse args + */ + n = 37; /* number of subtests */ + if (isnull(verbose)) { + verbose = 0; + } + if (isnull(tnum)) { + tnum = 1; /* initial test number */ + } - /* - * run just one test - */ - else{ - err = eval( strcat("t0",str(tnum),"()" ) ); - if(verbose){ - if(err){ - print "*** error", err, - ": found in test8900.cal function test",strcat("t0",str(tnum) ); - } - else{ - print "no errors in test", strcat("t0",str(tnum) ); - } - } - return tnum; - } + /* + * run just one test + */ + else { + err = eval(strcat("t0", str(tnum), "()")); + if (verbose) { + if (err) { + print "*** error", err, + ": found in test8900.cal function test", strcat("t0", + str(tnum)); + } else { + print "no errors in test", strcat("t0", str(tnum)); + } + } + return tnum; + } - /* We will cause erors intentionally. A lot of them. */ - old_errmax = errmax(-1); + /* We will cause erors intentionally. A lot of them. */ + old_errmax = errmax(-1); - /* - * test a lot of stuff - */ - for (i=0; i < n; ++i) { + /* + * test a lot of stuff + */ + for (i = 0; i < n; ++i) { - /* run a test */ - err += eval( strcat("t0",str(tnum++),"()" ) ); + /* run a test */ + err += eval(strcat("t0", str(tnum++), "()")); - if(verbose) { - if (err) { - print "*** error", err, "in test", testnum: ":", - strcat("t0",str(tnum-1),"()" ), - " - ",eval( strcat("t0",str (tnum-1),"()" ) ) ; - } else { - print testnum: ": no errors in test", strcat("t0",str(tnum) ); - } - } - ++testnum; - } - if (verbose) { - if (err) { - print "***", testnum: ":", err, "error(s) found in test8900.cal"; - } else { - print testnum: ":", "no errors in test8900.cal"; - } - } + if (verbose) { + if (err) { + print "*** error", err, "in test", testnum:":", strcat("t0", + str(tnum - 1), "()"), + " - ", + eval(strcat("t0", str(tnum - 1), "()")); + } else { + print testnum:": no errors in test", strcat("t0", + str(tnum - 1)); + } + } ++testnum; + } + if (verbose) { + if (err) { + print "***", testnum:":", err, + "error(s) found in test8900.cal"; + } else { + print testnum:":", "no errors in test8900.cal"; + } + } + ++testnum; - /* restore error maximum */ - errmax(old_errmax); - return testnum; + /* restore error maximum */ + errmax(old_errmax); + return testnum; } diff --git a/cal/toomcook.cal b/cal/toomcook.cal index 857b934..9556dc9 100644 --- a/cal/toomcook.cal +++ b/cal/toomcook.cal @@ -1,13 +1,13 @@ /* - * Toom-Cook - implementation of Toom-Cook(3,4) multiplication algorithm + * toomcook - implementation of Toom-Cook(3,4) multiplication algorithm * * Copyright (C) 2013 Christoph Zurnieden * - * Toom-Cook is open software; you can redistribute it and/or modify it under + * 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. * - * Toom-Cook is distributed in the hope that it will be useful, but WITHOUT + * 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. @@ -17,8 +17,8 @@ * 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.3 $ - * @(#) $Id: toomcook.cal,v 30.3 2013/08/11 08:41:38 chongo Exp $ + * @(#) $Revision: 30.4 $ + * @(#) $Id: toomcook.cal,v 30.4 2013/08/18 20:01:53 chongo Exp $ * @(#) $Source: /usr/local/src/bin/calc/cal/RCS/toomcook.cal,v $ * * Under source code control: 2013/08/11 01:31:28 diff --git a/cal/zeta2.cal b/cal/zeta2.cal index d8c96fd..732d6ec 100644 --- a/cal/zeta2.cal +++ b/cal/zeta2.cal @@ -1,27 +1,29 @@ /* * zeta2 - Hurwitz Zeta function - * Copyright (C) 2013 Christoph Zurnieden - * Version: 0.0.1 - * Licence: GPL * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * 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. * - * This program 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 General Public License for more details. + * 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. * - * @(#) $Revision: 30.3 $ - * @(#) $Id: zeta2.cal,v 30.3 2013/08/11 08:41:38 chongo Exp $ + * 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.4 $ + * @(#) $Id: zeta2.cal,v 30.4 2013/08/18 20:01:53 chongo Exp $ * @(#) $Source: /usr/local/src/bin/calc/cal/RCS/zeta2.cal,v $ * * Under source code control: 2013/08/11 01:31:28 * File existed as early as: 2013 */ + /* * hide internal function from resource debugging */ diff --git a/calc.h b/calc.h index 06238e0..cc9591f 100644 --- a/calc.h +++ b/calc.h @@ -17,8 +17,8 @@ * 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.3 $ - * @(#) $Id: calc.h,v 30.3 2013/08/11 08:41:38 chongo Exp $ + * @(#) $Revision: 30.4 $ + * @(#) $Id: calc.h,v 30.4 2013/09/01 22:16:21 chongo Exp $ * @(#) $Source: /usr/local/src/bin/calc/RCS/calc.h,v $ * * Under source code control: 1990/02/15 01:48:31 @@ -140,7 +140,7 @@ E_FUNC int ftellid(FILEID id, ZVALUE *res); E_FUNC int fseekid(FILEID id, ZVALUE offset, int whence); E_FUNC int isattyid(FILEID id); E_FUNC int fsearch(FILEID id, char *str, ZVALUE start, ZVALUE end, ZVALUE *res); -E_FUNC int frsearch(FILEID id, char *str, ZVALUE first, ZVALUE last, +E_FUNC int frsearch(FILEID id, char *str, ZVALUE first, ZVALUE last, ZVALUE *res); E_FUNC void showconstants(void); E_FUNC void freeconstant(unsigned long); @@ -152,7 +152,7 @@ E_FUNC void trimconstants(void); */ E_FUNC int openstring(char *str, size_t num); E_FUNC int openterminal(void); -E_FUNC int opensearchfile(char *name, char *pathlist, char *exten, +E_FUNC int opensearchfile(char *name, char *pathlist, char *exten, int reopen_ok); E_FUNC char *nextline(void); E_FUNC int nextchar(void); diff --git a/calcerr.tbl b/calcerr.tbl index 4cf4c12..9a9484f 100644 --- a/calcerr.tbl +++ b/calcerr.tbl @@ -17,8 +17,8 @@ # 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: calcerr.tbl,v 30.1 2007/03/16 11:09:46 chongo Exp $ +# @(#) $Revision: 30.3 $ +# @(#) $Id: calcerr.tbl,v 30.3 2013/09/01 19:23:57 chongo Exp $ # @(#) $Source: /usr/local/src/bin/calc/RCS/calcerr.tbl,v $ # # Under source code control: 1996/05/23 17:38:44 @@ -32,6 +32,16 @@ # # SYMBOL meaning +###################################################################### +# WARNING: The order of the lines below is critical! If you change # +# the order, you will break code that depends on the return # +# value of the errno() builtin function. # +# # +# If you need to add values to this table, ONLY add then # +# to the bottom of the file! # +###################################################################### + + E_1OVER0 Division by zero E_0OVER0 Indeterminate (0/0) E_ADD Bad arguments for + @@ -449,3 +459,17 @@ E_FGETFILE1 Non-file argument for fgetfile E_FGETFILE2 File argument for fgetfile not open for reading E_FGETFILE3 Unable to set file position in fgetfile E_ESTR Non-representable type for estr +E_STRCASECMP Non-string argument for strcasecmp +E_STRNCASECMP Bad argument type for strncasecmp +E_ISUPPER Bad argument for isupper +E_ISLOWER Bad argument for islower +E_ISALNUM Bad argument for isalnum +E_ISALPHA Bad argument for isalpha +E_ISASCII Bad argument for isascii +E_ISCNTRL Bad argument for iscntrl +E_ISDIGIT Bad argument for isdigit +E_ISGRAPH Bad argument for isgraph +E_ISPRINT Bad argument for isprint +E_ISPUNCT Bad argument for ispunct +E_ISSPACE Bad argument for isspace +E_ISXDIGIT Bad argument for isxdigit diff --git a/custom/Makefile b/custom/Makefile index 73594fc..cb0c219 100644 --- a/custom/Makefile +++ b/custom/Makefile @@ -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.28 $ -# @(#) $Id: Makefile.head,v 30.28 2013/08/11 05:40:18 chongo Exp $ -# @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/Makefile.head,v $ +# @(#) $Revision: 30.29 $ +# @(#) $Id: Makefile.head,v 30.29 2013/08/17 01:22:19 chongo Exp $ +# @(#) $Source: /usr/local/src/bin/calc/custom/RCS/Makefile.head,v $ # # Under source code control: 1997/03/09 02:28:54 # File existed as early as: 1997 @@ -366,7 +366,7 @@ EXT= # The default calc versions # -VERSION= 2.12.4.10 +VERSION= 2.12.4.11 VERS= 2.12.4 VER= 2.12 VE= 2 @@ -473,16 +473,16 @@ LDFLAGS= ${LD_DEBUG} ${ILDFLAGS} # BLD_TYPE= calc-static-only # # CC_SHARE are flags given to ${CC} to build .o files suitable for shared libs -# DEFAULT_LIB_INSTALL_PATH is where calc progs look for calc shared libs +# DEFAULT_LIB_INSTALL_PATH is where calc programs look for calc shared libs # LD_SHARE are common flags given to ${CC} to link with shared libraries -# LIBCALC_SHLIB are flags given to ${CC} to build libcalc shared lib +# 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 # # 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 -# LIBCALC_STATIC are flags given to ${CC} to build libcalc static lib +# LIBCALC_STATIC are flags given to ${CC} to build libcalc static libraries # LIBCUSTCALC_STATIC are flags given to ${CC} to build libcustcalc static lib # # NOTE: The above 4 values are unused if BLD_TYPE= calc-dynamic-only @@ -495,7 +495,7 @@ LDFLAGS= ${LD_DEBUG} ${ILDFLAGS} # to abort on warnings, then leave CCWERR blank. # CCMISC are misc flags given to ${CC} # -# LCC how the C compiler is invoked on locally executed intermediate progs +# LCC is how the C compiler is invoked on locally executed intermediate programs # CC is how the C compiler is invoked (with an optional Purify) # # Specific target overrides or modifications to default values @@ -576,7 +576,7 @@ CCMISC= ${DARWIN_ARCH} LCC= MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} gcc CC= ${PURIFY} ${LCC} ${CCWERR} # -# Darmin dynamic shared lib filenames +# Darwin dynamic shared lib filenames LIB_EXT:= .dylib LIB_EXT_VERSION:= .${VERSION}${LIB_EXT} LIB_EXT_VERS:= .${VERS}${LIB_EXT} @@ -779,10 +779,10 @@ CC= ${PURIFY} ${LCC} ${CCWERR} # # The simple makefile forces the use of static ${CC} flags # -# ICFLAGS are given to ${CC} for intermediate progs used to help compile calc -# CFLAGS are given to ${CC} for calc progs other than intermediate progs -# ILDFLAGS for ${CC} in linking intermediate progs used to help compile calc -# LDFLAGS for ${CC} in linking calc progs other than intermediate progs +# ICFLAGS are given to ${CC} for intermediate programs used to help compile calc +# CFLAGS are given to ${CC} for calc programs other than intermediate programs +# ILDFLAGS for ${CC} in linking intermediate programs used to help compile calc +# LDFLAGS for ${CC} in linking calc programs other than intermediate programs # ICFLAGS= ${COMMON_CFLAGS} ${CC_STATIC} CFLAGS= ${ICFLAGS} ${CCOPT} @@ -882,8 +882,8 @@ endif # Required flags to compile C files for calc # -# ICFLAGS are given to ${CC} for intermediate progs used to help compile calc -# CFLAGS are given to ${CC} for calc progs other than intermediate progs +# ICFLAGS are given to ${CC} for intermediate programs used to help compile calc +# CFLAGS are given to ${CC} for calc programs other than intermediate programs # # NOTE: This does not work for: make-XYZ-only and BLD_TYPE != make-XYZ-only # @@ -896,8 +896,8 @@ CFLAGS= ${ICFLAGS} ${CCOPT} # Required flags to link files for calc # -# ILDFLAGS for ${CC} in linking intermediate progs used to help compile calc -# LDFLAGS for ${CC} in linking calc progs other than intermediate progs +# ILDFLAGS for ${CC} in linking intermediate programs used to help compile calc +# LDFLAGS for ${CC} in linking calc programs other than intermediate programs # ILDFLAGS= ${COMMON_LDFLAGS} LDFLAGS= ${LD_DEBUG} ${ILDFLAGS} diff --git a/custom/Makefile.head b/custom/Makefile.head index b667d4e..59f48e3 100644 --- a/custom/Makefile.head +++ b/custom/Makefile.head @@ -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.28 $ -# @(#) $Id: Makefile.head,v 30.28 2013/08/11 05:40:18 chongo Exp $ -# @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/Makefile.head,v $ +# @(#) $Revision: 30.29 $ +# @(#) $Id: Makefile.head,v 30.29 2013/08/17 01:22:19 chongo Exp $ +# @(#) $Source: /usr/local/src/bin/calc/custom/RCS/Makefile.head,v $ # # Under source code control: 1997/03/09 02:28:54 # File existed as early as: 1997 @@ -366,7 +366,7 @@ EXT= # The default calc versions # -VERSION= 2.12.4.10 +VERSION= 2.12.4.11 VERS= 2.12.4 VER= 2.12 VE= 2 diff --git a/custom/Makefile.simple b/custom/Makefile.simple index 43f0acd..cf6314a 100644 --- a/custom/Makefile.simple +++ b/custom/Makefile.simple @@ -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.28 $ -# @(#) $Id: Makefile.head,v 30.28 2013/08/11 05:40:18 chongo Exp $ -# @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/Makefile.head,v $ +# @(#) $Revision: 30.29 $ +# @(#) $Id: Makefile.head,v 30.29 2013/08/17 01:22:19 chongo Exp $ +# @(#) $Source: /usr/local/src/bin/calc/custom/RCS/Makefile.head,v $ # # Under source code control: 1997/03/09 02:28:54 # File existed as early as: 1997 @@ -351,7 +351,7 @@ EXT= # The default calc versions # -VERSION= 2.12.4.10 +VERSION= 2.12.4.11 VERS= 2.12.4 VER= 2.12 VE= 2 @@ -433,16 +433,16 @@ COMMON_LDFLAGS= ${EXTRA_LDFLAGS} # BLD_TYPE= calc-static-only # # CC_SHARE are flags given to ${CC} to build .o files suitable for shared libs -# DEFAULT_LIB_INSTALL_PATH is where calc progs look for calc shared libs +# DEFAULT_LIB_INSTALL_PATH is where calc programs look for calc shared libs # LD_SHARE are common flags given to ${CC} to link with shared libraries -# LIBCALC_SHLIB are flags given to ${CC} to build libcalc shared lib +# 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 # # 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 -# LIBCALC_STATIC are flags given to ${CC} to build libcalc static lib +# LIBCALC_STATIC are flags given to ${CC} to build libcalc static libraries # LIBCUSTCALC_STATIC are flags given to ${CC} to build libcustcalc static lib # # NOTE: The above 4 values are unused if BLD_TYPE= calc-dynamic-only @@ -455,7 +455,7 @@ COMMON_LDFLAGS= ${EXTRA_LDFLAGS} # to abort on warnings, then leave CCWERR blank. # CCMISC are misc flags given to ${CC} # -# LCC how the C compiler is invoked on locally executed intermediate progs +# LCC is how the C compiler is invoked on locally executed intermediate programs # CC is how the C compiler is invoked (with an optional Purify) # # Specific target overrides or modifications to default values @@ -495,10 +495,10 @@ CC= ${PURIFY} ${LCC} ${CCWERR} # # The simple makefile forces the use of static ${CC} flags # -# ICFLAGS are given to ${CC} for intermediate progs used to help compile calc -# CFLAGS are given to ${CC} for calc progs other than intermediate progs -# ILDFLAGS for ${CC} in linking intermediate progs used to help compile calc -# LDFLAGS for ${CC} in linking calc progs other than intermediate progs +# ICFLAGS are given to ${CC} for intermediate programs used to help compile calc +# CFLAGS are given to ${CC} for calc programs other than intermediate programs +# ILDFLAGS for ${CC} in linking intermediate programs used to help compile calc +# LDFLAGS for ${CC} in linking calc programs other than intermediate programs # ICFLAGS= ${COMMON_CFLAGS} ${CC_STATIC} CFLAGS= ${ICFLAGS} ${CCOPT} diff --git a/custom/c_sysinfo.c b/custom/c_sysinfo.c index 1812c44..2d93ceb 100644 --- a/custom/c_sysinfo.c +++ b/custom/c_sysinfo.c @@ -17,8 +17,8 @@ * 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.3 $ - * @(#) $Id: c_sysinfo.c,v 30.3 2013/08/11 08:41:38 chongo Exp $ + * @(#) $Revision: 30.4 $ + * @(#) $Id: c_sysinfo.c,v 30.4 2013/09/01 22:16:21 chongo Exp $ * @(#) $Source: /usr/local/src/bin/calc/custom/RCS/c_sysinfo.c,v $ * * Under source code control: 1997/03/09 23:14:40 @@ -71,15 +71,15 @@ struct infoname { FULL nmbr; /* if str==NULL ==> value fo #define as a FULL */ }; STATIC struct infoname sys_info[] = { - {"S100", "slots in an subtractive 100 table", NULL, + {"S100", "slots in an subtractive 100 table", NULL, (FULL)S100}, - {"BASE", "base for calculations", NULL, + {"BASE", "base for calculations", NULL, (FULL)BASE}, - {"BASE1", "one less than base", NULL, + {"BASE1", "one less than base", NULL, (FULL)BASE}, - {"BASEB", "bits in the calculation base", NULL, + {"BASEB", "bits in the calculation base", NULL, (FULL)BASEB}, - {"BASEDIG", "number of digits in base", NULL, + {"BASEDIG", "number of digits in base", NULL, (FULL)BASEDIG}, {"BIG_ENDIAN", "Most Significant Byte first symbol", NULL, (FULL)BIG_ENDIAN}, @@ -89,7 +89,7 @@ STATIC struct infoname sys_info[] = { (FULL)BLK_DEF_MAXPRINT}, {"BLUM_PREGEN", "non-default predefined Blum generators", NULL, (FULL)BLUM_PREGEN}, - {"CALCEXT", "extension for files read in", CALCEXT, + {"CALCEXT", "extension for files read in", CALCEXT, (FULL)0}, {"CALC_BYTE_ORDER", "Byte order (LITTLE_ENDIAN or BIG_ENDIAN)", NULL, (FULL)CALC_BYTE_ORDER}, @@ -97,17 +97,17 @@ STATIC struct infoname sys_info[] = { (FULL)0}, {"DEFAULTCALCBINDINGS", "default key bindings file", DEFAULTCALCBINDINGS, (FULL)0}, - {"DEFAULTCALCHELP", "help file that -h prints", DEFAULTCALCHELP, + {"DEFAULTCALCHELP", "help file that -h prints", DEFAULTCALCHELP, (FULL)0}, - {"DEFAULTCALCPAGER", "default pager", DEFAULTCALCPAGER, + {"DEFAULTCALCPAGER", "default pager", DEFAULTCALCPAGER, (FULL)0}, {"DEFAULTCALCPATH", "default :-separated search path", DEFAULTCALCPATH, (FULL)0}, {"DEFAULTCALCRC", "default :-separated startup file list", DEFAULTCALCRC, (FULL)0}, - {"DEFAULTSHELL", "default shell to use", DEFAULTSHELL, + {"DEFAULTSHELL", "default shell to use", DEFAULTSHELL, (FULL)0}, - {"DEV_BITS", "device number size in bits", NULL, + {"DEV_BITS", "device number size in bits", NULL, (FULL)DEV_BITS}, {"DISPLAY_DEFAULT", "default digits for float display", NULL, (FULL)DISPLAY_DEFAULT}, @@ -115,135 +115,135 @@ STATIC struct infoname sys_info[] = { (FULL)EPSILONPREC_DEFAULT}, {"EPSILON_DEFAULT", "allowed error for float calculations", EPSILON_DEFAULT, (FULL)0}, - {"ERRMAX", "default errmax value", NULL, + {"ERRMAX", "default errmax value", NULL, (FULL)ERRMAX}, - {"E_USERDEF", "base of user defined errors", NULL, + {"E_USERDEF", "base of user defined errors", NULL, (FULL)E_USERDEF}, - {"E__BASE", "calc errors start above here", NULL, + {"E__BASE", "calc errors start above here", NULL, (FULL)E__BASE}, - {"E__COUNT", "number of calc errors", NULL, + {"E__COUNT", "number of calc errors", NULL, (FULL)E__COUNT}, - {"E__HIGHEST", "highest calc error", NULL, + {"E__HIGHEST", "highest calc error", NULL, (FULL)E__HIGHEST}, - {"FALSE", "boolean false", NULL, + {"FALSE", "boolean false", NULL, (FULL)FALSE}, - {"FILEPOS_BITS", "file position size in bits", NULL, + {"FILEPOS_BITS", "file position size in bits", NULL, (FULL)FILEPOS_BITS}, - {"FULL_BITS", "bits in a FULL", NULL, + {"FULL_BITS", "bits in a FULL", NULL, (FULL)FULL_BITS}, - {"HELPDIR", "location of the help directory", HELPDIR, + {"HELPDIR", "location of the help directory", HELPDIR, (FULL)0}, - {"HIST_BINDING_FILE", "Default binding file", HIST_BINDING_FILE, + {"HIST_BINDING_FILE", "Default binding file", HIST_BINDING_FILE, (FULL)0}, - {"HIST_SIZE", "Default history size", NULL, + {"HIST_SIZE", "Default history size", NULL, (FULL)HIST_SIZE}, - {"INIT_J", "initial 1st walking a55 table index", NULL, + {"INIT_J", "initial 1st walking a55 table index", NULL, (FULL)INIT_J}, - {"INIT_K", "initial 2nd walking a55 table index", NULL, + {"INIT_K", "initial 2nd walking a55 table index", NULL, (FULL)INIT_K}, - {"INODE_BITS", "inode number size in bits", NULL, + {"INODE_BITS", "inode number size in bits", NULL, (FULL)INODE_BITS}, - {"LITTLE_ENDIAN", "Least Significant Byte first symbol", + {"LITTLE_ENDIAN", "Least Significant Byte first symbol", NULL, (FULL)LITTLE_ENDIAN}, - {"LONG_BITS", "bit length of a long", NULL, + {"LONG_BITS", "bit length of a long", NULL, (FULL)LONG_BITS}, - {"MAP_POPCNT", "number of odd primes in pr_map", NULL, + {"MAP_POPCNT", "number of odd primes in pr_map", NULL, (FULL)MAP_POPCNT}, - {"MAX_CALCRC", "maximum allowed length of $CALCRC", NULL, + {"MAX_CALCRC", "maximum allowed length of $CALCRC", NULL, (FULL)MAX_CALCRC}, - {"MAXCMD", "max length of command invocation", NULL, + {"MAXCMD", "max length of command invocation", NULL, (FULL)MAXCMD}, - {"MAXDIM", "max number of dimensions in matrices", NULL, + {"MAXDIM", "max number of dimensions in matrices", NULL, (FULL)MAXDIM}, - {"MAXERROR", "max length of error message string", NULL, + {"MAXERROR", "max length of error message string", NULL, (FULL)MAXERROR}, - {"MAXFILES", "max number of opened files", NULL, + {"MAXFILES", "max number of opened files", NULL, (FULL)MAXFILES}, - {"MAXFULL", "largest SFULL value", NULL, + {"MAXFULL", "largest SFULL value", NULL, (FULL)MAXFULL}, - {"MAXHALF", "largest SHALF value", NULL, + {"MAXHALF", "largest SHALF value", NULL, (FULL)MAXHALF}, {"MAXLABELS", "max number of user labels in function", NULL, (FULL)MAXLABELS}, - {"MAXLEN", "longest storage size allowed", NULL, + {"MAXLEN", "longest storage size allowed", NULL, (FULL)MAXLEN}, - {"MAXLONG", "largest long val", NULL, + {"MAXLONG", "largest long val", NULL, (FULL)MAXLONG}, {"MAXPRINT_DEFAULT", "default number of elements printed", NULL, (FULL)MAXPRINT_DEFAULT}, - {"MAXREDC", "number of entries in REDC cache", NULL, + {"MAXREDC", "number of entries in REDC cache", NULL, (FULL)MAXREDC}, {"MAXSCANCOUNT", "default max scan errors before an abort", NULL, (FULL)MAXSCANCOUNT}, - {"MAXSTACK", "max depth of evaluation stack", NULL, + {"MAXSTACK", "max depth of evaluation stack", NULL, (FULL)MAXSTACK}, - {"MAXSTRING", "max size of string constant", NULL, + {"MAXSTRING", "max size of string constant", NULL, (FULL)MAXSTRING}, - {"MAXUFULL", "largest FULL value", NULL, + {"MAXUFULL", "largest FULL value", NULL, (FULL)MAXUFULL}, - {"MAXULONG", "largest unsigned long val", NULL, + {"MAXULONG", "largest unsigned long val", NULL, (FULL)MAXULONG}, - {"MAX_MAP_PRIME", "larest prime in pr_map", NULL, + {"MAX_MAP_PRIME", "larest prime in pr_map", NULL, (FULL)MAX_MAP_PRIME}, - {"MAX_MAP_VAL", "larest bit in pr_map", NULL, + {"MAX_MAP_VAL", "larest bit in pr_map", NULL, (FULL)MAX_MAP_VAL}, {"MAX_PFACT_VAL", "max x, for which pfact(x) is a long", NULL, (FULL)MAX_PFACT_VAL}, - {"MAX_SM_PRIME", "larest 32 bit prime", NULL, + {"MAX_SM_PRIME", "larest 32 bit prime", NULL, (FULL)MAX_SM_PRIME}, - {"MAX_SM_VAL", "larest 32 bit value", NULL, + {"MAX_SM_VAL", "larest 32 bit value", NULL, (FULL)MAX_SM_VAL}, - {"MUL_ALG2", "default size for alternative multiply", NULL, + {"MUL_ALG2", "default size for alternative multiply", NULL, (FULL)MUL_ALG2}, {"NXT_MAP_PRIME", "smallest odd prime not in pr_map", NULL, (FULL)NXT_MAP_PRIME}, {"NXT_PFACT_VAL", "next prime for higher pfact values", NULL, (FULL)NXT_PFACT_VAL}, - {"OFF_T_BITS", "file offset size in bits", NULL, + {"OFF_T_BITS", "file offset size in bits", NULL, (FULL)OFF_T_BITS}, - {"PIX_32B", "max pix() value", NULL, + {"PIX_32B", "max pix() value", NULL, (FULL)PIX_32B}, {"POW_ALG2", "default size for using REDC for powers", NULL, (FULL)POW_ALG2}, {"REDC_ALG2", "default size using alternative REDC alg", NULL, (FULL)REDC_ALG2}, - {"SBITS", "size of additive or shuffle entry in bits", NULL, + {"SBITS", "size of additive or shuffle entry in bits", NULL, (FULL)SBITS}, {"SBYTES", "size of additive or shuffle entry in bytes", NULL, (FULL)SBYTES}, - {"SCNT", "length of additive 55 table in FULLs", NULL, + {"SCNT", "length of additive 55 table in FULLs", NULL, (FULL)SCNT}, - {"SEEDXORBITS", "low bits of a55 seed devoted to xor", NULL, + {"SEEDXORBITS", "low bits of a55 seed devoted to xor", NULL, (FULL)SEEDXORBITS}, - {"SHALFS", "size of additive or shuffle entry in HALFs", NULL, + {"SHALFS", "size of additive or shuffle entry in HALFs", NULL, (FULL)SHALFS}, - {"SHUFCNT", "size of shuffle table in entries", NULL, + {"SHUFCNT", "size of shuffle table in entries", NULL, (FULL)SHUFCNT}, - {"SHUFLEN", "length of shuffle table in FULLs", NULL, + {"SHUFLEN", "length of shuffle table in FULLs", NULL, (FULL)SHUFLEN}, - {"SHUFMASK", "mask for shuffle table entry selection", NULL, + {"SHUFMASK", "mask for shuffle table entry selection", NULL, (FULL)SHUFMASK}, - {"SHUFPOW", "power of 2 size of the shuffle table", NULL, + {"SHUFPOW", "power of 2 size of the shuffle table", NULL, (FULL)SHUFPOW}, - {"SLEN", "number of FULLs in a shuffle table entry", NULL, + {"SLEN", "number of FULLs in a shuffle table entry", NULL, (FULL)SLEN}, - {"SQ_ALG2", "default size for alternative squaring", NULL, + {"SQ_ALG2", "default size for alternative squaring", NULL, (FULL)SQ_ALG2}, - {"SYMBOLSIZE", "max symbol name size", NULL, + {"SYMBOLSIZE", "max symbol name size", NULL, (FULL)SYMBOLSIZE}, - {"TEN_MAX", "10^(2^TEN_MAX): largest base10 conversion const", NULL, + {"TEN_MAX", "10^(2^TEN_MAX): largest base10 conversion const", NULL, (FULL)TEN_MAX}, - {"TOPFULL", "highest bit in FULL", NULL, + {"TOPFULL", "highest bit in FULL", NULL, (FULL)TOPFULL}, - {"TOPHALF", "highest bit in a HALF", NULL, + {"TOPHALF", "highest bit in a HALF", NULL, (FULL)TOPHALF}, - {"TOPLONG", "top long bit", NULL, + {"TOPLONG", "top long bit", NULL, (FULL)TOPLONG}, - {"TRUE", "boolean true", NULL, + {"TRUE", "boolean true", NULL, (FULL)TRUE}, - {"USUAL_ELEMENTS", "usual number of elements for objects", NULL, + {"USUAL_ELEMENTS", "usual number of elements for objects", NULL, (FULL)USUAL_ELEMENTS}, - {"REGNUM_MAX", "highest custom register number", NULL, + {"REGNUM_MAX", "highest custom register number", NULL, (FULL)CUSTOM_REG_MAX}, /* must be last */ diff --git a/custom/sysinfo b/custom/sysinfo index 2d09e11..e2679a5 100644 --- a/custom/sysinfo +++ b/custom/sysinfo @@ -11,7 +11,7 @@ TYPES DESCRIPTION - This custom function will return the value certain selected #defile + This custom function will return the value certain selected #define values. The infoname arg must be a string that matches the given #define name. For conveience, the case infoname does not matter, so "baseb" and "BASEB" refer to the same #define value. @@ -69,8 +69,8 @@ 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: sysinfo,v 30.1 2007/03/16 11:10:04 chongo Exp $ +## @(#) $Revision: 30.2 $ +## @(#) $Id: sysinfo,v 30.2 2013/08/17 01:57:37 chongo Exp $ ## @(#) $Source: /usr/local/src/bin/calc/custom/RCS/sysinfo,v $ ## ## Under source code control: 1997/03/09 23:14:40 diff --git a/file.h b/file.h index 152c0b4..3c7e3d9 100644 --- a/file.h +++ b/file.h @@ -19,8 +19,8 @@ * 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: file.h,v 30.2 2013/08/11 08:41:38 chongo Exp $ + * @(#) $Revision: 30.3 $ + * @(#) $Id: file.h,v 30.3 2013/09/01 22:16:21 chongo Exp $ * @(#) $Source: /usr/local/src/bin/calc/RCS/file.h,v $ * * Under source code control: 1996/05/24 05:55:58 @@ -96,7 +96,7 @@ E_FUNC int fgetposid(FILEID id, FILEPOS *ptr); E_FUNC int fsetposid(FILEID id, FILEPOS *ptr); E_FUNC int get_open_siz(FILE *fp, ZVALUE *res); E_FUNC char* findfname(FILEID); -E_FUNC FILE *f_pathopen(char *name, char *mode, char *pathlist, +E_FUNC FILE *f_pathopen(char *name, char *mode, char *pathlist, char **openpath); diff --git a/func.c b/func.c index 53798fa..34f0e01 100644 --- a/func.c +++ b/func.c @@ -19,8 +19,8 @@ * 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: func.c,v 30.4 2013/08/11 08:41:38 chongo Exp $ + * @(#) $Revision: 30.8 $ + * @(#) $Id: func.c,v 30.8 2013/09/01 22:11:07 chongo Exp $ * @(#) $Source: /usr/local/src/bin/calc/RCS/func.c,v $ * * Under source code control: 1990/02/15 01:48:15 @@ -4177,6 +4177,24 @@ f_strcmp(VALUE *v1, VALUE *v2) return result; } +S_FUNC VALUE +f_strcasecmp(VALUE *v1, VALUE *v2) +{ + VALUE result; + FLAG flag; + + /* initialize VALUE */ + result.v_subtype = V_NOSUBTYPE; + + if (v1->v_type != V_STR || v2->v_type != V_STR) + return error_value(E_STRCASECMP); + + flag = stringcaserel(v1->v_str, v2->v_str); + + result.v_type = V_NUM; + result.v_num = itoq((long) flag); + return result; +} S_FUNC VALUE f_strncmp(VALUE *v1, VALUE *v2, VALUE *v3) @@ -4209,7 +4227,37 @@ f_strncmp(VALUE *v1, VALUE *v2, VALUE *v3) result.v_num = itoq((long) flag); return result; } +S_FUNC VALUE +f_strncasecmp(VALUE *v1, VALUE *v2, VALUE *v3) +{ + long n1, n2, n; + FLAG flag; + VALUE result; + /* initialize VALUE */ + result.v_subtype = V_NOSUBTYPE; + + if (v1->v_type != V_STR || v2->v_type != V_STR || + v3->v_type != V_NUM || qisneg(v3->v_num) || + qisfrac(v3->v_num) || zge31b(v3->v_num->num)) + return error_value(E_STRNCASECMP); + n1 = v1->v_str->s_len; + n2 = v2->v_str->s_len; + n = qtoi(v3->v_num); + if (n < n1) + v1->v_str->s_len = n; + if (n < n2) + v2->v_str->s_len = n; + + flag = stringcaserel(v1->v_str, v2->v_str); + + v1->v_str->s_len = n1; + v2->v_str->s_len = n2; + + result.v_type = V_NUM; + result.v_num = itoq((long) flag); + return result; +} S_FUNC VALUE f_strcat(int count, VALUE **vals) @@ -4396,6 +4444,307 @@ f_ord(VALUE *vp) return result; } +S_FUNC VALUE +f_isupper(VALUE *vp) +{ + char c; + VALUE result; + + /* initialize VALUE */ + result.v_subtype = V_NOSUBTYPE; + + switch(vp->v_type) { + case V_STR: + c = *vp->v_str->s_str; + break; + case V_OCTET: + c = *vp->v_octet; + break; + default: + return error_value(E_ISUPPER); + } + + result.v_type = V_NUM; + result.v_num = itoq( (isupper( c ))?1l:0l); + return result; +} + +S_FUNC VALUE +f_islower(VALUE *vp) +{ + char c; + VALUE result; + + /* initialize VALUE */ + result.v_subtype = V_NOSUBTYPE; + + switch(vp->v_type) { + case V_STR: + c = *vp->v_str->s_str; + break; + case V_OCTET: + c = *vp->v_octet; + break; + default: + return error_value(E_ISLOWER); + } + + result.v_type = V_NUM; + result.v_num = itoq( (islower( c ))?1l:0l); + return result; +} + +S_FUNC VALUE +f_isalnum(VALUE *vp) +{ + char c; + VALUE result; + + /* initialize VALUE */ + result.v_subtype = V_NOSUBTYPE; + + switch(vp->v_type) { + case V_STR: + c = *vp->v_str->s_str; + break; + case V_OCTET: + c = *vp->v_octet; + break; + default: + return error_value(E_ISALNUM); + } + + result.v_type = V_NUM; + result.v_num = itoq( (isalnum( c ))?1l:0l); + return result; +} + +S_FUNC VALUE +f_isalpha(VALUE *vp) +{ + char c; + VALUE result; + + /* initialize VALUE */ + result.v_subtype = V_NOSUBTYPE; + + switch(vp->v_type) { + case V_STR: + c = *vp->v_str->s_str; + break; + case V_OCTET: + c = *vp->v_octet; + break; + default: + return error_value(E_ISALPHA); + } + + result.v_type = V_NUM; + result.v_num = itoq( (isalpha( c ))?1l:0l); + return result; +} + +#if 0 +/* Not in C-standard, marked as obsolete in POSIX.1-2008 */ +S_FUNC VALUE +f_isascii(VALUE *vp) +{ + char c; + VALUE result; + + result.v_subtype = V_NOSUBTYPE; + + switch(vp->v_type) { + case V_STR: + c = *vp->v_str->s_str; + break; + case V_OCTET: + c = *vp->v_octet; + break; + default: + return error_value(E_ISASCII); + } + + result.v_type = V_NUM; + result.v_num = itoq( (isascii( c ))?1l:0l); + return result; +} +#endif /* 0 */ + +S_FUNC VALUE +f_iscntrl(VALUE *vp) +{ + char c; + VALUE result; + + /* initialize VALUE */ + result.v_subtype = V_NOSUBTYPE; + + switch(vp->v_type) { + case V_STR: + c = *vp->v_str->s_str; + break; + case V_OCTET: + c = *vp->v_octet; + break; + default: + return error_value(E_ISCNTRL); + } + + result.v_type = V_NUM; + result.v_num = itoq( (iscntrl( c ))?1l:0l); + return result; +} + +S_FUNC VALUE +f_isdigit(VALUE *vp) +{ + char c; + VALUE result; + + /* initialize VALUE */ + result.v_subtype = V_NOSUBTYPE; + + switch(vp->v_type) { + case V_STR: + c = *vp->v_str->s_str; + break; + case V_OCTET: + c = *vp->v_octet; + break; + default: + return error_value(E_ISDIGIT); + } + + result.v_type = V_NUM; + result.v_num = itoq( (isdigit( c ))?1l:0l); + return result; +} + +S_FUNC VALUE +f_isgraph(VALUE *vp) +{ + char c; + VALUE result; + + /* initialize VALUE */ + result.v_subtype = V_NOSUBTYPE; + + switch(vp->v_type) { + case V_STR: + c = *vp->v_str->s_str; + break; + case V_OCTET: + c = *vp->v_octet; + break; + default: + return error_value(E_ISGRAPH); + } + + result.v_type = V_NUM; + result.v_num = itoq( (isgraph( c ))?1l:0l); + return result; +} + +S_FUNC VALUE +f_isprint(VALUE *vp) +{ + char c; + VALUE result; + + /* initialize VALUE */ + result.v_subtype = V_NOSUBTYPE; + + switch(vp->v_type) { + case V_STR: + c = *vp->v_str->s_str; + break; + case V_OCTET: + c = *vp->v_octet; + break; + default: + return error_value(E_ISPRINT); + } + + result.v_type = V_NUM; + result.v_num = itoq( (isprint( c ))?1l:0l); + return result; +} + +S_FUNC VALUE +f_ispunct(VALUE *vp) +{ + char c; + VALUE result; + + /* initialize VALUE */ + result.v_subtype = V_NOSUBTYPE; + + switch(vp->v_type) { + case V_STR: + c = *vp->v_str->s_str; + break; + case V_OCTET: + c = *vp->v_octet; + break; + default: + return error_value(E_ISPUNCT); + } + + result.v_type = V_NUM; + result.v_num = itoq( (ispunct( c ))?1l:0l); + return result; +} + +S_FUNC VALUE +f_isspace(VALUE *vp) +{ + char c; + VALUE result; + + /* initialize VALUE */ + result.v_subtype = V_NOSUBTYPE; + + switch(vp->v_type) { + case V_STR: + c = *vp->v_str->s_str; + break; + case V_OCTET: + c = *vp->v_octet; + break; + default: + return error_value(E_ISSPACE); + } + + result.v_type = V_NUM; + result.v_num = itoq( (isspace( c ))?1l:0l); + return result; +} + +S_FUNC VALUE +f_isxdigit(VALUE *vp) +{ + char c; + VALUE result; + + /* initialize VALUE */ + result.v_subtype = V_NOSUBTYPE; + + switch(vp->v_type) { + case V_STR: + c = *vp->v_str->s_str; + break; + case V_OCTET: + c = *vp->v_octet; + break; + default: + return error_value(E_ISXDIGIT); + } + + result.v_type = V_NUM; + result.v_num = itoq( (isxdigit( c ))?1l:0l); + return result; +} S_FUNC VALUE f_protect(int count, VALUE **vals) @@ -8459,6 +8808,28 @@ STATIC CONST struct builtin builtins[] = { "numerator of fraction"}, {"ord", 1, 1, 0, OP_NOP, 0, f_ord, "integer corresponding to character value"}, + {"isupper", 1, 1, 0, OP_NOP, 0, f_isupper, + "whether character is upper case"}, + {"islower", 1, 1, 0, OP_NOP, 0, f_islower, + "whether character is lower case"}, + {"isalnum", 1, 1, 0, OP_NOP, 0, f_isalnum, + "whether character is alpha-numeric"}, + {"isalpha", 1, 1, 0, OP_NOP, 0, f_isalpha, + "whether character is alphabetic"}, + {"iscntrl", 1, 1, 0, OP_NOP, 0, f_iscntrl, + "whether character is a control character"}, + {"isdigit", 1, 1, 0, OP_NOP, 0, f_isdigit, + "whether character is a digit"}, + {"isgraph", 1, 1, 0, OP_NOP, 0, f_isgraph, + "whether character is a graphical character"}, + {"isprint", 1, 1, 0, OP_NOP, 0, f_isprint, + "whether character is printable"}, + {"ispunct", 1, 1, 0, OP_NOP, 0, f_ispunct, + "whether character is a punctuation"}, + {"isspace", 1, 1, 0, OP_NOP, 0, f_isspace, + "whether character is a space character"}, + {"isxdigit", 1, 1, 0, OP_NOP, 0, f_isxdigit, + "whether character is a hexadecimal digit"}, {"param", 1, 1, 0, OP_ARGVALUE, 0, 0, "value of parameter n (or parameter count if n\n" "\t\t\tis zero)"}, @@ -8602,6 +8973,8 @@ STATIC CONST struct builtin builtins[] = { "concatenate strings together"}, {"strcmp", 2, 2, 0, OP_NOP, 0, f_strcmp, "compare two strings"}, + {"strcasecmp", 2, 2, 0, OP_NOP, 0, f_strcasecmp, + "compare two strings case independent"}, {"strcpy", 2, 2, 0, OP_NOP, 0, f_strcpy, "copy string to string"}, {"strerror", 0, 1, 0, OP_NOP, 0, f_strerror, @@ -8610,6 +8983,8 @@ STATIC CONST struct builtin builtins[] = { "length of string"}, {"strncmp", 3, 3, 0, OP_NOP, 0, f_strncmp, "compare strings a, b to c characters"}, + {"strncasecmp", 3, 3, 0, OP_NOP, 0, f_strncasecmp, + "compare strings a, b to c characters case independent"}, {"strncpy", 3, 3, 0, OP_NOP, 0, f_strncpy, "copy up to c characters from string to string"}, {"strpos", 2, 2, 0, OP_NOP, 0, f_strpos, diff --git a/help/Makefile b/help/Makefile index b9ea207..edf9b29 100644 --- a/help/Makefile +++ b/help/Makefile @@ -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.5 $ -# @(#) $Id: Makefile,v 30.5 2007/09/21 01:27:27 chongo Exp $ -# @(#) $Source: /usr/local/src/cmd/calc/help/RCS/Makefile,v $ +# @(#) $Revision: 30.6 $ +# @(#) $Id: Makefile,v 30.6 2013/09/01 18:37:27 chongo Exp $ +# @(#) $Source: /usr/local/src/bin/calc/help/RCS/Makefile,v $ # # Under source code control: 1991/07/23 06:47:57 # File existed as early as: 1991 @@ -292,20 +292,20 @@ DETAIL_HELP= abs access acos acosh acot acoth acsc acsch address agd append \ 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 isassoc isatty isblk isconfig isdefined iserror iseven \ - isfile ishash isident isint islist ismat ismult isnull isnum isobj \ - isobjtype isodd isprime isptr isqrt isrand israndom isreal isrel \ - issimple issq isstr istype 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 \ + hmean hnrmod hypot ilog ilog10 ilog2 im indices inputlevel insert \ + int inverse iroot isassoc isatty isblk isconfig isdefined iserror \ + iseven isfile ishash isident isint islist ismat ismult isnull isnum \ + isobj isobjtype isodd isprime isptr isqrt isrand israndom isreal \ + isrel issimple issq isstr istype 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 strcat strcmp strcpy strerror strlen strncmp strncpy strpos \ strprintf strscan strscanf substr sum swap system systime tail tan \ tanh test time trunc usertime version xor diff --git a/help/factor b/help/factor index 8aae9fa..0c60741 100644 --- a/help/factor +++ b/help/factor @@ -30,8 +30,8 @@ DESCRIPTION If 1 < n < nextprime(limit)^2, then f(n, limit) == 1 <==> n is prime. For example, if 1 < n < 121, n is prime if and only if f(n,7) == 1. - If limit >= 2^32, factor(n, limit) causes an error and factor(n, - limit, err) returns the value of err. + If limit >= 2^32, factor(n, limit) causes an error and + factor(n, limit, err) returns the value of err. EXAMPLE ; print factor(35,4), factor(35,5), factor(35), factor(-35) @@ -66,9 +66,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: factor,v 30.1 2007/03/16 11:10:42 chongo Exp $ -## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/factor,v $ +## @(#) $Revision: 30.2 $ +## @(#) $Id: factor,v 30.2 2013/08/18 20:15:13 chongo Exp $ +## @(#) $Source: /usr/local/src/bin/calc/help/RCS/factor,v $ ## ## Under source code control: 1995/12/18 12:34:57 ## File existed as early as: 1995 diff --git a/obj.c b/obj.c index d6e0507..e3bbc81 100644 --- a/obj.c +++ b/obj.c @@ -17,8 +17,8 @@ * 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: obj.c,v 30.2 2013/08/11 08:41:38 chongo Exp $ + * @(#) $Revision: 30.3 $ + * @(#) $Id: obj.c,v 30.3 2013/09/01 22:16:21 chongo Exp $ * @(#) $Source: /usr/local/src/bin/calc/RCS/obj.c,v $ * * Under source code control: 1990/02/15 01:48:19 @@ -71,95 +71,95 @@ STATIC struct objectinfo { char *name; /* name of function to call */ char *comment; /* useful comment if any */ } objectinfo[] = { - {1, A_UNDEF, ERR_PRINT, + {1, A_UNDEF, ERR_PRINT, "print", "print value, default prints elements"}, - {1, A_VALUE, ERR_ONE, + {1, A_VALUE, ERR_ONE, "one", "multiplicative identity, default is 1"}, - {1, A_INT, ERR_TEST, + {1, A_INT, ERR_TEST, "test", "logical test (false,true => 0,1), default tests elements"}, - {2, A_VALUE, ERR_NONE, + {2, A_VALUE, ERR_NONE, "add", NULL}, - {2, A_VALUE, ERR_NONE, + {2, A_VALUE, ERR_NONE, "sub", NULL}, - {1, A_VALUE, ERR_NONE, + {1, A_VALUE, ERR_NONE, "neg", "negative"}, - {2, A_VALUE, ERR_NONE, + {2, A_VALUE, ERR_NONE, "mul", NULL}, - {2, A_VALUE, ERR_NONE, + {2, A_VALUE, ERR_NONE, "div", "non-integral division"}, - {1, A_VALUE, ERR_NONE, + {1, A_VALUE, ERR_NONE, "inv", "multiplicative inverse"}, - {2, A_VALUE, ERR_NONE, + {2, A_VALUE, ERR_NONE, "abs", "absolute value within given error"}, - {1, A_VALUE, ERR_NONE, + {1, A_VALUE, ERR_NONE, "norm", "square of absolute value"}, - {1, A_VALUE, ERR_NONE, + {1, A_VALUE, ERR_NONE, "conj", "conjugate"}, - {2, A_VALUE, ERR_POW, + {2, A_VALUE, ERR_POW, "pow", "integer power, default does multiply, square, inverse"}, - {1, A_VALUE, ERR_NONE, + {1, A_VALUE, ERR_NONE, "sgn", "sign of value (-1, 0, 1)"}, - {2, A_INT, ERR_CMP, + {2, A_INT, ERR_CMP, "cmp", "equality (equal,nonequal => 0,1), default tests elements"}, - {2, A_VALUE, ERR_NONE, + {2, A_VALUE, ERR_NONE, "rel", "relative order, positive for >, etc."}, - {3, A_VALUE, ERR_NONE, + {3, A_VALUE, ERR_NONE, "quo", "integer quotient"}, - {3, A_VALUE, ERR_NONE, + {3, A_VALUE, ERR_NONE, "mod", "remainder of division"}, - {1, A_VALUE, ERR_NONE, + {1, A_VALUE, ERR_NONE, "int", "integer part"}, - {1, A_VALUE, ERR_NONE, + {1, A_VALUE, ERR_NONE, "frac", "fractional part"}, - {1, A_VALUE, ERR_INC, + {1, A_VALUE, ERR_INC, "inc", "increment, default adds 1"}, - {1, A_VALUE, ERR_DEC, + {1, A_VALUE, ERR_DEC, "dec", "decrement, default subtracts 1"}, {1, A_VALUE, ERR_SQUARE, "square", "default multiplies by itself"}, - {2, A_VALUE, ERR_NONE, + {2, A_VALUE, ERR_NONE, "scale", "multiply by power of 2"}, {2, A_VALUE, ERR_NONE, "shift", "shift left by n bits (right if negative)"}, - {3, A_VALUE, ERR_NONE, + {3, A_VALUE, ERR_NONE, "round", "round to given number of decimal places"}, {3, A_VALUE, ERR_NONE, "bround", "round to given number of binary places"}, - {3, A_VALUE, ERR_NONE, + {3, A_VALUE, ERR_NONE, "root", "root of value within given error"}, - {3, A_VALUE, ERR_NONE, + {3, A_VALUE, ERR_NONE, "sqrt", "square root within given error"}, - {2, A_VALUE, ERR_NONE, + {2, A_VALUE, ERR_NONE, "or", "bitwise or"}, - {2, A_VALUE, ERR_NONE, + {2, A_VALUE, ERR_NONE, "and", "bitwise and"}, - {1, A_VALUE, ERR_NONE, + {1, A_VALUE, ERR_NONE, "not", "logical not"}, - {1, A_VALUE, ERR_NONE, + {1, A_VALUE, ERR_NONE, "fact", "factorial or postfix !"}, - {1, A_VALUE, ERR_VALUE, + {1, A_VALUE, ERR_VALUE, "min", "value for min(...)"}, - {1, A_VALUE, ERR_VALUE, + {1, A_VALUE, ERR_VALUE, "max", "value for max(...)"}, - {1, A_VALUE, ERR_VALUE, + {1, A_VALUE, ERR_VALUE, "sum", "value for sum(...)"}, - {2, A_UNDEF, ERR_ASSIGN, + {2, A_UNDEF, ERR_ASSIGN, "assign", "assign, defaults to a = b"}, - {2, A_VALUE, ERR_NONE, + {2, A_VALUE, ERR_NONE, "xor", "value for binary ~"}, - {1, A_VALUE, ERR_NONE, + {1, A_VALUE, ERR_NONE, "comp", "value for unary ~"}, - {1, A_VALUE, ERR_NONE, + {1, A_VALUE, ERR_NONE, "content", "unary hash op"}, - {2, A_VALUE, ERR_NONE, + {2, A_VALUE, ERR_NONE, "hashop", "binary hash op"}, - {1, A_VALUE, ERR_NONE, + {1, A_VALUE, ERR_NONE, "backslash", "unary backslash op"}, - {2, A_VALUE, ERR_NONE, + {2, A_VALUE, ERR_NONE, "setminus", "binary backslash op"}, - {1, A_VALUE, ERR_NONE, + {1, A_VALUE, ERR_NONE, "plus", "unary + op"}, - {0, 0, 0, + {0, 0, 0, NULL, NULL} }; @@ -307,7 +307,7 @@ objcall(int action, VALUE *v1, VALUE *v2, VALUE *v3) val.v_type = V_NULL; break; default: - math_error("Function \"%s\" is undefined", + math_error("Function \"%s\" is undefined", namefunc(index)); /*NOTREACHED*/ } diff --git a/qmath.h b/qmath.h index bed9abb..8f94676 100644 --- a/qmath.h +++ b/qmath.h @@ -17,8 +17,8 @@ * 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.3 $ - * @(#) $Id: qmath.h,v 30.3 2013/08/11 08:41:38 chongo Exp $ + * @(#) $Revision: 30.4 $ + * @(#) $Id: qmath.h,v 30.4 2013/09/01 22:16:21 chongo Exp $ * @(#) $Source: /usr/local/src/bin/calc/RCS/qmath.h,v $ * * Under source code control: 1993/07/30 19:42:47 @@ -165,7 +165,7 @@ E_FUNC long qilog2(NUMBER *q); E_FUNC long qilog10(NUMBER *q); E_FUNC NUMBER *qilog(NUMBER *q, ZVALUE base); E_FUNC BOOL qcmpmod(NUMBER *q1, NUMBER *q2, NUMBER *q3); -E_FUNC BOOL qquomod(NUMBER *q1, NUMBER *q2, NUMBER **quo, NUMBER **mod, +E_FUNC BOOL qquomod(NUMBER *q1, NUMBER *q2, NUMBER **quo, NUMBER **mod, long rnd); E_FUNC FLAG qnear(NUMBER *q1, NUMBER *q2, NUMBER *epsilon); E_FUNC NUMBER *qdigit(NUMBER *q, ZVALUE dpos, ZVALUE base); diff --git a/str.c b/str.c index 5c68f9e..8a8d5c9 100644 --- a/str.c +++ b/str.c @@ -19,8 +19,8 @@ * 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: str.c,v 30.2 2013/08/11 08:41:38 chongo Exp $ + * @(#) $Revision: 30.4 $ + * @(#) $Id: str.c,v 30.4 2013/09/01 20:23:07 chongo Exp $ * @(#) $Source: /usr/local/src/bin/calc/RCS/str.c,v $ * * Under source code control: 1990/02/15 01:48:10 @@ -31,6 +31,7 @@ #include +#include #include "calc.h" #include "str.h" @@ -852,7 +853,43 @@ stringrel(STRING *s1, STRING *s2) return (i1 > i2); } +/* Case independent stringrel(STRING *s1, STRING *s2) + * stringcaserel returns 0 if strings are equal; otherwise 1 or -1 according + * as the greater of the first unequal characters are in the first or + * second string, or in the case of unequal-length strings when the compared + * characters are all equal, 1 or -1 according as the first or second string + * is longer. + */ +FLAG +stringcaserel(STRING *s1, STRING *s2) +{ + char *c1, *c2; + long i1, i2; + if (s1 == s2) + return 0; + + i1 = s1->s_len; + i2 = s2->s_len; + if (i2 == 0) + return (i1 > 0); + if (i1 == 0) + return -1; + c1 = s1->s_str; + c2 = s2->s_str; + while (i1 > 1 && i2 > 1 && tolower(*c1) == tolower(*c2)) { + i1--; + i2--; + c1++; + c2++; + } + if ( (tolower(*c1)) > (tolower(*c2))) + return 1; + if ( (tolower(*c1)) < (tolower(*c2))) + return -1; + if (i1 < i2) return -1; + return (i1 > i2); +} /* * str with characters c0, c1, ... is considered as a bitstream, 8 bits * per character; within a character the bits ordered from low order to diff --git a/value.h b/value.h index b71857b..e63c032 100644 --- a/value.h +++ b/value.h @@ -17,8 +17,8 @@ * 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: value.h,v 30.4 2013/08/11 08:41:38 chongo Exp $ + * @(#) $Revision: 30.5 $ + * @(#) $Id: value.h,v 30.5 2013/09/01 18:57:17 chongo Exp $ * @(#) $Source: /usr/local/src/bin/calc/RCS/value.h,v $ * * Under source code control: 1993/07/30 19:42:47 @@ -531,6 +531,7 @@ E_FUNC long stringlowbit(STRING *s); E_FUNC long stringhighbit(STRING *s); E_FUNC BOOL stringcmp(STRING *, STRING *); E_FUNC BOOL stringrel(STRING *, STRING *); +E_FUNC BOOL stringcaserel(STRING *, STRING *); E_FUNC int stringbit(STRING *, long); E_FUNC BOOL stringtest(STRING *); E_FUNC int stringsetbit(STRING *, long, BOOL); diff --git a/version.c b/version.c index 3490f17..5256524 100644 --- a/version.c +++ b/version.c @@ -19,8 +19,8 @@ * 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.19 $ - * @(#) $Id: version.c,v 30.19 2013/08/11 08:41:38 chongo Exp $ + * @(#) $Revision: 30.20 $ + * @(#) $Id: version.c,v 30.20 2013/09/01 22:19:41 chongo Exp $ * @(#) $Source: /usr/local/src/bin/calc/RCS/version.c,v $ * * Under source code control: 1990/05/22 11:00:58 @@ -49,7 +49,7 @@ static char *program; #define MAJOR_VER 2 /* major library version */ #define MINOR_VER 12 /* minor library version */ #define MAJOR_PATCH 4 /* major software level under library version */ -#define MINOR_PATCH 10 /* minor software level or 0 if not patched */ +#define MINOR_PATCH 11 /* minor software level or 0 if not patched */ /* diff --git a/win32/calcerr.c b/win32/calcerr.c index 366357d..c6ab785 100644 --- a/win32/calcerr.c +++ b/win32/calcerr.c @@ -431,5 +431,19 @@ CONST char *error_table[E__COUNT+2] = { "File argument for fgetfile not open for reading", "Unable to set file position in fgetfile", "Non-representable type for estr", + "Non-string argument for strcasecmp", + "Bad argument type for strncasecmp", + "Bad argument for isupper", + "Bad argument for islower", + "Bad argument for isalnum", + "Bad argument for isalpha", + "Bad argument for isascii", + "Bad argument for iscntrl", + "Bad argument for isdigit", + "Bad argument for isgraph", + "Bad argument for isprint", + "Bad argument for ispunct", + "Bad argument for isspace", + "Bad argument for isxdigit", NULL }; diff --git a/win32/calcerr.h b/win32/calcerr.h index 8848872..0e678c2 100644 --- a/win32/calcerr.h +++ b/win32/calcerr.h @@ -428,9 +428,23 @@ #define E_FGETFILE2 10415 /* File argument for fgetfile not open for reading */ #define E_FGETFILE3 10416 /* Unable to set file position in fgetfile */ #define E_ESTR 10417 /* Non-representable type for estr */ +#define E_STRCASECMP 10418 /* Non-string argument for strcasecmp */ +#define E_STRNCASECMP 10419 /* Bad argument type for strncasecmp */ +#define E_ISUPPER 10420 /* Bad argument for isupper */ +#define E_ISLOWER 10421 /* Bad argument for islower */ +#define E_ISALNUM 10422 /* Bad argument for isalnum */ +#define E_ISALPHA 10423 /* Bad argument for isalpha */ +#define E_ISASCII 10424 /* Bad argument for isascii */ +#define E_ISCNTRL 10425 /* Bad argument for iscntrl */ +#define E_ISDIGIT 10426 /* Bad argument for isdigit */ +#define E_ISGRAPH 10427 /* Bad argument for isgraph */ +#define E_ISPRINT 10428 /* Bad argument for isprint */ +#define E_ISPUNCT 10429 /* Bad argument for ispunct */ +#define E_ISSPACE 10430 /* Bad argument for isspace */ +#define E_ISXDIGIT 10431 /* Bad argument for isxdigit */ -#define E__HIGHEST 10417 /* highest calc error */ -#define E__COUNT 417 /* number of calc errors */ +#define E__HIGHEST 10431 /* highest calc error */ +#define E__COUNT 431 /* number of calc errors */ #define E_USERDEF 20000 /* base of user defined errors */ /* names of calc error values */