Release calc version 2.11.4t2

This commit is contained in:
Landon Curt Noll
2000-12-17 05:12:29 -08:00
parent 296aa50ac7
commit 3d55811205
59 changed files with 5084 additions and 1727 deletions

View File

@@ -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
#

View File

@@ -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:
@@ -116,6 +116,10 @@ bernoulli.cal
Calculate the nth Bernoulli number.
NOTE: There is now a bernoulli() builtin function. This file is
left here for backward compatibility and now simply returns
the buildin function.
bigprime.cal
@@ -274,7 +278,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 +292,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
<klaus@seistrup.dk>) 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 +360,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 +390,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 +493,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 +518,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 +541,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 +629,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 +681,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 +738,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 +756,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.4 $
## @(#) $Id: README,v 29.4 2000/12/17 12:26:04 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/README,v $
##
## Under source code control: 1990/02/15 01:50:32

View File

@@ -1,7 +1,7 @@
/*
* bernoulli - clculate the Nth Bernoulli number B(n)
*
* Copyright (C) 1999 David I. Bell
* Copyright (C) 2000 David I. Bell and Landon Curt Noll
*
* Calc is open software; you can redistribute it and/or modify it under
* the terms of the version 2.1 of the GNU Lesser General Public License
@@ -17,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: bernoulli.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $
* @(#) $Revision: 29.3 $
* @(#) $Id: bernoulli.cal,v 29.3 2000/12/17 12:26:04 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/bernoulli.cal,v $
*
* Under source code control: 1991/09/30 11:18:41
@@ -29,12 +29,16 @@
/*
* Calculate the Nth Bernoulli number B(n).
* This uses the following symbolic formula to calculate B(n):
*
* NOTE: This is now a bulitin function.
*
* The non-buildin code used the following symbolic formula to calculate B(n):
*
* (b+1)^(n+1) - b^(n+1) = 0
*
* where b is a dummy value, and each power b^i gets replaced by B(i).
* For example, for n = 3:
*
* (b+1)^4 - b^4 = 0
* b^4 + 4*b^3 + 6*b^2 + 4*b + 1 - b^4 = 0
* 4*b^3 + 6*b^2 + 4*b + 1 = 0
@@ -48,11 +52,14 @@
*/
/*
static Bnmax;
static mat Bn[1001];
*/
define B(n)
{
/*
local nn, np1, i, sum, mulval, divval, combval;
if (!isint(n) || (n < 0))
@@ -85,4 +92,6 @@ define B(n)
}
Bnmax = n;
return Bn[n];
*/
return bernoulli(n);
}

View File

