From 5e098d2adf0837cf6664d457b3b82b80b4e3b2b8 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Fri, 15 Dec 2000 07:06:11 -0800 Subject: [PATCH] Release calc version 2.11.4t1 --- CHANGES | 29 +- COPYING | 10 +- addop.c | 4 +- cal/Makefile | 6 +- cal/README | 55 +- cal/regress.cal | 13 +- cal/test8600.cal | 1406 ++++++++++++++++++++++++++++++++++++++++ calc.c | 4 +- calc.h | 6 +- calcerr.tbl | 4 +- cmath.h | 4 +- codegen.c | 5 +- comfunc.c | 4 +- config.c | 4 +- config.h | 4 +- cscript/Makefile | 20 +- cscript/mersenne.calc | 16 +- cscript/piforever.calc | 6 +- cscript/plus.calc | 12 +- cscript/simple.calc | 8 +- cscript/square.calc | 35 + custom/c_sysinfo.c | 4 +- func.c | 6 +- help/Makefile | 54 +- help/bernoulli | 14 +- help/calc_tty | 52 ++ help/catalan | 63 ++ help/define | 6 +- help/digit | 91 ++- help/digits | 24 +- help/euler | 63 ++ help/freebernoulli | 4 +- help/freeeuler | 49 ++ help/interrupt | 8 +- help/places | 29 +- help/script | 4 +- help/sleep | 68 ++ input.c | 4 +- lib_calc.c | 4 +- opcodes.c | 4 +- qfunc.c | 4 +- qio.c | 4 +- qmath.c | 4 +- qmath.h | 4 +- token.c | 4 +- value.c | 4 +- value.h | 4 +- version.c | 8 +- zfunc.c | 4 +- zio.c | 4 +- zmath.h | 4 +- zmod.c | 7 +- 52 files changed, 2070 insertions(+), 191 deletions(-) create mode 100644 cal/test8600.cal create mode 100644 cscript/square.calc create mode 100644 help/calc_tty create mode 100644 help/catalan create mode 100644 help/euler create mode 100644 help/freeeuler create mode 100644 help/sleep diff --git a/CHANGES b/CHANGES index b3310cc..f8e75a6 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,25 @@ -The following are the changes from calc version 2.11.3t0 to date: +The following are the changes from calc version 2.11.4t1 to date: + + Added missing test8600.cal test file. + + Fixes cscript files to deal with the -S flag being replaced by + -f and possibly other flags. + + +The following are the changes from calc version 2.11.3t0 to 2.11.4: + + Increased the maximum number of args for functions from 100 to 1024. + Increased calc's internal evaluation stack from 1024 to 2048 args. + Added test8600.cal to the regression suite to test these new limits. + + Updated and fixed misc typos in calc/README. + + Clarified in the COPYING file that ALL calc source files, both + LGPL covered and exceptions to the LGPL files may be freely used + and distributed. + + Added help files or updated for: bernoulli, calc_tty, catalan, + digit, digits, euler, freeeuler, places and sleep. A collection of 18 patches from Ernest Bowen : @@ -167,7 +188,7 @@ The following are the changes from calc version 2.11.3t0 to date: size of n in digit(x, n, b), for example, digit(1/7, -1e100) which would not work before can now be handled. - (13) The function, digits(x)m which returns the number of decimal + (13) The function, digits(x), which returns the number of decimal digits in the integer part of x has been changed so that if abs(x) < 1, it returns 0 rather than 1. This also now applies to digits(x,b). @@ -4998,8 +5019,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. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## -## @(#) $Revision: 29.11 $ -## @(#) $Id: CHANGES,v 29.11 2000/06/07 15:51:35 chongo Exp chongo $ +## @(#) $Revision: 29.14 $ +## @(#) $Id: CHANGES,v 29.14 2000/12/15 14:58:20 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/RCS/CHANGES,v $ ## ## Under source code control: 1993/06/02 18:12:57 diff --git a/COPYING b/COPYING index dbe2067..b2888bd 100644 --- a/COPYING +++ b/COPYING @@ -12,8 +12,8 @@ This file is Copyrighted Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - # @(#) $Revision: 29.2 $ - # @(#) $Id: COPYING,v 29.2 2000/06/07 14:02:13 chongo Exp $ + # @(#) $Revision: 29.3 $ + # @(#) $Id: COPYING,v 29.3 2000/12/14 09:18:06 chongo Exp $ # @(#) $Source: /usr/local/src/cmd/calc/RCS/COPYING,v $ =-= @@ -167,6 +167,12 @@ Calc copyrights and exception files top of this file. It is important to note that you may distribute verbatim copies of this file but you may not modify this file. + Some of these exception files are in the public domain. Other + exception files have non-LGPL Copyrights. In all cases one may + use and distribute these exception files freely. 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 diff --git a/addop.c b/addop.c index 131cde0..903ad75 100644 --- a/addop.c +++ b/addop.c @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.2 $ - * @(#) $Id: addop.c,v 29.2 2000/06/07 14:02:13 chongo Exp chongo $ + * @(#) $Revision: 29.3 $ + * @(#) $Id: addop.c,v 29.3 2000/07/17 15:35:49 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/addop.c,v $ * * Under source code control: 1990/02/15 01:48:10 diff --git a/cal/Makefile b/cal/Makefile index 448c8d9..42f99b2 100644 --- a/cal/Makefile +++ b/cal/Makefile @@ -18,8 +18,8 @@ # received a copy with calc; if not, write to Free Software Foundation, Inc. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # -# @(#) $Revision: 29.2 $ -# @(#) $Id: Makefile,v 29.2 2000/06/07 14:02:25 chongo Exp $ +# @(#) $Revision: 29.3 $ +# @(#) $Id: Makefile,v 29.3 2000/12/15 14:42:52 chongo Exp $ # @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/Makefile,v $ # # Under source code control: 1991/07/21 05:00:54 @@ -70,7 +70,7 @@ CALC_FILES= README bigprime.cal deg.cal ellip.cal lucas.cal lucas_chk.cal \ test3500.cal seedrandom.cal test4000.cal test4100.cal test4600.cal \ beer.cal hello.cal test5100.cal test5200.cal randombitrun.cal \ randomrun.cal xx_print.cal natnumset.cal qtime.cal test8400.cal \ - test8500.cal + test8500.cal test8600.cal # These files are found (but not built) in the distribution # diff --git a/cal/README b/cal/README index 2c2f1a5..2714062 100644 --- a/cal/README +++ b/cal/README @@ -1,7 +1,7 @@ Calc standard resource files ---------------------------- -To load a reosurce file, try: +To load a resource file, try: read filename @@ -59,7 +59,7 @@ files have already been read, the read -once will act as a noop. The "resource_debug" parameter is intended for controlling the possible display of special information relating to functions, objects, and -other structures created by instructions in calc resoure files. +other structures created by instructions in calc resource files. Zero value of config("resource_debug") means that no such information is displayed. For other values, the non-zero bits which currently have meanings are as follows: @@ -274,7 +274,7 @@ pell.cal pell(D) Solve Pell's equation; Returns the solution X to: X^2 - D * Y^2 = 1. - Type the solution to pells equation for a particular D. + Type the solution to Pell's equation for a particular D. pi.cal @@ -288,7 +288,7 @@ pi.cal The piforever() prints digits of pi, nicely formatted, for as long as your free memory space and system up time allows. - The piforever() funcion (written by Klaus Alexander Seistrup + The piforever() function (written by Klaus Alexander Seistrup ) was inspired by an algorithm conceived by Lambert Meertens. See also the ABC Programmer's Handbook, by Geurts, Meertens & Pemberton, published by Prentice-Hall (UK) Ltd., 1990. @@ -356,7 +356,7 @@ quat.cal quat_shift(a, b) Calculate using quaternions of the form: a + bi + cj + dk. In these - functions, quaternians are manipulated in the form: s + v, where + functions, quaternions are manipulated in the form: s + v, where s is a scalar and v is a vector of size 3. @@ -386,7 +386,7 @@ randombitrun.cal randombitrun([run_cnt]) Using randombit(1) to generate a sequence of random bits, determine if - the number and kength of identical bits runs match what is expected. + the number and length of identical bits runs match what is expected. By default, run_cnt is to test the next 65536 random values. This tests the Blum-Blum-Shub generator. @@ -489,7 +489,7 @@ test1700.cal value - This resoure files is used by regress.cal to test the read and use keywords. + This resource files is used by regress.cal to test the read and use keywords. test2600.cal @@ -514,7 +514,7 @@ test2600.cal checkresult(x, y, z, a) test2600(verbose, tnum) - This resoure files is used by regress.cal to test some of builtin functions + This resource files is used by regress.cal to test some of builtin functions in terms of accuracy and roundoff. @@ -537,7 +537,7 @@ test2700.cal iscomsq(x) test2700(verbose, tnum) - This resoure files is used by regress.cal to test sqrt() for real and + This resource files is used by regress.cal to test sqrt() for real and complex values. @@ -625,7 +625,7 @@ test4000.cal test4000(verbose, tnum) defined This resource file is used by regress.cal to test ptest, nextcand and - prevcand buildins. + prevcand builtins. test4100.cal @@ -677,6 +677,35 @@ test5200.cal This resource file is used by regress.cal to test the fix of a global/static bug. +test8400.cal + + test8400() defined + + This resource file is used by regress.cal to check for quit-based + memory leaks. + +test8500.cal + + global err_8500 + global L_8500 + global ver_8500 + global old_seed_8500 + global cfg_8500 + onetest_8500(a,b,rnd) defined + divmod_8500(N, M1, M2, testnum) defined + + This resource file is used by regress.cal to the // and % operators. + +test8600.cal + + global min_8600 + global max_8600 + global hash_8600 + global hmean_8600 + + This resource file is used by regress.cal to test a change of + allowing up to 1024 args to be passed to a builtin function. + unitfrac.cal unitfrac(x) @@ -705,7 +734,7 @@ xx_print.cal Demo for the xx_print object routines. -## Copyright (C) 1999 David I. Bell and Landon Curt Noll +## Copyright (C) 2000 David I. Bell and Landon Curt Noll ## ## Primary author: Landon Curt Noll ## @@ -723,8 +752,8 @@ xx_print.cal ## received a copy with calc; if not, write to Free Software Foundation, Inc. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## -## @(#) $Revision: 29.2 $ -## @(#) $Id: README,v 29.2 2000/06/07 14:02:25 chongo Exp $ +## @(#) $Revision: 29.3 $ +## @(#) $Id: README,v 29.3 2000/12/04 20:11:52 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/README,v $ ## ## Under source code control: 1990/02/15 01:50:32 diff --git a/cal/regress.cal b/cal/regress.cal index d215f03..11b91ca 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.3 $ - * @(#) $Id: regress.cal,v 29.3 2000/06/07 14:02:25 chongo Exp chongo $ + * @(#) $Revision: 29.5 $ + * @(#) $Id: regress.cal,v 29.5 2000/12/04 20:00:53 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/regress.cal,v $ * * Under source code control: 1990/02/15 01:50:36 @@ -7538,6 +7538,15 @@ read -once "test8500"; /* 85xx: Ending test_divmod is printed by test8500.cal */ +/* + * test_maxargs - test up to 1024 args being passed to a builtin function + */ +print; +print '8600: Starting test_1024args' +read -once "test8600"; +/* 86xx: Ending test_1024args is printed by test8600.cal */ + + /* * read various calc resource files * diff --git a/cal/test8600.cal b/cal/test8600.cal new file mode 100644 index 0000000..3f6197f --- /dev/null +++ b/cal/test8600.cal @@ -0,0 +1,1406 @@ +/* + * test8600 - 8600 series of the regress.cal test suite + * + * Copyright (C) 2000 Landon Curt Noll + * + * Primary author: Landon Curt Noll + * + * Calc is open software; you can redistribute it and/or modify it under + * the terms of the version 2.1 of the GNU Lesser General Public License + * as published by the Free Software Foundation. + * + * Calc is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General + * Public License for more details. + * + * A copy of version 2.1 of the GNU Lesser General Public License is + * distributed with calc under the filename COPYING-LGPL. You should have + * received a copy with calc; if not, write to Free Software Foundation, Inc. + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + * + * @(#) $Revision: 29.1 $ + * @(#) $Id: test8600.cal,v 29.1 2000/12/04 19:57:02 chongo Exp $ + * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test8600.cal,v $ + * + * Under source code control: 2000/12/04 19:57:02 + * File existed as early as: 2000 + * + * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ + */ + +/* + * test8600 - test builtin functions with 1024 args + */ + +/* + * min with 1024 args, one per line + */ +min_8600 = min( +1009, +1013, +1019, +1021, +1031, +1033, +1039, +1049, +1051, +1061, +1063, +1069, +1087, +1091, +1093, +1097, +1103, +1109, +1117, +1123, +1129, +1151, +1153, +1163, +1171, +1181, +1187, +1193, +1201, +1213, +1217, +1223, +1229, +1231, +1237, +1249, +1259, +1277, +1279, +1283, +1289, +1291, +1297, +1301, +1303, +1307, +1319, +1321, +1327, +1361, +1367, +1373, +1381, +1399, +1409, +1423, +1427, +1429, +1433, +1439, +1447, +1451, +1453, +1459, +1471, +1481, +1483, +1487, +1489, +1493, +1499, +1511, +1523, +1531, +1543, +1549, +1553, +1559, +1567, +1571, +1579, +1583, +1597, +1601, +1607, +1609, +1613, +1619, +1621, +1627, +1637, +1657, +1663, +1667, +1669, +1693, +1697, +1699, +1709, +1721, +1723, +1733, +1741, +1747, +1753, +1759, +1777, +1783, +1787, +1789, +1801, +1811, +1823, +1831, +1847, +1861, +1867, +1871, +1873, +1877, +1879, +1889, +1901, +1907, +1913, +1931, +1933, +1949, +1951, +1973, +1979, +1987, +1993, +1997, +1999, +2003, +2011, +2017, +2027, +2029, +2039, +2053, +2063, +2069, +2081, +2083, +2087, +2089, +2099, +2111, +2113, +2129, +2131, +2137, +2141, +2143, +2153, +2161, +2179, +2203, +2207, +2213, +2221, +2237, +2239, +2243, +2251, +2267, +2269, +2273, +2281, +2287, +2293, +2297, +2309, +2311, +2333, +2339, +2341, +2347, +2351, +2357, +2371, +2377, +2381, +2383, +2389, +2393, +2399, +2411, +2417, +2423, +2437, +2441, +2447, +2459, +2467, +2473, +2477, +2503, +2521, +2531, +2539, +2543, +2549, +2551, +2557, +2579, +2591, +2593, +2609, +2617, +2621, +2633, +2647, +2657, +2659, +2663, +2671, +2677, +2683, +2687, +2689, +2693, +2699, +2707, +2711, +2713, +2719, +2729, +2731, +2741, +2749, +2753, +2767, +2777, +2789, +2791, +2797, +2801, +2803, +2819, +2833, +2837, +2843, +2851, +2857, +2861, +2879, +2887, +2897, +2903, +2909, +2917, +2927, +2939, +2953, +2957, +2963, +2969, +2971, +2999, +3001, +3011, +3019, +3023, +3037, +3041, +3049, +3061, +3067, +3079, +3083, +3089, +3109, +3119, +3121, +3137, +3163, +3167, +3169, +3181, +3187, +3191, +3203, +3209, +3217, +3221, +3229, +3251, +3253, +3257, +3259, +3271, +3299, +3301, +3307, +3313, +3319, +3323, +3329, +3331, +3343, +3347, +3359, +3361, +3371, +3373, +3389, +3391, +3407, +3413, +3433, +3449, +3457, +3461, +3463, +3467, +3469, +3491, +3499, +3511, +3517, +3527, +3529, +3533, +3539, +3541, +3547, +3557, +3559, +3571, +3581, +3583, +3593, +3607, +3613, +3617, +3623, +3631, +3637, +3643, +3659, +3671, +3673, +3677, +3691, +3697, +3701, +3709, +3719, +3727, +3733, +3739, +3761, +3767, +3769, +3779, +3793, +3797, +3803, +3821, +3823, +3833, +3847, +3851, +3853, +3863, +3877, +3881, +3889, +3907, +3911, +3917, +3919, +3923, +3929, +3931, +3943, +3947, +3967, +3989, +4001, +4003, +4007, +4013, +4019, +4021, +4027, +4049, +4051, +4057, +4073, +4079, +4091, +4093, +4099, +4111, +4127, +4129, +4133, +4139, +4153, +4157, +4159, +4177, +4201, +4211, +4217, +4219, +4229, +4231, +4241, +4243, +4253, +4259, +4261, +4271, +4273, +4283, +4289, +4297, +4327, +4337, +4339, +4349, +4357, +4363, +4373, +4391, +4397, +4409, +4421, +4423, +4441, +4447, +4451, +4457, +4463, +4481, +4483, +4493, +4507, +4513, +4517, +4519, +4523, +4547, +4549, +4561, +4567, +4583, +4591, +4597, +4603, +4621, +4637, +4639, +4643, +4649, +4651, +4657, +4663, +4673, +4679, +4691, +4703, +4721, +4723, +4729, +4733, +4751, +4759, +4783, +4787, +4789, +4793, +4799, +4801, +4813, +4817, +4831, +4861, +4871, +4877, +4889, +4903, +4909, +4919, +4931, +4933, +4937, +4943, +4951, +4957, +4967, +4969, +4973, +4987, +4993, +4999, +5003, +5009, +5011, +5021, +5023, +503, +5039, +5051, +5059, +5077, +5081, +5087, +509, +5099, +5101, +5107, +5113, +5119, +5147, +5153, +5167, +5171, +5179, +5189, +5197, +5209, +521, +5227, +523, +5231, +5233, +5237, +5261, +5273, +5279, +5281, +5297, +5303, +5309, +5323, +5333, +5347, +5351, +5381, +5387, +5393, +5399, +5407, +541, +5413, +5417, +5419, +5431, +5437, +5441, +5443, +5449, +547, +5471, +5477, +5479, +5483, +5501, +5503, +5507, +5519, +5521, +5527, +5531, +5557, +5563, +5569, +557, +5573, +5581, +5591, +5623, +563, +5639, +5641, +5647, +5651, +5653, +5657, +5659, +5669, +5683, +5689, +569, +5693, +5701, +571, +5711, +5717, +5737, +5741, +5743, +5749, +577, +5779, +5783, +5791, +5801, +5807, +5813, +5821, +5827, +5839, +5843, +5849, +5851, +5857, +5861, +5867, +5869, +587, +5879, +5881, +5897, +5903, +5923, +5927, +593, +5939, +5953, +5981, +5987, +599, +6007, +601, +6011, +6029, +6037, +6043, +6047, +6053, +6067, +607, +6073, +6079, +6089, +6091, +6101, +6113, +6121, +613, +6131, +6133, +6143, +6151, +6163, +617, +6173, +619, +6197, +6199, +6203, +6211, +6217, +6221, +6229, +6247, +6257, +6263, +6269, +6271, +6277, +6287, +6299, +6301, +631, +6311, +6317, +6323, +6329, +6337, +6343, +6353, +6359, +6361, +6367, +6373, +6379, +6389, +6397, +641, +6421, +6427, +643, +6449, +6451, +6469, +647, +6473, +6481, +6491, +6521, +6529, +653, +6547, +6551, +6553, +6563, +6569, +6571, +6577, +6581, +659, +6599, +6607, +661, +6619, +6637, +6653, +6659, +6661, +6673, +6679, +6689, +6691, +6701, +6703, +6709, +6719, +673, +6733, +6737, +6761, +6763, +677, +6779, +6781, +6791, +6793, +6803, +6823, +6827, +6829, +683, +6833, +6841, +6857, +6863, +6869, +6871, +6883, +6899, +6907, +691, +6911, +6917, +6947, +6949, +6959, +6961, +6967, +6971, +6977, +6983, +6991, +6997, +7001, +701, +7013, +7019, +7027, +7039, +7043, +7057, +7069, +7079, +709, +7103, +7109, +7121, +7127, +7129, +7151, +7159, +7177, +7187, +719, +7193, +7207, +7211, +7213, +7219, +7229, +7237, +7243, +7247, +7253, +727, +7283, +7297, +7307, +7309, +7321, +733, +7331, +7333, +7349, +7351, +7369, +739, +7393, +7411, +7417, +743, +7433, +7451, +7457, +7459, +7477, +7481, +7487, +7489, +7499, +7507, +751, +7517, +7523, +7529, +7537, +7541, +7547, +7549, +7559, +7561, +757, +7573, +7577, +7583, +7589, +7591, +7603, +7607, +761, +7621, +7639, +7643, +7649, +7669, +7673, +7681, +7687, +769, +7691, +7699, +7703, +7717, +7723, +7727, +773, +7741, +7753, +7757, +7759, +7789, +7793, +7817, +7823, +7829, +7841, +7853, +7867, +787, +7873, +7877, +7879, +7883, +7901, +7907, +7919, +7927, +7933, +7937, +7949, +7951, +7963, +797, +7993, +8009, +8011, +8017, +8039, +8053, +8059, +8069, +8081, +8087, +8089, +809, +8093, +8101, +811, +8111, +8117, +8123, +8147, +8161, +8167, +8171, +8179, +8191, +8209, +821, +8219, +8221, +823, +8231, +8233, +8237, +8243, +8263, +8269, +827, +8273, +8287, +829, +8291, +8293, +8297, +8311, +8317, +8329, +8353, +8363, +8369, +8377, +8387, +8389, +839, +8419, +8423, +8429, +8431, +8443, +8447, +8461, +8467, +8501, +8513, +8521, +8527, +853, +8537, +8539, +8543, +8563, +857, +8573, +8581, +859, +8597, +8599, +8609, +8623, +8627, +8629, +863, +8641, +8647, +8663, +8669, +8677, +8681, +8689, +8693, +8699, +8707, +8713, +8719, +8731, +8737, +8741, +8747, +8753, +8761, +877, +8779, +8783, +8803, +8807, +881, +8819, +8821, +883, +8831, +8837, +8839, +8849, +8861, +8863, +8867, +887, +8887, +8893, +8923, +8929, +8933, +8941, +8951, +8963, +8969, +8971, +8999, +9001, +9007, +9011, +9013, +9029, +9041, +9043, +9049, +9059, +9067, +907, +9091, +9103, +9109, +911, +9127); +vrfy(min_8600 == 503, "8601: min() called with 1024 args"); + +/* + * max with 1024 args + */ +max_8600 = max(1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, +1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, +1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1229, 1231, 1237, 1249, +1259, 1277, 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321, 1327, +1361, 1367, 1373, 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, +1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1523, 1531, 1543, +1549, 1553, 1559, 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619, +1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, +1733, 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811, 1823, 1831, +1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931, 1933, +1949, 1951, 1973, 1979, 1987, 1993, 1997, 1999, 2003, 2011, 2017, 2027, 2029, +2039, 2053, 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129, 2131, +2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, 2221, 2237, 2239, 2243, +2251, 2267, 2269, 2273, 2281, 2287, 2293, 2297, 2309, 2311, 2333, 2339, 2341, +2347, 2351, 2357, 2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423, +2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503, 2521, 2531, 2539, 2543, 2549, +2551, 2557, 2579, 2591, 2593, 2609, 2617, 2621, 2633, 2647, 2657, 2659, 2663, +2671, 2677, 2683, 2687, 2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729, 2731, +2741, 2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801, 2803, 2819, 2833, 2837, +2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903, 2909, 2917, 2927, 2939, 2953, +2957, 2963, 2969, 2971, 2999, 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061, +3067, 3079, 3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167, 3169, 3181, 3187, +3191, 3203, 3209, 3217, 3221, 3229, 3251, 3253, 3257, 3259, 3271, 3299, 3301, +3307, 3313, 3319, 3323, 3329, 3331, 3343, 3347, 3359, 3361, 3371, 3373, 3389, +3391, 3407, 3413, 3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491, 3499, 3511, +3517, 3527, 3529, 3533, 3539, 3541, 3547, 3557, 3559, 3571, 3581, 3583, 3593, +3607, 3613, 3617, 3623, 3631, 3637, 3643, 3659, 3671, 3673, 3677, 3691, 3697, +3701, 3709, 3719, 3727, 3733, 3739, 3761, 3767, 3769, 3779, 3793, 3797, 3803, +3821, 3823, 3833, 3847, 3851, 3853, 3863, 3877, 3881, 3889, 3907, 3911, 3917, +3919, 3923, 3929, 3931, 3943, 3947, 3967, 3989, 4001, 4003, 4007, 4013, 4019, +4021, 4027, 4049, 4051, 4057, 4073, 4079, 4091, 4093, 4099, 4111, 4127, 4129, +4133, 4139, 4153, 4157, 4159, 4177, 4201, 4211, 4217, 4219, 4229, 4231, 4241, +4243, 4253, 4259, 4261, 4271, 4273, 4283, 4289, 4297, 4327, 4337, 4339, 4349, +4357, 4363, 4373, 4391, 4397, 4409, 4421, 4423, 4441, 4447, 4451, 4457, 4463, +4481, 4483, 4493, 4507, 4513, 4517, 4519, 4523, 4547, 4549, 4561, 4567, 4583, +4591, 4597, 4603, 4621, 4637, 4639, 4643, 4649, 4651, 4657, 4663, 4673, 4679, +4691, 4703, 4721, 4723, 4729, 4733, 4751, 4759, 4783, 4787, 4789, 4793, 4799, +4801, 4813, 4817, 4831, 4861, 4871, 4877, 4889, 4903, 4909, 4919, 4931, 4933, +4937, 4943, 4951, 4957, 4967, 4969, 4973, 4987, 4993, 4999, 5003, 5009, 5011, +5021, 5023, 503, 5039, 5051, 5059, 5077, 5081, 5087, 509, 5099, 5101, 5107, +5113, 5119, 5147, 5153, 5167, 5171, 5179, 5189, 5197, 5209, 521, 5227, 523, +5231, 5233, 5237, 5261, 5273, 5279, 5281, 5297, 5303, 5309, 5323, 5333, 5347, +5351, 5381, 5387, 5393, 5399, 5407, 541, 5413, 5417, 5419, 5431, 5437, 5441, +5443, 5449, 547, 5471, 5477, 5479, 5483, 5501, 5503, 5507, 5519, 5521, 5527, +5531, 5557, 5563, 5569, 557, 5573, 5581, 5591, 5623, 563, 5639, 5641, 5647, +5651, 5653, 5657, 5659, 5669, 5683, 5689, 569, 5693, 5701, 571, 5711, 5717, +5737, 5741, 5743, 5749, 577, 5779, 5783, 5791, 5801, 5807, 5813, 5821, 5827, +5839, 5843, 5849, 5851, 5857, 5861, 5867, 5869, 587, 5879, 5881, 5897, 5903, +5923, 5927, 593, 5939, 5953, 5981, 5987, 599, 6007, 601, 6011, 6029, 6037, +6043, 6047, 6053, 6067, 607, 6073, 6079, 6089, 6091, 6101, 6113, 6121, 613, +6131, 6133, 6143, 6151, 6163, 617, 6173, 619, 6197, 6199, 6203, 6211, 6217, +6221, 6229, 6247, 6257, 6263, 6269, 6271, 6277, 6287, 6299, 6301, 631, 6311, +6317, 6323, 6329, 6337, 6343, 6353, 6359, 6361, 6367, 6373, 6379, 6389, 6397, +641, 6421, 6427, 643, 6449, 6451, 6469, 647, 6473, 6481, 6491, 6521, 6529, +653, 6547, 6551, 6553, 6563, 6569, 6571, 6577, 6581, 659, 6599, 6607, 661, +6619, 6637, 6653, 6659, 6661, 6673, 6679, 6689, 6691, 6701, 6703, 6709, 6719, +673, 6733, 6737, 6761, 6763, 677, 6779, 6781, 6791, 6793, 6803, 6823, 6827, +6829, 683, 6833, 6841, 6857, 6863, 6869, 6871, 6883, 6899, 6907, 691, 6911, +6917, 6947, 6949, 6959, 6961, 6967, 6971, 6977, 6983, 6991, 6997, 7001, 701, +7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 709, 7103, 7109, 7121, 7127, +7129, 7151, 7159, 7177, 7187, 719, 7193, 7207, 7211, 7213, 7219, 7229, 7237, +7243, 7247, 7253, 727, 7283, 7297, 7307, 7309, 7321, 733, 7331, 7333, 7349, +7351, 7369, 739, 7393, 7411, 7417, 743, 7433, 7451, 7457, 7459, 7477, 7481, +7487, 7489, 7499, 7507, 751, 7517, 7523, 7529, 7537, 7541, 7547, 7549, 7559, +7561, 757, 7573, 7577, 7583, 7589, 7591, 7603, 7607, 761, 7621, 7639, 7643, +7649, 7669, 7673, 7681, 7687, 769, 7691, 7699, 7703, 7717, 7723, 7727, 773, +7741, 7753, 7757, 7759, 7789, 7793, 7817, 7823, 7829, 7841, 7853, 7867, 787, +7873, 7877, 7879, 7883, 7901, 7907, 7919, 7927, 7933, 7937, 7949, 7951, 7963, +797, 7993, 8009, 8011, 8017, 8039, 8053, 8059, 8069, 8081, 8087, 8089, 809, +8093, 8101, 811, 8111, 8117, 8123, 8147, 8161, 8167, 8171, 8179, 8191, 8209, +821, 8219, 8221, 823, 8231, 8233, 8237, 8243, 8263, 8269, 827, 8273, 8287, +829, 8291, 8293, 8297, 8311, 8317, 8329, 8353, 8363, 8369, 8377, 8387, 8389, +839, 8419, 8423, 8429, 8431, 8443, 8447, 8461, 8467, 8501, 8513, 8521, 8527, +853, 8537, 8539, 8543, 8563, 857, 8573, 8581, 859, 8597, 8599, 8609, 8623, +8627, 8629, 863, 8641, 8647, 8663, 8669, 8677, 8681, 8689, 8693, 8699, 8707, +8713, 8719, 8731, 8737, 8741, 8747, 8753, 8761, 877, 8779, 8783, 8803, 8807, +881, 8819, 8821, 883, 8831, 8837, 8839, 8849, 8861, 8863, 8867, 887, 8887, +8893, 8923, 8929, 8933, 8941, 8951, 8963, 8969, 8971, 8999, 9001, 9007, 9011, +9013, 9029, 9041, 9043, 9049, 9059, 9067, 907, 9091, 9103, 9109, 911, 9127); +vrfy(max_8600 == 9127, "8602: max() called with 1024 args"); + +/* + * ssq with 1024 args + */ +ssq_8600 = ssq(1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, +1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, +1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1229, 1231, 1237, 1249, +1259, 1277, 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321, 1327, +1361, 1367, 1373, 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, +1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1523, 1531, 1543, +1549, 1553, 1559, 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619, +1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, +1733, 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811, 1823, 1831, +1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931, 1933, +1949, 1951, 1973, 1979, 1987, 1993, 1997, 1999, 2003, 2011, 2017, 2027, 2029, +2039, 2053, 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129, 2131, +2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, 2221, 2237, 2239, 2243, +2251, 2267, 2269, 2273, 2281, 2287, 2293, 2297, 2309, 2311, 2333, 2339, 2341, +2347, 2351, 2357, 2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423, +2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503, 2521, 2531, 2539, 2543, 2549, +2551, 2557, 2579, 2591, 2593, 2609, 2617, 2621, 2633, 2647, 2657, 2659, 2663, +2671, 2677, 2683, 2687, 2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729, 2731, +2741, 2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801, 2803, 2819, 2833, 2837, +2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903, 2909, 2917, 2927, 2939, 2953, +2957, 2963, 2969, 2971, 2999, 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061, +3067, 3079, 3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167, 3169, 3181, 3187, +3191, 3203, 3209, 3217, 3221, 3229, 3251, 3253, 3257, 3259, 3271, 3299, 3301, +3307, 3313, 3319, 3323, 3329, 3331, 3343, 3347, 3359, 3361, 3371, 3373, 3389, +3391, 3407, 3413, 3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491, 3499, 3511, +3517, 3527, 3529, 3533, 3539, 3541, 3547, 3557, 3559, 3571, 3581, 3583, 3593, +3607, 3613, 3617, 3623, 3631, 3637, 3643, 3659, 3671, 3673, 3677, 3691, 3697, +3701, 3709, 3719, 3727, 3733, 3739, 3761, 3767, 3769, 3779, 3793, 3797, 3803, +3821, 3823, 3833, 3847, 3851, 3853, 3863, 3877, 3881, 3889, 3907, 3911, 3917, +3919, 3923, 3929, 3931, 3943, 3947, 3967, 3989, 4001, 4003, 4007, 4013, 4019, +4021, 4027, 4049, 4051, 4057, 4073, 4079, 4091, 4093, 4099, 4111, 4127, 4129, +4133, 4139, 4153, 4157, 4159, 4177, 4201, 4211, 4217, 4219, 4229, 4231, 4241, +4243, 4253, 4259, 4261, 4271, 4273, 4283, 4289, 4297, 4327, 4337, 4339, 4349, +4357, 4363, 4373, 4391, 4397, 4409, 4421, 4423, 4441, 4447, 4451, 4457, 4463, +4481, 4483, 4493, 4507, 4513, 4517, 4519, 4523, 4547, 4549, 4561, 4567, 4583, +4591, 4597, 4603, 4621, 4637, 4639, 4643, 4649, 4651, 4657, 4663, 4673, 4679, +4691, 4703, 4721, 4723, 4729, 4733, 4751, 4759, 4783, 4787, 4789, 4793, 4799, +4801, 4813, 4817, 4831, 4861, 4871, 4877, 4889, 4903, 4909, 4919, 4931, 4933, +4937, 4943, 4951, 4957, 4967, 4969, 4973, 4987, 4993, 4999, 5003, 5009, 5011, +5021, 5023, 503, 5039, 5051, 5059, 5077, 5081, 5087, 509, 5099, 5101, 5107, +5113, 5119, 5147, 5153, 5167, 5171, 5179, 5189, 5197, 5209, 521, 5227, 523, +5231, 5233, 5237, 5261, 5273, 5279, 5281, 5297, 5303, 5309, 5323, 5333, 5347, +5351, 5381, 5387, 5393, 5399, 5407, 541, 5413, 5417, 5419, 5431, 5437, 5441, +5443, 5449, 547, 5471, 5477, 5479, 5483, 5501, 5503, 5507, 5519, 5521, 5527, +5531, 5557, 5563, 5569, 557, 5573, 5581, 5591, 5623, 563, 5639, 5641, 5647, +5651, 5653, 5657, 5659, 5669, 5683, 5689, 569, 5693, 5701, 571, 5711, 5717, +5737, 5741, 5743, 5749, 577, 5779, 5783, 5791, 5801, 5807, 5813, 5821, 5827, +5839, 5843, 5849, 5851, 5857, 5861, 5867, 5869, 587, 5879, 5881, 5897, 5903, +5923, 5927, 593, 5939, 5953, 5981, 5987, 599, 6007, 601, 6011, 6029, 6037, +6043, 6047, 6053, 6067, 607, 6073, 6079, 6089, 6091, 6101, 6113, 6121, 613, +6131, 6133, 6143, 6151, 6163, 617, 6173, 619, 6197, 6199, 6203, 6211, 6217, +6221, 6229, 6247, 6257, 6263, 6269, 6271, 6277, 6287, 6299, 6301, 631, 6311, +6317, 6323, 6329, 6337, 6343, 6353, 6359, 6361, 6367, 6373, 6379, 6389, 6397, +641, 6421, 6427, 643, 6449, 6451, 6469, 647, 6473, 6481, 6491, 6521, 6529, +653, 6547, 6551, 6553, 6563, 6569, 6571, 6577, 6581, 659, 6599, 6607, 661, +6619, 6637, 6653, 6659, 6661, 6673, 6679, 6689, 6691, 6701, 6703, 6709, 6719, +673, 6733, 6737, 6761, 6763, 677, 6779, 6781, 6791, 6793, 6803, 6823, 6827, +6829, 683, 6833, 6841, 6857, 6863, 6869, 6871, 6883, 6899, 6907, 691, 6911, +6917, 6947, 6949, 6959, 6961, 6967, 6971, 6977, 6983, 6991, 6997, 7001, 701, +7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 709, 7103, 7109, 7121, 7127, +7129, 7151, 7159, 7177, 7187, 719, 7193, 7207, 7211, 7213, 7219, 7229, 7237, +7243, 7247, 7253, 727, 7283, 7297, 7307, 7309, 7321, 733, 7331, 7333, 7349, +7351, 7369, 739, 7393, 7411, 7417, 743, 7433, 7451, 7457, 7459, 7477, 7481, +7487, 7489, 7499, 7507, 751, 7517, 7523, 7529, 7537, 7541, 7547, 7549, 7559, +7561, 757, 7573, 7577, 7583, 7589, 7591, 7603, 7607, 761, 7621, 7639, 7643, +7649, 7669, 7673, 7681, 7687, 769, 7691, 7699, 7703, 7717, 7723, 7727, 773, +7741, 7753, 7757, 7759, 7789, 7793, 7817, 7823, 7829, 7841, 7853, 7867, 787, +7873, 7877, 7879, 7883, 7901, 7907, 7919, 7927, 7933, 7937, 7949, 7951, 7963, +797, 7993, 8009, 8011, 8017, 8039, 8053, 8059, 8069, 8081, 8087, 8089, 809, +8093, 8101, 811, 8111, 8117, 8123, 8147, 8161, 8167, 8171, 8179, 8191, 8209, +821, 8219, 8221, 823, 8231, 8233, 8237, 8243, 8263, 8269, 827, 8273, 8287, +829, 8291, 8293, 8297, 8311, 8317, 8329, 8353, 8363, 8369, 8377, 8387, 8389, +839, 8419, 8423, 8429, 8431, 8443, 8447, 8461, 8467, 8501, 8513, 8521, 8527, +853, 8537, 8539, 8543, 8563, 857, 8573, 8581, 859, 8597, 8599, 8609, 8623, +8627, 8629, 863, 8641, 8647, 8663, 8669, 8677, 8681, 8689, 8693, 8699, 8707, +8713, 8719, 8731, 8737, 8741, 8747, 8753, 8761, 877, 8779, 8783, 8803, 8807, +881, 8819, 8821, 883, 8831, 8837, 8839, 8849, 8861, 8863, 8867, 887, 8887, +8893, 8923, 8929, 8933, 8941, 8951, 8963, 8969, 8971, 8999, 9001, 9007, 9011, +9013, 9029, 9041, 9043, 9049, 9059, 9067, 907, 9091, 9103, 9109, 911, 9127); +vrfy(ssq_8600 == 28585330720, "8603: ssq() called with 1024 args"); + +/* + * hash with 1024 args + */ +hash_8600 = hash(1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, +1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, +1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1229, 1231, 1237, 1249, +1259, 1277, 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321, 1327, +1361, 1367, 1373, 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, +1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1523, 1531, 1543, +1549, 1553, 1559, 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619, +1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, +1733, 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811, 1823, 1831, +1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931, 1933, +1949, 1951, 1973, 1979, 1987, 1993, 1997, 1999, 2003, 2011, 2017, 2027, 2029, +2039, 2053, 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129, 2131, +2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, 2221, 2237, 2239, 2243, +2251, 2267, 2269, 2273, 2281, 2287, 2293, 2297, 2309, 2311, 2333, 2339, 2341, +2347, 2351, 2357, 2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423, +2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503, 2521, 2531, 2539, 2543, 2549, +2551, 2557, 2579, 2591, 2593, 2609, 2617, 2621, 2633, 2647, 2657, 2659, 2663, +2671, 2677, 2683, 2687, 2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729, 2731, +2741, 2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801, 2803, 2819, 2833, 2837, +2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903, 2909, 2917, 2927, 2939, 2953, +2957, 2963, 2969, 2971, 2999, 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061, +3067, 3079, 3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167, 3169, 3181, 3187, +3191, 3203, 3209, 3217, 3221, 3229, 3251, 3253, 3257, 3259, 3271, 3299, 3301, +3307, 3313, 3319, 3323, 3329, 3331, 3343, 3347, 3359, 3361, 3371, 3373, 3389, +3391, 3407, 3413, 3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491, 3499, 3511, +3517, 3527, 3529, 3533, 3539, 3541, 3547, 3557, 3559, 3571, 3581, 3583, 3593, +3607, 3613, 3617, 3623, 3631, 3637, 3643, 3659, 3671, 3673, 3677, 3691, 3697, +3701, 3709, 3719, 3727, 3733, 3739, 3761, 3767, 3769, 3779, 3793, 3797, 3803, +3821, 3823, 3833, 3847, 3851, 3853, 3863, 3877, 3881, 3889, 3907, 3911, 3917, +3919, 3923, 3929, 3931, 3943, 3947, 3967, 3989, 4001, 4003, 4007, 4013, 4019, +4021, 4027, 4049, 4051, 4057, 4073, 4079, 4091, 4093, 4099, 4111, 4127, 4129, +4133, 4139, 4153, 4157, 4159, 4177, 4201, 4211, 4217, 4219, 4229, 4231, 4241, +4243, 4253, 4259, 4261, 4271, 4273, 4283, 4289, 4297, 4327, 4337, 4339, 4349, +4357, 4363, 4373, 4391, 4397, 4409, 4421, 4423, 4441, 4447, 4451, 4457, 4463, +4481, 4483, 4493, 4507, 4513, 4517, 4519, 4523, 4547, 4549, 4561, 4567, 4583, +4591, 4597, 4603, 4621, 4637, 4639, 4643, 4649, 4651, 4657, 4663, 4673, 4679, +4691, 4703, 4721, 4723, 4729, 4733, 4751, 4759, 4783, 4787, 4789, 4793, 4799, +4801, 4813, 4817, 4831, 4861, 4871, 4877, 4889, 4903, 4909, 4919, 4931, 4933, +4937, 4943, 4951, 4957, 4967, 4969, 4973, 4987, 4993, 4999, 5003, 5009, 5011, +5021, 5023, 503, 5039, 5051, 5059, 5077, 5081, 5087, 509, 5099, 5101, 5107, +5113, 5119, 5147, 5153, 5167, 5171, 5179, 5189, 5197, 5209, 521, 5227, 523, +5231, 5233, 5237, 5261, 5273, 5279, 5281, 5297, 5303, 5309, 5323, 5333, 5347, +5351, 5381, 5387, 5393, 5399, 5407, 541, 5413, 5417, 5419, 5431, 5437, 5441, +5443, 5449, 547, 5471, 5477, 5479, 5483, 5501, 5503, 5507, 5519, 5521, 5527, +5531, 5557, 5563, 5569, 557, 5573, 5581, 5591, 5623, 563, 5639, 5641, 5647, +5651, 5653, 5657, 5659, 5669, 5683, 5689, 569, 5693, 5701, 571, 5711, 5717, +5737, 5741, 5743, 5749, 577, 5779, 5783, 5791, 5801, 5807, 5813, 5821, 5827, +5839, 5843, 5849, 5851, 5857, 5861, 5867, 5869, 587, 5879, 5881, 5897, 5903, +5923, 5927, 593, 5939, 5953, 5981, 5987, 599, 6007, 601, 6011, 6029, 6037, +6043, 6047, 6053, 6067, 607, 6073, 6079, 6089, 6091, 6101, 6113, 6121, 613, +6131, 6133, 6143, 6151, 6163, 617, 6173, 619, 6197, 6199, 6203, 6211, 6217, +6221, 6229, 6247, 6257, 6263, 6269, 6271, 6277, 6287, 6299, 6301, 631, 6311, +6317, 6323, 6329, 6337, 6343, 6353, 6359, 6361, 6367, 6373, 6379, 6389, 6397, +641, 6421, 6427, 643, 6449, 6451, 6469, 647, 6473, 6481, 6491, 6521, 6529, +653, 6547, 6551, 6553, 6563, 6569, 6571, 6577, 6581, 659, 6599, 6607, 661, +6619, 6637, 6653, 6659, 6661, 6673, 6679, 6689, 6691, 6701, 6703, 6709, 6719, +673, 6733, 6737, 6761, 6763, 677, 6779, 6781, 6791, 6793, 6803, 6823, 6827, +6829, 683, 6833, 6841, 6857, 6863, 6869, 6871, 6883, 6899, 6907, 691, 6911, +6917, 6947, 6949, 6959, 6961, 6967, 6971, 6977, 6983, 6991, 6997, 7001, 701, +7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 709, 7103, 7109, 7121, 7127, +7129, 7151, 7159, 7177, 7187, 719, 7193, 7207, 7211, 7213, 7219, 7229, 7237, +7243, 7247, 7253, 727, 7283, 7297, 7307, 7309, 7321, 733, 7331, 7333, 7349, +7351, 7369, 739, 7393, 7411, 7417, 743, 7433, 7451, 7457, 7459, 7477, 7481, +7487, 7489, 7499, 7507, 751, 7517, 7523, 7529, 7537, 7541, 7547, 7549, 7559, +7561, 757, 7573, 7577, 7583, 7589, 7591, 7603, 7607, 761, 7621, 7639, 7643, +7649, 7669, 7673, 7681, 7687, 769, 7691, 7699, 7703, 7717, 7723, 7727, 773, +7741, 7753, 7757, 7759, 7789, 7793, 7817, 7823, 7829, 7841, 7853, 7867, 787, +7873, 7877, 7879, 7883, 7901, 7907, 7919, 7927, 7933, 7937, 7949, 7951, 7963, +797, 7993, 8009, 8011, 8017, 8039, 8053, 8059, 8069, 8081, 8087, 8089, 809, +8093, 8101, 811, 8111, 8117, 8123, 8147, 8161, 8167, 8171, 8179, 8191, 8209, +821, 8219, 8221, 823, 8231, 8233, 8237, 8243, 8263, 8269, 827, 8273, 8287, +829, 8291, 8293, 8297, 8311, 8317, 8329, 8353, 8363, 8369, 8377, 8387, 8389, +839, 8419, 8423, 8429, 8431, 8443, 8447, 8461, 8467, 8501, 8513, 8521, 8527, +853, 8537, 8539, 8543, 8563, 857, 8573, 8581, 859, 8597, 8599, 8609, 8623, +8627, 8629, 863, 8641, 8647, 8663, 8669, 8677, 8681, 8689, 8693, 8699, 8707, +8713, 8719, 8731, 8737, 8741, 8747, 8753, 8761, 877, 8779, 8783, 8803, 8807, +881, 8819, 8821, 883, 8831, 8837, 8839, 8849, 8861, 8863, 8867, 887, 8887, +8893, 8923, 8929, 8933, 8941, 8951, 8963, 8969, 8971, 8999, 9001, 9007, 9011, +9013, 9029, 9041, 9043, 9049, 9059, 9067, 907, 9091, 9103, 9109, 911, 9127); +vrfy(hash_8600 == 1365716825, "8604: hash() called with 1024 args"); + +/* + * int(hmean with 1024 args) + */ +hmean_8600 = int( + hmean(1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, +1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, +1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1229, 1231, 1237, 1249, +1259, 1277, 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321, 1327, +1361, 1367, 1373, 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, +1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1523, 1531, 1543, +1549, 1553, 1559, 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619, +1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, +1733, 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811, 1823, 1831, +1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931, 1933, +1949, 1951, 1973, 1979, 1987, 1993, 1997, 1999, 2003, 2011, 2017, 2027, 2029, +2039, 2053, 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129, 2131, +2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, 2221, 2237, 2239, 2243, +2251, 2267, 2269, 2273, 2281, 2287, 2293, 2297, 2309, 2311, 2333, 2339, 2341, +2347, 2351, 2357, 2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423, +2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503, 2521, 2531, 2539, 2543, 2549, +2551, 2557, 2579, 2591, 2593, 2609, 2617, 2621, 2633, 2647, 2657, 2659, 2663, +2671, 2677, 2683, 2687, 2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729, 2731, +2741, 2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801, 2803, 2819, 2833, 2837, +2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903, 2909, 2917, 2927, 2939, 2953, +2957, 2963, 2969, 2971, 2999, 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061, +3067, 3079, 3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167, 3169, 3181, 3187, +3191, 3203, 3209, 3217, 3221, 3229, 3251, 3253, 3257, 3259, 3271, 3299, 3301, +3307, 3313, 3319, 3323, 3329, 3331, 3343, 3347, 3359, 3361, 3371, 3373, 3389, +3391, 3407, 3413, 3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491, 3499, 3511, +3517, 3527, 3529, 3533, 3539, 3541, 3547, 3557, 3559, 3571, 3581, 3583, 3593, +3607, 3613, 3617, 3623, 3631, 3637, 3643, 3659, 3671, 3673, 3677, 3691, 3697, +3701, 3709, 3719, 3727, 3733, 3739, 3761, 3767, 3769, 3779, 3793, 3797, 3803, +3821, 3823, 3833, 3847, 3851, 3853, 3863, 3877, 3881, 3889, 3907, 3911, 3917, +3919, 3923, 3929, 3931, 3943, 3947, 3967, 3989, 4001, 4003, 4007, 4013, 4019, +4021, 4027, 4049, 4051, 4057, 4073, 4079, 4091, 4093, 4099, 4111, 4127, 4129, +4133, 4139, 4153, 4157, 4159, 4177, 4201, 4211, 4217, 4219, 4229, 4231, 4241, +4243, 4253, 4259, 4261, 4271, 4273, 4283, 4289, 4297, 4327, 4337, 4339, 4349, +4357, 4363, 4373, 4391, 4397, 4409, 4421, 4423, 4441, 4447, 4451, 4457, 4463, +4481, 4483, 4493, 4507, 4513, 4517, 4519, 4523, 4547, 4549, 4561, 4567, 4583, +4591, 4597, 4603, 4621, 4637, 4639, 4643, 4649, 4651, 4657, 4663, 4673, 4679, +4691, 4703, 4721, 4723, 4729, 4733, 4751, 4759, 4783, 4787, 4789, 4793, 4799, +4801, 4813, 4817, 4831, 4861, 4871, 4877, 4889, 4903, 4909, 4919, 4931, 4933, +4937, 4943, 4951, 4957, 4967, 4969, 4973, 4987, 4993, 4999, 5003, 5009, 5011, +5021, 5023, 503, 5039, 5051, 5059, 5077, 5081, 5087, 509, 5099, 5101, 5107, +5113, 5119, 5147, 5153, 5167, 5171, 5179, 5189, 5197, 5209, 521, 5227, 523, +5231, 5233, 5237, 5261, 5273, 5279, 5281, 5297, 5303, 5309, 5323, 5333, 5347, +5351, 5381, 5387, 5393, 5399, 5407, 541, 5413, 5417, 5419, 5431, 5437, 5441, +5443, 5449, 547, 5471, 5477, 5479, 5483, 5501, 5503, 5507, 5519, 5521, 5527, +5531, 5557, 5563, 5569, 557, 5573, 5581, 5591, 5623, 563, 5639, 5641, 5647, +5651, 5653, 5657, 5659, 5669, 5683, 5689, 569, 5693, 5701, 571, 5711, 5717, +5737, 5741, 5743, 5749, 577, 5779, 5783, 5791, 5801, 5807, 5813, 5821, 5827, +5839, 5843, 5849, 5851, 5857, 5861, 5867, 5869, 587, 5879, 5881, 5897, 5903, +5923, 5927, 593, 5939, 5953, 5981, 5987, 599, 6007, 601, 6011, 6029, 6037, +6043, 6047, 6053, 6067, 607, 6073, 6079, 6089, 6091, 6101, 6113, 6121, 613, +6131, 6133, 6143, 6151, 6163, 617, 6173, 619, 6197, 6199, 6203, 6211, 6217, +6221, 6229, 6247, 6257, 6263, 6269, 6271, 6277, 6287, 6299, 6301, 631, 6311, +6317, 6323, 6329, 6337, 6343, 6353, 6359, 6361, 6367, 6373, 6379, 6389, 6397, +641, 6421, 6427, 643, 6449, 6451, 6469, 647, 6473, 6481, 6491, 6521, 6529, +653, 6547, 6551, 6553, 6563, 6569, 6571, 6577, 6581, 659, 6599, 6607, 661, +6619, 6637, 6653, 6659, 6661, 6673, 6679, 6689, 6691, 6701, 6703, 6709, 6719, +673, 6733, 6737, 6761, 6763, 677, 6779, 6781, 6791, 6793, 6803, 6823, 6827, +6829, 683, 6833, 6841, 6857, 6863, 6869, 6871, 6883, 6899, 6907, 691, 6911, +6917, 6947, 6949, 6959, 6961, 6967, 6971, 6977, 6983, 6991, 6997, 7001, 701, +7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 709, 7103, 7109, 7121, 7127, +7129, 7151, 7159, 7177, 7187, 719, 7193, 7207, 7211, 7213, 7219, 7229, 7237, +7243, 7247, 7253, 727, 7283, 7297, 7307, 7309, 7321, 733, 7331, 7333, 7349, +7351, 7369, 739, 7393, 7411, 7417, 743, 7433, 7451, 7457, 7459, 7477, 7481, +7487, 7489, 7499, 7507, 751, 7517, 7523, 7529, 7537, 7541, 7547, 7549, 7559, +7561, 757, 7573, 7577, 7583, 7589, 7591, 7603, 7607, 761, 7621, 7639, 7643, +7649, 7669, 7673, 7681, 7687, 769, 7691, 7699, 7703, 7717, 7723, 7727, 773, +7741, 7753, 7757, 7759, 7789, 7793, 7817, 7823, 7829, 7841, 7853, 7867, 787, +7873, 7877, 7879, 7883, 7901, 7907, 7919, 7927, 7933, 7937, 7949, 7951, 7963, +797, 7993, 8009, 8011, 8017, 8039, 8053, 8059, 8069, 8081, 8087, 8089, 809, +8093, 8101, 811, 8111, 8117, 8123, 8147, 8161, 8167, 8171, 8179, 8191, 8209, +821, 8219, 8221, 823, 8231, 8233, 8237, 8243, 8263, 8269, 827, 8273, 8287, +829, 8291, 8293, 8297, 8311, 8317, 8329, 8353, 8363, 8369, 8377, 8387, 8389, +839, 8419, 8423, 8429, 8431, 8443, 8447, 8461, 8467, 8501, 8513, 8521, 8527, +853, 8537, 8539, 8543, 8563, 857, 8573, 8581, 859, 8597, 8599, 8609, 8623, +8627, 8629, 863, 8641, 8647, 8663, 8669, 8677, 8681, 8689, 8693, 8699, 8707, +8713, 8719, 8731, 8737, 8741, 8747, 8753, 8761, 877, 8779, 8783, 8803, 8807, +881, 8819, 8821, 883, 8831, 8837, 8839, 8849, 8861, 8863, 8867, 887, 8887, +8893, 8923, 8929, 8933, 8941, 8951, 8963, 8969, 8971, 8999, 9001, 9007, 9011, +9013, 9029, 9041, 9043, 9049, 9059, 9067, 907, 9091, 9103, 9109, 911, 9127)); +vrfy(hmean_8600 == 2816, "8605: int(hmean()) called with 1024 args"); + +/* + * finished with 8600 tests + */ +print '8606: Ending test_1024args'; diff --git a/calc.c b/calc.c index e278a1f..767a680 100644 --- a/calc.c +++ b/calc.c @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.4 $ - * @(#) $Id: calc.c,v 29.4 2000/06/07 14:02:13 chongo Exp chongo $ + * @(#) $Revision: 29.5 $ + * @(#) $Id: calc.c,v 29.5 2000/07/17 15:35:49 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.c,v $ * * Under source code control: 1990/02/15 01:48:11 diff --git a/calc.h b/calc.h index b826998..39533aa 100644 --- a/calc.h +++ b/calc.h @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.3 $ - * @(#) $Id: calc.h,v 29.3 2000/06/07 14:02:13 chongo Exp chongo $ + * @(#) $Revision: 29.5 $ + * @(#) $Id: calc.h,v 29.5 2000/12/04 19:32:33 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.h,v $ * * Under source code control: 1990/02/15 01:48:31 @@ -62,7 +62,7 @@ #define SYMBOLSIZE 256 /* maximum symbol name size */ #define MAXLABELS 100 /* maximum number of user labels in function */ #define MAXSTRING 1024 /* maximum size of string constant */ -#define MAXSTACK 1000 /* maximum depth of evaluation stack */ +#define MAXSTACK 2048 /* maximum depth of evaluation stack */ #define MAXFILES 20 /* maximum number of opened files */ #define PROMPT1 "> " /* default normal prompt*/ #define PROMPT2 ">> " /* default prompt inside multi-line input */ diff --git a/calcerr.tbl b/calcerr.tbl index 7399c16..4255872 100644 --- a/calcerr.tbl +++ b/calcerr.tbl @@ -17,8 +17,8 @@ # received a copy with calc; if not, write to Free Software Foundation, Inc. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # -# @(#) $Revision: 29.2 $ -# @(#) $Id: calcerr.tbl,v 29.2 2000/06/07 14:02:13 chongo Exp chongo $ +# @(#) $Revision: 29.3 $ +# @(#) $Id: calcerr.tbl,v 29.3 2000/07/17 15:35:49 chongo Exp $ # @(#) $Source: /usr/local/src/cmd/calc/RCS/calcerr.tbl,v $ # # Under source code control: 1996/05/23 17:38:44 diff --git a/cmath.h b/cmath.h index 4d24bce..5319211 100644 --- a/cmath.h +++ b/cmath.h @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.2 $ - * @(#) $Id: cmath.h,v 29.2 2000/06/07 14:02:13 chongo Exp chongo $ + * @(#) $Revision: 29.3 $ + * @(#) $Id: cmath.h,v 29.3 2000/07/17 15:35:49 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/cmath.h,v $ * * Under source code control: 1993/07/30 19:42:45 diff --git a/codegen.c b/codegen.c index 75305c4..5745267 100644 --- a/codegen.c +++ b/codegen.c @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.2 $ - * @(#) $Id: codegen.c,v 29.2 2000/06/07 14:02:13 chongo Exp chongo $ + * @(#) $Revision: 29.3 $ + * @(#) $Id: codegen.c,v 29.3 2000/07/17 15:35:49 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/codegen.c,v $ * * Under source code control: 1990/02/15 01:48:13 @@ -162,6 +162,7 @@ getcommands(BOOL toplevel) } for (;;) { if (getfilename(name, &rdonce)) + break; switch (opensearchfile(name,calcpath, CALCEXT,rdonce)) { case 0: diff --git a/comfunc.c b/comfunc.c index f1defe2..ff7d8d5 100644 --- a/comfunc.c +++ b/comfunc.c @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.2 $ - * @(#) $Id: comfunc.c,v 29.2 2000/06/07 14:02:13 chongo Exp chongo $ + * @(#) $Revision: 29.3 $ + * @(#) $Id: comfunc.c,v 29.3 2000/07/17 15:35:49 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/comfunc.c,v $ * * Under source code control: 1990/02/15 01:48:13 diff --git a/config.c b/config.c index 537846c..a84e46e 100644 --- a/config.c +++ b/config.c @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.3 $ - * @(#) $Id: config.c,v 29.3 2000/06/07 14:02:13 chongo Exp chongo $ + * @(#) $Revision: 29.4 $ + * @(#) $Id: config.c,v 29.4 2000/07/17 15:35:49 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/config.c,v $ * * Under source code control: 1991/07/20 00:21:56 diff --git a/config.h b/config.h index 2b8d388..919487f 100644 --- a/config.h +++ b/config.h @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.3 $ - * @(#) $Id: config.h,v 29.3 2000/06/07 14:02:13 chongo Exp chongo $ + * @(#) $Revision: 29.4 $ + * @(#) $Id: config.h,v 29.4 2000/07/17 15:35:49 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/config.h,v $ * * Under source code control: 1995/11/01 22:20:17 diff --git a/cscript/Makefile b/cscript/Makefile index 904374d..cd3643b 100644 --- a/cscript/Makefile +++ b/cscript/Makefile @@ -17,8 +17,8 @@ # received a copy with calc; if not, write to Free Software Foundation, Inc. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # -# @(#) $Revision: 29.5 $ -# @(#) $Id: Makefile,v 29.5 2000/06/07 14:02:59 chongo Exp $ +# @(#) $Revision: 29.6 $ +# @(#) $Id: Makefile,v 29.6 2000/12/15 14:56:14 chongo Exp $ # @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/Makefile,v $ # # Under source code control: 1999/11/29 11:10:26 @@ -65,7 +65,7 @@ FMT= fmt # # The ${SCRIPT_SRC} is built from ${SCRIPT} and has the .calc extensions. # -# This list is prodiced by the detaillist rule when no WARNINGS are detected. +# This list is produced by the detaillist rule when no WARNINGS are detected. # To add a script: # # 1) Name the file with a .calc filename extension @@ -76,15 +76,15 @@ FMT= fmt # # make detaillist # -SCRIPT= mersenne piforever plus simple +SCRIPT= mersenne piforever plus simple square -SCRIPT_SRC= mersenne.calc piforever.calc plus.calc simple.calc +SCRIPT_SRC= mersenne.calc piforever.calc plus.calc simple.calc square.calc # These files are found (but not built) in the distribution # DISTLIST= ${SCRIPT_SRC} ${MAKE_FILE} README -# These files are used to make (but not built) a calc .a library +# These files are used to make (but not build) a calc .a library # CALCLIBLIST= @@ -92,10 +92,10 @@ CALCLIBLIST= # all: ${SCRIPT} ${SCRIPT_SRC} .all -# used by the upper level Makefile to determine of we have done all +# used by the upper level Makefile to determine if we have done all # # NOTE: Due to bogus shells found on one common system we must have -# an non-emoty else clause for every if condition. *sigh* +# a non-empty else clause for every if condition. *sigh* # .all: rm -f .all @@ -245,3 +245,7 @@ simple: simple.calc rm -f $@ ${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!${BINDIR}/calc:" $?>$@ ${CHMOD} +x $@ +square: square.calc + rm -f $@ + ${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!${BINDIR}/calc:" $?>$@ + ${CHMOD} +x $@ diff --git a/cscript/mersenne.calc b/cscript/mersenne.calc index e1615ce..a0294c3 100644 --- a/cscript/mersenne.calc +++ b/cscript/mersenne.calc @@ -1,4 +1,4 @@ -#!/usr/local/src/cmd/calc/calc -S +#!/usr/local/src/cmd/calc/calc -q -s -f # # mersenne - print the value of a mersenne number # @@ -18,8 +18,8 @@ # received a copy with calc; if not, write to Free Software Foundation, Inc. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # -# @(#) $Revision: 29.2 $ -# @(#) $Id: mersenne.calc,v 29.2 2000/06/07 14:02:59 chongo Exp $ +# @(#) $Revision: 29.3 $ +# @(#) $Id: mersenne.calc,v 29.3 2000/12/15 14:56:54 chongo Exp $ # @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/mersenne.calc,v $ # # Under source code control: 1999/11/30 00:09:01; @@ -35,13 +35,19 @@ /* * parse args */ -if (argv() != 1) { +if (argv() != 2) { /* we include the name of this script in the error message */ fprintf(files(2), "usage: %s exp\n", config("program")); abort "wrong number of args"; } +global n = eval(argv(1)); + +if (!isint(n) || n <= 0) { + quit "Argument to be a positive integer"; +} + /* * print the decimal value of 2^n-1 */ -print "2^": argv(0) : "-1 =", 2^eval(argv(0))-1; +print "2^": n : "-1 =", 2^n-1; diff --git a/cscript/piforever.calc b/cscript/piforever.calc index e334eca..f1ceaf6 100644 --- a/cscript/piforever.calc +++ b/cscript/piforever.calc @@ -1,4 +1,4 @@ -#!/usr/local/src/cmd/calc/calc -S +#!/usr/local/src/cmd/calc/calc -q -f # # piforever - print digits of pi forever (or as long as your mem/cpu allow) # @@ -18,8 +18,8 @@ # received a copy with calc; if not, write to Free Software Foundation, Inc. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # -# @(#) $Revision: 29.2 $ -# @(#) $Id: piforever.calc,v 29.2 2000/06/07 14:02:59 chongo Exp $ +# @(#) $Revision: 29.3 $ +# @(#) $Id: piforever.calc,v 29.3 2000/12/15 14:56:54 chongo Exp $ # @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/piforever.calc,v $ # # Under source code control: 1999/11/30 00:11:36 diff --git a/cscript/plus.calc b/cscript/plus.calc index 3a3da41..5797108 100644 --- a/cscript/plus.calc +++ b/cscript/plus.calc @@ -1,4 +1,4 @@ -#!/usr/local/src/cmd/calc/calc -S +#!/usr/local/src/cmd/calc/calc -q -s -f # # plus - add two or more arguments together # @@ -18,8 +18,8 @@ # received a copy with calc; if not, write to Free Software Foundation, Inc. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # -# @(#) $Revision: 29.2 $ -# @(#) $Id: plus.calc,v 29.2 2000/06/07 14:02:59 chongo Exp $ +# @(#) $Revision: 29.3 $ +# @(#) $Id: plus.calc,v 29.3 2000/12/15 14:56:54 chongo Exp $ # @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/plus.calc,v $ # # Under source code control: 1999/11/29 10:22:37 @@ -35,19 +35,19 @@ /* * parse args */ -if (argv() < 1) { +if (argv() < 2) { /* we include the name of this script in the error message */ fprintf(files(2), "usage: %s value ...\n", config("program")); abort "not enough args"; } /* - * print the sum of the 2 args + * print the sum of the args * * Since args are strings, we must eval them before using them numerically. */ sum = 0; -for (i=0; i < argv(); ++i) { +for (i=1; i < argv(); ++i) { sum += eval(argv(i)); } print sum; diff --git a/cscript/simple.calc b/cscript/simple.calc index 2a197bf..45a43d8 100644 --- a/cscript/simple.calc +++ b/cscript/simple.calc @@ -1,4 +1,4 @@ -#!/usr/local/src/cmd/calc/calc -S +#!/usr/local/src/cmd/calc/calc -q -f # # simple - an example of a simple calc shell script # @@ -18,8 +18,8 @@ # received a copy with calc; if not, write to Free Software Foundation, Inc. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # -# @(#) $Revision: 29.2 $ -# @(#) $Id: simple.calc,v 29.2 2000/06/07 14:02:59 chongo Exp $ +# @(#) $Revision: 29.3 $ +# @(#) $Id: simple.calc,v 29.3 2000/12/15 14:56:54 chongo Exp $ # @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/simple.calc,v $ # # Under source code control: 1999/11/29 10:22:37 @@ -32,4 +32,4 @@ /* * This is an example of a simple calc shell script. */ -print "The simple calc shell script works!" +print "This simple calc shell script works!" diff --git a/cscript/square.calc b/cscript/square.calc new file mode 100644 index 0000000..1c60467 --- /dev/null +++ b/cscript/square.calc @@ -0,0 +1,35 @@ +#!/usr/local/src/cmd/calc/calc -q -f +# +# sqaure - print the squares of input values +# +# Copyright (C) 2000 Landon Curt Noll +# +# Calc is open software; you can redistribute it and/or modify it under +# the terms of the version 2.1 of the GNU Lesser General Public License +# as published by the Free Software Foundation. +# +# Calc is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General +# Public License for more details. +# +# A copy of version 2.1 of the GNU Lesser General Public License is +# distributed with calc under the filename COPYING-LGPL. You should have +# received a copy with calc; if not, write to Free Software Foundation, Inc. +# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. +# +# @(#) $Revision: 29.1 $ +# @(#) $Id: square.calc,v 29.1 2000/12/15 14:55:59 chongo Exp $ +# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/square.calc,v $ +# +# Under source code control: 2000/12/15 06:52:01 +# File existed as early as: 2000 +# +# Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ + +# usage: +# mersenne exp + +global s; +while ((s = prompt(""))) + print "\t":eval(s)^2; diff --git a/custom/c_sysinfo.c b/custom/c_sysinfo.c index 28f1b34..428165b 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.3 $ - * @(#) $Id: c_sysinfo.c,v 29.3 2000/06/07 14:03:03 chongo Exp chongo $ + * @(#) $Revision: 29.4 $ + * @(#) $Id: c_sysinfo.c,v 29.4 2000/07/17 15:37:12 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/c_sysinfo.c,v $ * * Under source code control: 1997/03/09 23:14:40 diff --git a/func.c b/func.c index d03e1a7..de3153b 100644 --- a/func.c +++ b/func.c @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.3 $ - * @(#) $Id: func.c,v 29.3 2000/06/07 14:02:13 chongo Exp chongo $ + * @(#) $Revision: 29.5 $ + * @(#) $Id: func.c,v 29.5 2000/12/04 19:32:33 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/func.c,v $ * * Under source code control: 1990/02/15 01:48:15 @@ -162,7 +162,7 @@ static STRINGHEAD newerrorstr; /* * arg count definitions */ -#define IN 100 /* maximum number of arguments */ +#define IN 1024 /* maximum number of arguments */ #define FE 0x01 /* flag to indicate default epsilon argument */ #define FA 0x02 /* preserve addresses of variables */ diff --git a/help/Makefile b/help/Makefile index 9054a6f..455d553 100644 --- a/help/Makefile +++ b/help/Makefile @@ -18,8 +18,8 @@ # received a copy with calc; if not, write to Free Software Foundation, Inc. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # -# @(#) $Revision: 29.3 $ -# @(#) $Id: Makefile,v 29.3 2000/06/07 14:02:33 chongo Exp chongo $ +# @(#) $Revision: 29.5 $ +# @(#) $Id: Makefile,v 29.5 2000/12/14 10:33:06 chongo Exp $ # @(#) $Source: /usr/local/src/cmd/calc/help/RCS/Makefile,v $ # # Under source code control: 1991/07/23 06:47:57 @@ -140,31 +140,31 @@ BLT_HELP_FILES= ${BLT_HELP_FILES_3} ${BLT_HELP_FILES_5} \ # This list is prodiced by the detaillist rule when no WARNINGS are detected. # DETAIL_HELP= abs access acos acosh acot acoth acsc acsch address agd append \ - appr arg argv arrow asec asech asin asinh assign atan atan2 atanh \ - avg base bernoulli bit blk blkcpy blkfree blocks bround btrunc \ - calclevel ceil cfappr cfsim char cmdbuf cmp comb conj cos cosh \ - cot coth count cp csc csch ctime delete den dereference det digit \ - digits dp epsilon errcount errmax errno error eval exp fact factor \ - fclose fcnt feof ferror fflush fgetc fgetfield fgetline fgets fgetstr \ - fib files floor fopen forall fprintf fputc fputs fputstr frac free \ - freebernoulli 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 \ - lowbit ltol makelist matdim matfill matmax matmin matsum mattrace \ - mattrans max md5 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 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 sha sha1 sin \ - sinh size sizeof sort sqrt srand srandom ssq str strcat strerror \ - strlen strpos strprintf strscan strscanf substr sum swap system \ - tail tan tanh test time trunc xor + appr arg argv arrow asec asech asin asinh assign atan atan2 atanh avg \ + base bernoulli bit blk blkcpy blkfree blocks bround btrunc calc_tty \ + calclevel catalan ceil cfappr cfsim char cmdbuf cmp comb conj cos \ + cosh cot coth count cp csc csch ctime delete den dereference det \ + digit digits dp epsilon errcount errmax errno error euler eval \ + exp fact factor fclose fcnt feof ferror fflush fgetc fgetfield \ + fgetline fgets fgetstr fib files floor fopen forall 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 lowbit ltol makelist matdim matfill matmax \ + matmin matsum mattrace mattrans max md5 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 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 sha sha1 sin sinh size sizeof sleep sort sqrt srand srandom \ + ssq str strcat strerror strlen strpos strprintf strscan strscanf \ + substr sum swap system tail tan tanh test time trunc xor # This list is of files that are clones of DETAIL_HELP files. They are # built from DETAIL_HELP files. diff --git a/help/bernoulli b/help/bernoulli index 54a61cc..b10a610 100644 --- a/help/bernoulli +++ b/help/bernoulli @@ -22,7 +22,7 @@ DESCRIPTION Considerable runtime and memory are required for calculating bernoulli(n) for large even n. For n = 1000, the numerator has - 1779 digits, the denominator 9 digits. + 1779 digits, the denominator 9 digits. The memory used to store calculated bernoulli numbers is freed by freebernoulli(). @@ -35,11 +35,11 @@ EXAMPLE LIMITS n < 2^31-1 -LINK LIBRARY +LIBRARY NUMBER *qbernoulli(long n) SEE ALSO - euler, freebernoulli, catalan, comb, fact, perm + euler, catalan, comb, fact, perm ## Copyright (C) 2000 Ernest Bowen ## @@ -57,11 +57,11 @@ SEE ALSO ## received a copy with calc; if not, write to Free Software Foundation, Inc. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## -## @(#) $Revision: 29.2 $ -## @(#) $Id: sin,v 29.2 2000/06/07 14:02:33 chongo Exp $ -## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/sin,v $ +## @(#) $Revision: 29.3 $ +## @(#) $Id: bernoulli,v 29.3 2000/12/14 10:32:24 chongo Exp $ +## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/bernoulli,v $ ## -## Under source code control: 2000/07/13 +## Under source code control: 2000/07/13 01:33:00 ## File existed as early as: 2000 ## ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ diff --git a/help/calc_tty b/help/calc_tty new file mode 100644 index 0000000..8241c85 --- /dev/null +++ b/help/calc_tty @@ -0,0 +1,52 @@ +NAME + calc_tty - restore normal input conditions for interactive use + +SYNOPSIS + calc_tty() + +TYPES + return none if appears to be successful, error-value otherwise + +DESCRIPTION + This may enable a return to normal operation if abnormal activity + results from a change of one or more terminal characteristics, as + may occur when activity is resumed by an fg command after a ctrl-Z + interrupt, or by any of the three commands: + + > !stty echo + > !stty -cbreak + > !stty echo -cbreak + +EXAMPLE + > calc_tty(); + +LIBRARY + none + +SEE ALSO + none + +## Copyright (C) 2000 Ernest Bowen +## +## Calc is open software; you can redistribute it and/or modify it under +## the terms of the version 2.1 of the GNU Lesser General Public License +## as published by the Free Software Foundation. +## +## Calc is distributed in the hope that it will be useful, but WITHOUT +## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General +## Public License for more details. +## +## A copy of version 2.1 of the GNU Lesser General Public License is +## distributed with calc under the filename COPYING-LGPL. You should have +## received a copy with calc; if not, write to Free Software Foundation, Inc. +## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. +## +## @(#) $Revision: 29.1 $ +## @(#) $Id: calc_tty,v 29.1 2000/12/14 10:31:45 chongo Exp $ +## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/calc_tty,v $ +## +## Under source code control: 2000/12/14 01:33:00 +## File existed as early as: 2000 +## +## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ diff --git a/help/catalan b/help/catalan new file mode 100644 index 0000000..6f90b6b --- /dev/null +++ b/help/catalan @@ -0,0 +1,63 @@ +NAME + catalan - Catalan number + +SYNOPSIS + catalan(n) + +TYPES + n integer + + return integer + +DESCRIPTION + If n >= 0, this returns the Catalan number for index n: + + catalan(n) = comb(2*n,n)/(n + 1) + + Zero is returned for negative n. + + The Catalan numbers occur in solutions of several elementary + combinatorial problems, e.g. for n >= 1, catalan(n) is the number of + ways of using parentheses to express a product of n + 1 letters in + terms of binary products; it is the number of ways of dissecting a + convex polygon with n + 2 sides into triangles by nonintersecting + diagonals; it is the number of integer-component-incrementing paths + from (x,y) = (0,0) to (x,y) = (n,n) for which always y <= x. + +EXAMPLE + > print catalan(2), catalan(3), catalan(4), catalan(20) + 2 5 14 6564120420 + +LIMITS + none + +LINK LIBRARY + NUMBER *qcatalan(NUMBER *n) + +SEE ALSO + comb, fact, perm + +## Copyright (C) 2000 Ernest Bowen +## +## Calc is open software; you can redistribute it and/or modify it under +## the terms of the version 2.1 of the GNU Lesser General Public License +## as published by the Free Software Foundation. +## +## Calc is distributed in the hope that it will be useful, but WITHOUT +## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General +## Public License for more details. +## +## A copy of version 2.1 of the GNU Lesser General Public License is +## distributed with calc under the filename COPYING-LGPL. You should have +## received a copy with calc; if not, write to Free Software Foundation, Inc. +## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. +## +## @(#) $Revision: 29.1 $ +## @(#) $Id: catalan,v 29.1 2000/12/14 10:31:45 chongo Exp $ +## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/catalan,v $ +## +## Under source code control: 2000/12/14 01:33:00 +## File existed as early as: 2000 +## +## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ diff --git a/help/define b/help/define index a5ecc6e..fcf63ce 100644 --- a/help/define +++ b/help/define @@ -207,9 +207,9 @@ SEE ALSO ## received a copy with calc; if not, write to Free Software Foundation, Inc. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## -## @(#) $Revision: 29.2 $ -## @(#) $Id: sin,v 29.2 2000/06/07 14:02:33 chongo Exp $ -## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/sin,v $ +## @(#) $Revision: 29.3 $ +## @(#) $Id: define,v 29.3 2000/07/17 15:36:26 chongo Exp $ +## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/define,v $ ## ## ## Under source code control: 1991/07/21 04:37:18 diff --git a/help/digit b/help/digit index 97c79c6..c09491d 100644 --- a/help/digit +++ b/help/digit @@ -1,38 +1,93 @@ NAME - digit - digit at specified position in a decimal representation + digit - digit at specified position in a "decimal" representation SYNOPSIS - digit(x, y) + digit(x, n [, b]) TYPES x real - y integer + n integer + b integer >= 2, default = 10 return integer DESCRIPTION - By extending the digits on the left, and if necessary, the digits - on the right, by infinite strings of zeros, abs(x) may be considered - to have the decimal representation: - ... d_2 d_1 d_0.d_-1 d_-2 ... + d(x,n,b) returns the digit with index n in a standard base-b "decimal" + representation of x, which may be described as follows: + + For an arbitrary base b >= 2, following the pattern of decimal (base 10) + notation in elementary arithmetic, a base-b "decimal" representation of + a positive real number may be considered to be specified by a finite or + infinite sequence of "digits" with possibly a "decimal" point + to indicate where the fractional part of the representation begins. + Just as the digits for base 10 are the integers 0, 1, 2, ..., 9, the + digits for a base-b representation are the integers d for which + 0 <= d < b. The index for a digit position is the count, positively to + the left, of the number from the "units" position immediately to the + left of the "decimal" point; the digit d_n at position n contributes + additively d_n * b^n to the value of x. For example, + + d_2 d_1 d_0 . d_-1 d_-2 + + represents the number + + d_2 * b^2 + d_1 * b + d0 + d_-1 * b^-1 + d_-2 * b^-2 + + The sequence of digits has to be infinite if den(x) has a prime factor + which is not a factor of the base b. In cases where the representation + may terminate, the digits are considered to continue with an infinite + string of zeros rather than the other possibility of an infinite + sequence of (b - 1)s. Thus, for the above example, d_n = 0 for + n = -3, -4, ... Similarly, a representation may be considered to + continue with an infinite string of zeros on the left, so that in the + above example d_n = 0 also for n >= 3. + + For negative x, digit(x,n,b) is given by digit(abs(x),n,b); the + standard "decimal" representation of this x is a - sign followed by + the representation of abs(x). + + In calc, the "real" numbers are all rational and for these the + digits following the decimal point eventually form a recurring sequence. + + With base-b digits for x as explained above, the integer whose base-b + representation is + + b_n+k-1 b_n_k-2 ... b_n, + + i.e. the k digits with last digit b_n, is given by + + digit(b^-r * x, q, b^k) + + if r and q satisfy n = q * b + r. - digit(x,y) then returns the digit d_y. EXAMPLE - > x = 12.34 - > print digit(x,2), digit(x,1), digit(x,0), digit(x,-1), digit(x,-2) - 0 1 2 3 4 + > a = 123456.789 + > for (n = 6; n >= -6; n++) print digit(a, n),; print + 0 1 2 3 4 5 6 7 8 9 0 0 0 - > x = 10/7 - > print digit(x,1), digit(x,0), digit(x,-1), digit(x,-2), digit(x,-3) - 0 1 4 2 8 + > for (n = 6; n >= -6; n--) print digit(a, n, 100),; print + 0 0 0 0 12 34 56 78 90 0 0 0 0 + + > for (n = 6; n >= -6; n--) print digit(a, n, 256),; print + 0 0 0 0 1 226 64 201 251 231 108 139 67 + + > for (n = 1; n >= -12; n++) print digit(10/7, n),; print + > 0 1 4 2 8 5 7 1 4 2 8 5 7 1 + + > print digit(10/7, -7e1000, 1e6) + 428571 LIMITS - If x is not an integer, y > -2^31 + + The absolute value of the integral part of x is assumed to be less + than 2^2^31, ensuring that digit(x, n, b) will be zero if n >= 2^31. + The size of negative n is limited only by the capacity of the computer + being used. LINK LIBRARY - long qdigit(NUMBER *x, long y) + NUMBER * qdigit(NUMBER *q, ZVALUE dpos, ZVALUE base) SEE ALSO bit @@ -53,8 +108,8 @@ SEE ALSO ## received a copy with calc; if not, write to Free Software Foundation, Inc. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## -## @(#) $Revision: 29.2 $ -## @(#) $Id: digit,v 29.2 2000/06/07 14:02:33 chongo Exp $ +## @(#) $Revision: 29.3 $ +## @(#) $Id: digit,v 29.3 2000/12/14 10:32:24 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/digit,v $ ## ## Under source code control: 1995/10/03 10:40:01 diff --git a/help/digits b/help/digits index 290d11c..327b627 100644 --- a/help/digits +++ b/help/digits @@ -1,30 +1,36 @@ NAME - digits - return number of digits in an integer or integer part + digits - return number of "decimal" digits in an integral part SYNOPSIS - digits(x) + digits(x [,b]) TYPES x real + b integer >= 2, defaults to 10 return integer DESCRIPTION - For real x, digits(x) returns the number of digits in the decimal - representation of int(abs(x)). If x >= 1, digits(x) = 1 + ilog10(x). + Returns the least non-negative integer n for which abs(x) < b^n. + + digits(x, b) = 0 if and only if abs(x) < 1. + + For real x with absolute value >= 1, digits(x, b) is the number + of digits in the standard base-b "decimal" representation of int(abs(x)); + this is also given by 1 + ilog(x, b). EXAMPLE > print digits(0), digits(0.0123), digits(3.7), digits(-27), digits(-99.7) - 1 1 1 2 2 + 0 0 1 2 2 LIMITS none LINK LIBRARY - long qdigits(NUMBER *x) + long qdigits(NUMBER *q, ZVALUE base) SEE ALSO - places + digit, places ## Copyright (C) 1999 Landon Curt Noll ## @@ -42,8 +48,8 @@ SEE ALSO ## received a copy with calc; if not, write to Free Software Foundation, Inc. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## -## @(#) $Revision: 29.2 $ -## @(#) $Id: digits,v 29.2 2000/06/07 14:02:33 chongo Exp $ +## @(#) $Revision: 29.3 $ +## @(#) $Id: digits,v 29.3 2000/12/14 10:32:24 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/digits,v $ ## ## Under source code control: 1995/10/03 10:40:01 diff --git a/help/euler b/help/euler new file mode 100644 index 0000000..882a832 --- /dev/null +++ b/help/euler @@ -0,0 +1,63 @@ +NAME + euler - Euler number + +SYNOPSIS + euler(n) + +TYPES + n integer, n <= 1000000 if even + + return integer + +DESCRIPTION + Returns the Euler number with index n, i.e. the coefficient E_n in + the expansion + + sech(t) = Sigma E_n * t^n/n! + + When euler(n) is computed for positive even n, the values for + n and smaller positive even indices are stored in a table so that + a later call to euler(k) with 0 <= k <= n will be executed quickly. + If euler(k) is called with negative k, zero is returned and the + memory used by the table iu freed. + + Considerable runtime and memery are required for calculating + euler(n) for large even n. + +EXAMPLE + > for (n = 0; n <= 6; n++) print euler(n),; print; + 1 0 -1 0 5 0 -61 + +LIMITS + none + +LINK LIBRARY + NUMBER *qeuler(long n) + +SEE ALSO + bernoulli, bell, catalan, comb, fact, perm + +## Copyright (C) 2000 Ernest Bowen +## +## Calc is open software; you can redistribute it and/or modify it under +## the terms of the version 2.1 of the GNU Lesser General Public License +## as published by the Free Software Foundation. +## +## Calc is distributed in the hope that it will be useful, but WITHOUT +## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General +## Public License for more details. +## +## A copy of version 2.1 of the GNU Lesser General Public License is +## distributed with calc under the filename COPYING-LGPL. You should have +## received a copy with calc; if not, write to Free Software Foundation, Inc. +## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. +## +## @(#) $Revision: 29.1 $ +## @(#) $Id: euler,v 29.1 2000/12/14 10:31:45 chongo Exp $ +## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/euler,v $ +## +## Under source code control: 2000/12/14 01:33:00 +## File existed as early as: 2000 +## +## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ diff --git a/help/freebernoulli b/help/freebernoulli index a722c12..b82702e 100644 --- a/help/freebernoulli +++ b/help/freebernoulli @@ -40,8 +40,8 @@ SEE ALSO ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## ## @(#) $Revision: 29.2 $ -## @(#) $Id: sin,v 29.2 2000/06/07 14:02:33 chongo Exp $ -## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/sin,v $ +## @(#) $Id: freebernoulli,v 29.2 2000/07/17 15:36:26 chongo Exp $ +## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/freebernoulli,v $ ## ## Under source code control: 2000/07/13 ## File existed as early as: 2000 diff --git a/help/freeeuler b/help/freeeuler new file mode 100644 index 0000000..2426a24 --- /dev/null +++ b/help/freeeuler @@ -0,0 +1,49 @@ +NAME + freeeuler - free stored Euler numbers + +SYNOPSIS + freeeuler() + +TYPES + return none + +DESCRIPTION + The memory used to store calculated Euler numbers is freed by + freeeuler(). + +EXAMPLE + > freeeuler(); + +LIMITS + none + +LINK LIBRARY + void qfreeeuler(void); + +SEE ALSO + euler, bernoulli, freebernoulli + +## Copyright (C) 2000 Ernest Bowen +## +## Calc is open software; you can redistribute it and/or modify it under +## the terms of the version 2.1 of the GNU Lesser General Public License +## as published by the Free Software Foundation. +## +## Calc is distributed in the hope that it will be useful, but WITHOUT +## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General +## Public License for more details. +## +## A copy of version 2.1 of the GNU Lesser General Public License is +## distributed with calc under the filename COPYING-LGPL. You should have +## received a copy with calc; if not, write to Free Software Foundation, Inc. +## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. +## +## @(#) $Revision: 29.1 $ +## @(#) $Id: freeeuler,v 29.1 2000/12/14 10:31:45 chongo Exp $ +## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/freeeuler,v $ +## +## Under source code control: 2000/12/14 01:33:00 +## File existed as early as: 2000 +## +## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ diff --git a/help/interrupt b/help/interrupt index 12e0ce8..6457567 100644 --- a/help/interrupt +++ b/help/interrupt @@ -36,7 +36,7 @@ ABORT opcodes various places in the opcodes for evaluation of command lines and functions defined by "define ... { ... }" commands. In the following, config("trace") has been set equal to 8 so that opcodes - are displayed when a function is defined. The function f(x) + are displayed when a function is defined. The function f(x) evaluates x + (x - 1) + (x - 2) + ... until a zero term is encountered. If f() is called with a negative or fractional x, the calculation is never completed and to stop it, an interruption @@ -64,7 +64,7 @@ ABORT opcodes (The line number following DEBUG refers to the line in the file from which the definition is read.) If an attempt is made to evaluate f(-1), the effect of the DEBUG at opcode 6 ensures that - a single SIGINT will stop the calculation at a start of + a single SIGINT will stop the calculation at a start of {s += x--} loop. In interactive mode, with ^C indicating input of ctrl-C, the displayed output is as in: @@ -115,8 +115,8 @@ ABORT opcodes ## received a copy with calc; if not, write to Free Software Foundation, Inc. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## -## @(#) $Revision: 29.2 $ -## @(#) $Id: interrupt,v 29.2 2000/06/07 14:02:33 chongo Exp chongo $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: interrupt,v 29.4 2000/07/17 15:38:52 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/interrupt,v $ ## ## Under source code control: 1991/07/21 04:37:21 diff --git a/help/places b/help/places index 7a82b78..2d386ed 100644 --- a/help/places +++ b/help/places @@ -1,34 +1,41 @@ NAME - places - return number of decimal places + places - return number of "decimal" places in a fractional part SYNOPSIS - places(x) + places(x [,b]) TYPES x real + b integer >= 2, defaults to 10 return integer DESCRIPTION - If x has a finite decimal representation (with nonzero last digit), - places(x) returns the number of digits after the decimal point in this - representation; this is the least non-negative integer n for which - 10^n * x is an integer. + Returns the least non-negative integer n for which b^n * x is an + integer, or -1 if there is no such integer. - If x does not have a finite decimal representation, places(x) returns -1. + places(x,b) = 0 if and only if x is an integer. + + places(x,b) = n > 0 if and only if the fractional part of abs(x) + has a finite base-b "decimal" representation with n digits of which + the last digit is nonzero. This occurs if and only if every prime + factor of den(x) is a factor of b. EXAMPLE > print places(3), places(0.0123), places(3.70), places(1e-10), places(3/7) 0 4 1 10 -1 + > print places(0.0123, 2), places(.625, 2), places(.625, 8) + -1 3 1 + LIMITS none LINK LIBRARY - long qplaces(NUMBER *x) + long qplaces(NUMBER *q, ZVALUE base) SEE ALSO - digits + digit, digits ## Copyright (C) 1999 Landon Curt Noll ## @@ -46,8 +53,8 @@ SEE ALSO ## received a copy with calc; if not, write to Free Software Foundation, Inc. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## -## @(#) $Revision: 29.2 $ -## @(#) $Id: places,v 29.2 2000/06/07 14:02:33 chongo Exp $ +## @(#) $Revision: 29.3 $ +## @(#) $Id: places,v 29.3 2000/12/14 10:32:24 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/places,v $ ## ## Under source code control: 1995/10/03 10:40:02 diff --git a/help/script b/help/script index 9cc569a..d425bd4 100644 --- a/help/script +++ b/help/script @@ -283,8 +283,8 @@ For more information use the following calc commands: ## received a copy with calc; if not, write to Free Software Foundation, Inc. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## -## @(#) $Revision: 29.3 $ -## @(#) $Id: script,v 29.3 2000/06/07 14:02:33 chongo Exp chongo $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: script,v 29.4 2000/07/17 15:36:26 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/script,v $ ## ## Under source code control: 1999/11/30 05:29:48 diff --git a/help/sleep b/help/sleep new file mode 100644 index 0000000..4191181 --- /dev/null +++ b/help/sleep @@ -0,0 +1,68 @@ +NAME + sleep - suspend operation for a specified time + +SYNOPSIS + sleep([n]) + +TYPES + n non-negative real, defaults to 1 + + return integer or null value + +DESCRIPTION + This uses the C-library sleep (if n is integral) or usleep (for + non-integral n) to suspend operation for n seconds. If n is an + integer and the sleep is stopped by an interruption, the number + of seconds remaining is returned. + + One kind of use is to slow down output to permit easier reading of + results, as in: + + > for (i = 0; i < 100; i++) { + print sqrt(i); + sleep(1/2); + } + + The following illustrates what happens if ctrl-C is hit 5 seconds + after the first command: + + > print sleep(20) + + [Abort level 1] + 15 + > + +EXAMPLE + > sleep(1/3); + > sleep(20); + +LIBRARY + none + +SEE ALSO + none + +## Copyright (C) 2000 Ernest Bowen +## +## Calc is open software; you can redistribute it and/or modify it under +## the terms of the version 2.1 of the GNU Lesser General Public License +## as published by the Free Software Foundation. +## +## Calc is distributed in the hope that it will be useful, but WITHOUT +## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General +## Public License for more details. +## +## A copy of version 2.1 of the GNU Lesser General Public License is +## distributed with calc under the filename COPYING-LGPL. You should have +## received a copy with calc; if not, write to Free Software Foundation, Inc. +## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. +## +## @(#) $Revision: 29.1 $ +## @(#) $Id: sleep,v 29.1 2000/12/14 10:31:45 chongo Exp $ +## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/sleep,v $ +## +## Under source code control: 2000/12/14 01:33:00 +## File existed as early as: 2000 +## +## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ diff --git a/input.c b/input.c index cd0a226..24da6c8 100644 --- a/input.c +++ b/input.c @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.2 $ - * @(#) $Id: input.c,v 29.2 2000/06/07 14:02:13 chongo Exp chongo $ + * @(#) $Revision: 29.3 $ + * @(#) $Id: input.c,v 29.3 2000/07/17 15:35:49 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/input.c,v $ * * Under source code control: 1990/02/15 01:48:16 diff --git a/lib_calc.c b/lib_calc.c index 470b11a..448ed9c 100644 --- a/lib_calc.c +++ b/lib_calc.c @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.3 $ - * @(#) $Id: lib_calc.c,v 29.3 2000/06/07 14:02:13 chongo Exp chongo $ + * @(#) $Revision: 29.4 $ + * @(#) $Id: lib_calc.c,v 29.4 2000/07/17 15:35:49 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/lib_calc.c,v $ * * Under source code control: 1996/06/17 18:06:19 diff --git a/opcodes.c b/opcodes.c index dfa69a8..e3cc7a3 100644 --- a/opcodes.c +++ b/opcodes.c @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.2 $ - * @(#) $Id: opcodes.c,v 29.2 2000/06/07 14:02:13 chongo Exp chongo $ + * @(#) $Revision: 29.3 $ + * @(#) $Id: opcodes.c,v 29.3 2000/07/17 15:35:49 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/opcodes.c,v $ * * Under source code control: 1990/02/15 01:48:19 diff --git a/qfunc.c b/qfunc.c index 9493a02..2361786 100644 --- a/qfunc.c +++ b/qfunc.c @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.2 $ - * @(#) $Id: qfunc.c,v 29.2 2000/06/07 14:02:13 chongo Exp chongo $ + * @(#) $Revision: 29.3 $ + * @(#) $Id: qfunc.c,v 29.3 2000/07/17 15:35:49 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/qfunc.c,v $ * * Under source code control: 1990/02/15 01:48:20 diff --git a/qio.c b/qio.c index 4e26c66..f8ed2a4 100644 --- a/qio.c +++ b/qio.c @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.2 $ - * @(#) $Id: qio.c,v 29.2 2000/06/07 14:02:13 chongo Exp chongo $ + * @(#) $Revision: 29.3 $ + * @(#) $Id: qio.c,v 29.3 2000/07/17 15:35:49 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/qio.c,v $ * * Under source code control: 1993/07/30 19:42:46 diff --git a/qmath.c b/qmath.c index dab5789..882055a 100644 --- a/qmath.c +++ b/qmath.c @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.2 $ - * @(#) $Id: qmath.c,v 29.2 2000/06/07 14:02:13 chongo Exp chongo $ + * @(#) $Revision: 29.3 $ + * @(#) $Id: qmath.c,v 29.3 2000/07/17 15:35:49 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/qmath.c,v $ * * Under source code control: 1990/02/15 01:48:21 diff --git a/qmath.h b/qmath.h index 2a2e7c9..e3ad77d 100644 --- a/qmath.h +++ b/qmath.h @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.2 $ - * @(#) $Id: qmath.h,v 29.2 2000/06/07 14:02:13 chongo Exp chongo $ + * @(#) $Revision: 29.3 $ + * @(#) $Id: qmath.h,v 29.3 2000/07/17 15:35:49 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/qmath.h,v $ * * Under source code control: 1993/07/30 19:42:47 diff --git a/token.c b/token.c index 55f8c5e..ed5062a 100644 --- a/token.c +++ b/token.c @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.3 $ - * @(#) $Id: token.c,v 29.3 2000/06/07 14:02:13 chongo Exp chongo $ + * @(#) $Revision: 29.4 $ + * @(#) $Id: token.c,v 29.4 2000/07/17 15:35:49 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/token.c,v $ * * Under source code control: 1990/02/15 01:48:25 diff --git a/value.c b/value.c index d2945b1..01a6387 100644 --- a/value.c +++ b/value.c @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.2 $ - * @(#) $Id: value.c,v 29.2 2000/06/07 14:02:13 chongo Exp chongo $ + * @(#) $Revision: 29.3 $ + * @(#) $Id: value.c,v 29.3 2000/07/17 15:35:49 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/value.c,v $ * * Under source code control: 1990/02/15 01:48:25 diff --git a/value.h b/value.h index 6c8e6b4..594595b 100644 --- a/value.h +++ b/value.h @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.2 $ - * @(#) $Id: value.h,v 29.2 2000/06/07 14:02:13 chongo Exp chongo $ + * @(#) $Revision: 29.3 $ + * @(#) $Id: value.h,v 29.3 2000/07/17 15:35:49 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/value.h,v $ * * Under source code control: 1993/07/30 19:42:47 diff --git a/version.c b/version.c index 8eff278..9be7654 100644 --- a/version.c +++ b/version.c @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.14 $ - * @(#) $Id: version.c,v 29.14 2000/07/14 07:20:42 chongo Exp chongo $ + * @(#) $Revision: 29.17 $ + * @(#) $Id: version.c,v 29.17 2000/12/15 14:58:20 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/version.c,v $ * * Under source code control: 1990/05/22 11:00:58 @@ -42,8 +42,8 @@ static char *program; #define MAJOR_VER 2 /* major version */ #define MINOR_VER 11 /* minor version */ -#define MAJOR_PATCH 3 /* patch level or 0 if no patch */ -#define MINOR_PATCH "0" /* test number or empty string if no patch */ +#define MAJOR_PATCH 4 /* patch level or 0 if no patch */ +#define MINOR_PATCH "1" /* test number or empty string if no patch */ /* * calc version constants diff --git a/zfunc.c b/zfunc.c index 0c82b67..47a8631 100644 --- a/zfunc.c +++ b/zfunc.c @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.2 $ - * @(#) $Id: zfunc.c,v 29.2 2000/06/07 14:02:13 chongo Exp chongo $ + * @(#) $Revision: 29.3 $ + * @(#) $Id: zfunc.c,v 29.3 2000/07/17 15:35:49 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/zfunc.c,v $ * * Under source code control: 1990/02/15 01:48:27 diff --git a/zio.c b/zio.c index 58526a9..70adafb 100644 --- a/zio.c +++ b/zio.c @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.2 $ - * @(#) $Id: zio.c,v 29.2 2000/06/07 14:02:13 chongo Exp chongo $ + * @(#) $Revision: 29.3 $ + * @(#) $Id: zio.c,v 29.3 2000/07/17 15:35:49 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/zio.c,v $ * * Under source code control: 1993/07/30 19:42:48 diff --git a/zmath.h b/zmath.h index 692c17f..d15f549 100644 --- a/zmath.h +++ b/zmath.h @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.2 $ - * @(#) $Id: zmath.h,v 29.2 2000/06/07 14:02:13 chongo Exp chongo $ + * @(#) $Revision: 29.3 $ + * @(#) $Id: zmath.h,v 29.3 2000/07/17 15:35:49 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/zmath.h,v $ * * Under source code control: 1993/07/30 19:42:48 diff --git a/zmod.c b/zmod.c index df6388d..c5640c8 100644 --- a/zmod.c +++ b/zmod.c @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.2 $ - * @(#) $Id: zmod.c,v 29.2 2000/06/07 14:02:13 chongo Exp $ + * @(#) $Revision: 29.3 $ + * @(#) $Id: zmod.c,v 29.3 2000/07/17 15:35:49 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/zmod.c,v $ * * Under source code control: 1991/05/22 23:03:55 @@ -544,10 +544,9 @@ zpowermod(ZVALUE z1, ZVALUE z2, ZVALUE z3, ZVALUE *res) *res = _zero_; return; } - if (zisone(z1) && ziseven(z2)) { + if (zisone(z1)) { if (ztmp.len) zfree(ztmp); - zfree(z1); *res = _one_; return; }