mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
Release calc version 2.10.3t5.45
This commit is contained in:
199
lib/README
199
lib/README
@@ -1,9 +1,9 @@
|
||||
# Copyright (c) 1996 David I. Bell and Landon Curt Noll
|
||||
# Copyright (c) 1997 David I. Bell and Landon Curt Noll
|
||||
# Permission is granted to use, distribute, or modify this source,
|
||||
# provided that this copyright notice remains intact.
|
||||
|
||||
The following calc library files are provided because they serve as
|
||||
examples of how use the calc language, and because the authors thought
|
||||
examples of how use the calc language, and/or because the authors thought
|
||||
them to be useful!
|
||||
|
||||
If you write something that you think is useful, please send it to:
|
||||
@@ -26,26 +26,43 @@ version of read:
|
||||
This will cause the needed library files to be read once. If these
|
||||
files have already been read, the read -once will act as a noop.
|
||||
|
||||
By convention, the global variable lib_debug is used to control
|
||||
By convention, the config parameter "lib_debug" is used to control
|
||||
the verbosity of debug information printed by lib files. By default,
|
||||
the lib_debug has a value of 0. If lib_debug < 0, then no debug
|
||||
messages are printed. If lib_debug >= 0, then only usage message
|
||||
regarding each important object are printed at the time of the read.
|
||||
If lib_debug == 0, then only such usage messages are printed; no
|
||||
other debug information is printed.
|
||||
the "lib_debug" has a value of 0.
|
||||
|
||||
The "lib_debug" config parameter takes the place of the lib_debug
|
||||
global variable. By convention, "lib_debug" has the following meanings:
|
||||
|
||||
<-1 no debug messages are printed though some internal
|
||||
debug actions and information may be collected
|
||||
|
||||
-1 no debug messages are printed, no debug actions will be taken
|
||||
|
||||
0 only usage message regarding each important object are
|
||||
printed at the time of the read (default)
|
||||
|
||||
>0 messages regarding each important object are
|
||||
printed at the time of the read in addition
|
||||
to other debug messages
|
||||
|
||||
To conform to the above convention, your lib files should end with
|
||||
lines of the form:
|
||||
|
||||
global lib_debug;
|
||||
if (lib_debug >= 0) {
|
||||
print "funcA(side_a, side_b, side_c) defined";
|
||||
print "funcB(size, mass) defined";
|
||||
if (config("lib_debug") >= 0) {
|
||||
print "obj xyz defined";
|
||||
print "funcA(side_a, side_b, side_c) defined";
|
||||
print "funcB(size, mass) defined";
|
||||
}
|
||||
|
||||
|
||||
=-=
|
||||
|
||||
beer.cal
|
||||
|
||||
Calc's contribution to the 99 Bottles of Beer web page:
|
||||
|
||||
http://www.ionet.net/~timtroyr/funhouse/beer.html#calc
|
||||
|
||||
|
||||
bernoulli.cal
|
||||
|
||||
@@ -69,19 +86,6 @@ chrem.cal
|
||||
Chinese remainder theorem/problem solver.
|
||||
|
||||
|
||||
cryrand.cal
|
||||
|
||||
obj cryobj
|
||||
cryrand(len)
|
||||
scryrand([seed, [len1, len2]])
|
||||
scryrand(seed, ip, iq, ir)
|
||||
random([a, [b]])
|
||||
srandom(seed)
|
||||
randstate([cryobj | 0])
|
||||
|
||||
cryptographically strong pseudo-romandom number generator
|
||||
|
||||
|
||||
deg.cal
|
||||
|
||||
dms(deg, min, sec)
|
||||
@@ -101,6 +105,14 @@ ellip.cal
|
||||
Attempt to factor using the elliptic functions: y^2 = x^3 + a*x + b.
|
||||
|
||||
|
||||
hello.cal
|
||||
|
||||
Calc's contribution to the Hello World! page:
|
||||
|
||||
http://www.latech.edu/~acm/HelloWorld.shtml
|
||||
http://www.latech.edu/~acm/helloworld/calc.html
|
||||
|
||||
|
||||
lucas.cal
|
||||
|
||||
lucas(h, n)
|
||||
@@ -132,14 +144,19 @@ mersenne.cal
|
||||
|
||||
mfactor.cal
|
||||
|
||||
mfactor(n [, start_k [, rept_loop])
|
||||
mfactor(n [, start_k=1 [, rept_loop=10000 [, p_elim=17]]])
|
||||
|
||||
Return the lowest factor of 2^n-1, for n > 0. Starts looking for factors
|
||||
at 2*start_k*n+1. By default, start_k == 1.
|
||||
at 2*start_k*n+1. Skips values that are multiples of primes <= p_elim.
|
||||
By default, start_k == 1, rept_loop = 10000 and p_elim = 17.
|
||||
|
||||
Be default, mfactor() does not report the search progress. When
|
||||
rept_loop > 0, then a report is given every 4*rept_loop loops.
|
||||
The p_elim == 17 overhead takes ~3 minutes on an 200 Mhz r4k CPU and
|
||||
requires about ~13 Megs of memory. The p_elim == 13 overhead
|
||||
takes about 3 seconds and requires ~1.5 Megs of memory.
|
||||
|
||||
The value p_elim == 17 is best for long factorizations. It is the
|
||||
fastest even thought the initial startup overhead is larger than
|
||||
for p_elim == 13.
|
||||
|
||||
mod.cal
|
||||
|
||||
@@ -162,6 +179,49 @@ mod.cal
|
||||
Routines to handle numbers modulo a specified number.
|
||||
|
||||
|
||||
natnumset.cal
|
||||
|
||||
isset(a)
|
||||
setbound(n)
|
||||
empty()
|
||||
full()
|
||||
isin(a, b)
|
||||
addmember(a, n)
|
||||
rmmember(a, n)
|
||||
set()
|
||||
mkset(s)
|
||||
primes(a, b)
|
||||
set_max(a)
|
||||
set_min(a)
|
||||
set_not(a)
|
||||
set_cmp(a, b)
|
||||
set_rel(a, b)
|
||||
set_or(a, b)
|
||||
set_and(a, b)
|
||||
set_comp(a)
|
||||
set_setminus(a, b)
|
||||
set_diff(a,b)
|
||||
set_content(a)
|
||||
set_add(a, b)
|
||||
set_sub(a, b)
|
||||
set_mul(a, b)
|
||||
set_square(a)
|
||||
set_pow(a, n)
|
||||
set_sum(a)
|
||||
set_plus(a)
|
||||
interval(a, b)
|
||||
isinterval(a)
|
||||
set_mod(a, b)
|
||||
randset(n, a, b)
|
||||
polyvals(L, A)
|
||||
polyvals2(L, A, B)
|
||||
set_print(a)
|
||||
|
||||
Demonstration of how the string operators and functions may be used
|
||||
for defining and working with sets of natural numbers not exceeding a
|
||||
user-specified bound.
|
||||
|
||||
|
||||
pell.cal
|
||||
|
||||
pellx(D)
|
||||
@@ -179,6 +239,15 @@ pi.cal
|
||||
iteration.
|
||||
|
||||
|
||||
pix.cal
|
||||
|
||||
pi_of_x(x)
|
||||
|
||||
Calculate the number of primes < x using A(n+1)=A(n-1)+A(n-2). This
|
||||
is a SLOW painful method ... the builtin pix(x) is much faster.
|
||||
Still, this method is interesting.
|
||||
|
||||
|
||||
pollard.cal
|
||||
|
||||
factor(N, N, ai, af)
|
||||
@@ -238,6 +307,8 @@ randbitrun.cal
|
||||
the number and kength of identical bits runs match what is expected.
|
||||
By default, run_cnt is to test the next 65536 random values.
|
||||
|
||||
This tests the a55 generator.
|
||||
|
||||
|
||||
randmprime.cal
|
||||
|
||||
@@ -249,6 +320,30 @@ randmprime.cal
|
||||
turn on various debugging print statements.
|
||||
|
||||
|
||||
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.
|
||||
By default, run_cnt is to test the next 65536 random values.
|
||||
|
||||
This tests the Blum-Blum-Shub generator.
|
||||
|
||||
|
||||
randomrun.cal
|
||||
|
||||
randomrun([run_cnt])
|
||||
|
||||
Perform the "G. Run test" (pp. 65-68) as found in Knuth's "Art of
|
||||
Computer Programming - 2nd edition", Volume 2, Section 3.3.2 on
|
||||
the builtin rand() function. This function will generate run_cnt
|
||||
64 bit values. By default, run_cnt is to test the next 65536
|
||||
random values.
|
||||
|
||||
This tests the Blum-Blum-Shub generator.
|
||||
|
||||
|
||||
randrun.cal
|
||||
|
||||
randrun([run_cnt])
|
||||
@@ -259,6 +354,8 @@ randrun.cal
|
||||
64 bit values. By default, run_cnt is to test the next 65536
|
||||
random values.
|
||||
|
||||
This tests the a55 generator.
|
||||
|
||||
|
||||
regress.cal
|
||||
|
||||
@@ -474,6 +571,36 @@ test4100.cal
|
||||
|
||||
This script is used by regress.cal to test REDC operations.
|
||||
|
||||
test4600.cal
|
||||
|
||||
stest(str [, verbose]) defined
|
||||
ttest([m, [n [,verbose]]]) defined
|
||||
sprint(x) defined
|
||||
findline(f,s) defined
|
||||
findlineold(f,s) defined
|
||||
test4600(verbose, tnum) defined
|
||||
|
||||
This script is used by regress.cal to test searching in files.
|
||||
|
||||
test5100.cal
|
||||
|
||||
global a5100
|
||||
global b5100
|
||||
test5100(x) defined
|
||||
|
||||
This script is used by regress.cal to test the new code generator
|
||||
declaration scope and order.
|
||||
|
||||
test5200.cal
|
||||
|
||||
global a5200
|
||||
static a5200
|
||||
f5200(x) defined
|
||||
g5200(x) defined
|
||||
h5200(x) defined
|
||||
|
||||
This script is used by regress.cal to test the fix of a global/static bug.
|
||||
|
||||
unitfrac.cal
|
||||
|
||||
unitfrac(x)
|
||||
@@ -487,3 +614,17 @@ varargs.cal
|
||||
|
||||
Example program to use 'varargs'. Program to sum the cubes of all
|
||||
the specified numbers.
|
||||
|
||||
xx_print.cal
|
||||
|
||||
isoctet(a) defined
|
||||
list_print(a) defined
|
||||
mat_print (a) defined
|
||||
octet_print(a) defined
|
||||
blk_print(a) defined
|
||||
nblk_print (a) defined
|
||||
strchar(a) defined
|
||||
file_print(a) defined
|
||||
error_print(a) defined
|
||||
|
||||
Demo for the xx_print object routines.
|
||||
|
Reference in New Issue
Block a user