@@ -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 $
* @(#) $Revision: 29.6 $
* @(#) $Id: regress.cal,v 29.6 2000/12/17 12:26:42 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/regress.cal,v $
*
* Under source code control: 1990/02/15 01:50:36
@@ -755,7 +755,7 @@ define test_functions()
vrfy(den(17) == 1, '712: den(17) == 1');
vrfy(den(3/7) == 7, '713: den(3/7) == 7');
vrfy(den(-2/3) == 3, '714: den(-2/3) == 3');
vrfy(digits(0) == 1, '715: digits(0) == 1');
vrfy(digits(0) == 0, '715: digits(0) == 0');
vrfy(digits(9) == 1, '716: digits(9) == 1');
vrfy(digits(10) == 2, '717: digits(10) == 2');
vrfy(digits(-691) == 3, '718: digits(-691) == 3');
@@ -1029,8 +1029,8 @@ define test_functions()
vrfy(digit(a,-1) == 4, '974: digit(a,-1) == 4');
vrfy(digit(a,-2) == 2, '975: digit(a,-2) == 2');
vrfy(digit(a,-3) == 8, '976: digit(a,-3) == 8');
vrfy(digits(0) == 1, '977: digits(0) == 1');
vrfy(digits(0.0123) == 1, '978: digits(0.0123) == 1');
vrfy(digits(0) == 0, '977: digits(0) == 0');
vrfy(digits(0.0123) == 0, '978: digits(0.0123) == 0');
vrfy(digits(3.7) == 1, '979: digits(3.7) == 1');
vrfy(digits(-27) == 2, '980: digits(-27) == 2');
vrfy(digits(-99.7) == 2, '981: digits(-99.7) == 2');
@@ -1223,7 +1223,85 @@ define test_functions()
vrfy(hnrmod(21<<500+7,3,500,-1) == (21<<500+7)%(3<<500-1),
'1112: hnrmod(21<<500+7,3,500,-1) == (21<<500+7)%(3<<500-1)');
print '1113: Ending test_functions';
/*
* catalan testing
*/
vrfy(catalan(2) == 2, '1113: catalan(2) == 2');
vrfy(catalan(3) == 5, '1114: catalan(3) == 5');
vrfy(catalan(4) == 14, '1115: catalan(4) == 14');
vrfy(catalan(20) == 6564120420, '1116: catalan(20) == 6564120420');
/*
* bernoulli builtin function testing
*/
vrfy(bernoulli(0) == 1, '1117: bernoulli(0) == 1');
vrfy(bernoulli(1) == -1/2, '1118: bernoulli(1) == -1/2');
vrfy(bernoulli(2) == 1/6, '1119: bernoulli(2) == 1/6');
vrfy(bernoulli(3) == 0, '1120: bernoulli(3) == 0');
vrfy(bernoulli(4) == -1/30, '1121: bernoulli(4) == -1/30');
vrfy(bernoulli(5) == 0, '1122: bernoulli(5) == 0');
vrfy(bernoulli(6) == 1/42, '1123: bernoulli(6) == 1/42');
vrfy(bernoulli(32) == -7709321041217/510,
'1124: bernoulli(32) == -7709321041217/510');
/*
* euler function testing
*/
vrfy(euler(0) == 1, '1125: euler(0) == 1');
vrfy(euler(1) == 0, '1126: euler(1) == 0');
vrfy(euler(2) == -1, '1127: euler(2) == -1');
vrfy(euler(3) == 0, '1128: euler(3) == 0');
vrfy(freeeuler() == null(), '1129: freeeuler() == null()');
vrfy(euler(4) == 5, '1130: euler(4) == 5');
vrfy(euler(5) == 0, '1131: euler(5) == 0');
vrfy(euler(6) == -61, '1132: euler(6) == -61');
vrfy(euler(32) == 177519391579539289436664789665,
'1130: euler(32) == 177519391579539289436664789665');
vrfy(freeeuler() == null(), '1133: freeeuler() == null()');
/*
* digit with non-10 base
*/
a = 123456.789;
print '1134: a = 123456.789';
vrfy(digit(a, 6, 100) == 0, '1135: digit(a, 6, 100) == 0');
vrfy(digit(a, 5, 100) == 0, '1136: digit(a, 5, 100) == 0');
vrfy(digit(a, 4, 100) == 0, '1137: digit(a, 4, 100) == 0');
vrfy(digit(a, 3, 100) == 0, '1138: digit(a, 3, 100) == 0');
vrfy(digit(a, 2, 100) == 12, '1139: digit(a, 2, 100) == 12');
vrfy(digit(a, 1, 100) == 34, '1140: digit(a, 1, 100) == 34');
vrfy(digit(a, 0, 100) == 56, '1141: digit(a, 0, 100) == 56');
vrfy(digit(a, -1, 100) == 78, '1142: digit(a, -1, 100) == 78');
vrfy(digit(a, -2, 100) == 90, '1143: digit(a, -2, 100) == 90');
vrfy(digit(a, -3, 100) == 0, '1144: digit(a, -3, 100) == 0');
vrfy(digit(a, -4, 100) == 0, '1145: digit(a, -4, 100) == 0');
vrfy(digit(a, -5, 100) == 0, '1146: digit(a, -5, 100) == 0');
vrfy(digit(a, -6, 100) == 0, '1146: digit(a, -6, 100) == 0');
/*
* digits with a non-10 base
*/
vrfy(digits(a, 100) == 3, '1147: digits(a, 100) == 3');
vrfy(digits(2^256-1, 256) == 32,'1148: digits(2^256-1, 256) == 32');
/*
* places with a non-10 base
*/
vrfy(places(0.0123, 2) == -1, '1149: places(0.0123, 2) == -1');
vrfy(places(0.625, 2) == 3, '1150: places(0.625, 2) == 3');
vrfy(places(0.625, 8) == 1, '1151: places(0.625, 8) == 1');
vrfy(places(171/2^712, 2) == 712,
'1152: places(171/2^7120.625, 2) == 712');
vrfy(places(171/2^712, 64) == 119,
'1152: places(171/2^7120.625, 64) == 119');
/*
* verify sleep
*/
vrfy(sleep(1/5) == null(), '1153: sleep(1/5) == null()');
vrfy(sleep(1) == null(), '1154: sleep(1) == null()');
print '1155: Ending test_functions';
}
print '017: parsed test_functions()';
@@ -2987,7 +3065,7 @@ define test_error()
vrfy(root(3,2,0) == error(10029),
'3644: root(3,2,0) == error(10029)');
vrfy(norm("x") == error(10030), '3645: norm("x") == error(10030)');
vrfy(null() << 2 == error(10031),'3646: null() << 2 == error(10031)');
vrfy(list() << 2 == error(10031),'3646: list() << 2 == error(10031)');
vrfy(1.5 << 2 == error(10031), '3647: 1.5 << 2 == error(10031)');
vrfy(3 << "x" == error(10032), '3648: 3 << "x" == error(10032)');
vrfy(3 << 1.5 == error(10032), '3649: 3 << 1.5 == error(10032)');
@@ -7538,6 +7616,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
*

1406
cal/test8600.cal Normal file

File diff suppressed because it is too large Load Diff