mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
Release calc version 2.11.0t10
This commit is contained in:
@@ -153,7 +153,7 @@ all: ${FULL_HELP_FILES} full ${DETAIL_HELP} ${DETAIL_CLONE} \
|
||||
# used by the upper level Makefile to determine of 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*
|
||||
# an non-emoty else clause for every if condition. *sigh*
|
||||
#
|
||||
.all:
|
||||
rm -f .all
|
||||
@@ -341,7 +341,7 @@ ${SINGULAR_FILES}: ${PLURAL_FILES}
|
||||
# Form the builtin file
|
||||
#
|
||||
# We ave a "chicken-and-egg" problem. We want the builtn help file to
|
||||
# accurately reflect the function list. It would be nice if we could
|
||||
# accurately reflect the function list. It would be nice if we could
|
||||
# just execute calc show builtin, but calc may not have been built or
|
||||
# buildable at this point. The hack-a-round used is to convert ../func.c
|
||||
# into a standalone program that generates a suitable function list
|
||||
@@ -379,7 +379,7 @@ builtin: builtin.top builtin.end ../func.c funclist.sed
|
||||
|
||||
##
|
||||
#
|
||||
# File list generation. You can ignore this section.
|
||||
# File list generation. You can ignore this section.
|
||||
#
|
||||
#
|
||||
# We will form the names of source files as if they were in a
|
||||
|
@@ -17,7 +17,7 @@ DESCRIPTION
|
||||
acosh(x) is the nonnegative real number v for which cosh(v) = x.
|
||||
It is given by
|
||||
|
||||
acosh(x) = ln(x + sqrt(x^2 - 1))
|
||||
acosh(x) = ln(x + sqrt(x^2 - 1))
|
||||
|
||||
EXAMPLE
|
||||
> print acosh(2, 1e-5), acosh(2, 1e-10), acosh(2, 1e-15), acosh(2, 1e-20)
|
||||
|
@@ -16,7 +16,7 @@ DESCRIPTION
|
||||
|
||||
acoth(x) is the real number v for which coth(v) = x.
|
||||
It is given by
|
||||
acoth(x) = ln((x + 1)/(x - 1))/2
|
||||
acoth(x) = ln((x + 1)/(x - 1))/2
|
||||
|
||||
EXAMPLE
|
||||
> print acoth(2, 1e-5), acoth(2, 1e-10), acoth(2, 1e-15), acoth(2, 1e-20)
|
||||
|
@@ -16,7 +16,7 @@ DESCRIPTION
|
||||
|
||||
acsch(x) is the real number v for which csch(v) = x. It is given by
|
||||
|
||||
acsch(x) = ln((1 + sqrt(1 + x^2))/x)
|
||||
acsch(x) = ln((1 + sqrt(1 + x^2))/x)
|
||||
|
||||
|
||||
EXAMPLE
|
||||
|
@@ -20,7 +20,7 @@ DESCRIPTION
|
||||
otherwise accessing, such a vacated address may be catastrophic.
|
||||
|
||||
An octet is normally expressed by B[i] where B is a block and
|
||||
0 <= i < sizeof(B). &B[i] then returns the address at which this
|
||||
0 <= i < sizeof(B). &B[i] then returns the address at which this
|
||||
octet is located until the block is freed or relocated. Freeing
|
||||
of an unnamed block B occurs when a new value is assigned to B or
|
||||
when B ceases to exist; a named block B is freed by blkfree(B().
|
||||
@@ -96,7 +96,7 @@ DESCRIPTION
|
||||
> define f(a) = 27 + a;
|
||||
|
||||
the three occurrences of 27 have the same address which may be displayed
|
||||
by any of &27, &*x, &*y and &f(0). If x and y are assigned
|
||||
by any of &27, &*x, &*y and &f(0). If x and y are assigned
|
||||
other values and f is redefined or undefined and the 27 has not been
|
||||
stored elsewhere (e.g. as the "old value" or in another function
|
||||
definition or as an element in an association), the address assigned at
|
||||
@@ -105,7 +105,7 @@ DESCRIPTION
|
||||
|
||||
When a function returns a number value, that number value is usually
|
||||
placed at a newly allocated address, even if an equal number is stored
|
||||
elsewhere. For example calls to f(a), as defined above, with the same
|
||||
elsewhere. For example calls to f(a), as defined above, with the same
|
||||
non-zero value for a will be assigned to different addresses as can be
|
||||
seen from printing &*A, &*B, &*C after
|
||||
|
||||
|
@@ -84,7 +84,7 @@ DESCRIPTION
|
||||
|
||||
Complex x:
|
||||
|
||||
Returns appr(re(x), y, z) + appr(im(x), y, z) * 1i
|
||||
Returns appr(re(x), y, z) + appr(im(x), y, z) * 1i
|
||||
|
||||
PROPERTIES
|
||||
If appr(x,y,z) != x, then abs(x - appr(x,y,z)) < abs(y).
|
||||
|
@@ -16,7 +16,7 @@ DESCRIPTION
|
||||
|
||||
asech(x) is the real number v for which sech(v) = x. It is given by
|
||||
|
||||
asech(x) = ln((1 + sqrt(1 - x^2))/x)
|
||||
asech(x) = ln((1 + sqrt(1 - x^2))/x)
|
||||
|
||||
EXAMPLE
|
||||
> print asech(.5,1e-5), asech(.5,1e-10), asech(.5,1e-15), asech(.5,1e-20)
|
||||
|
@@ -16,7 +16,7 @@ DESCRIPTION
|
||||
|
||||
asinh(x) is the real number v for which sinh(v) = x. It is given by
|
||||
|
||||
asinh(x) = ln(x + sqrt(1 + x^2))
|
||||
asinh(x) = ln(x + sqrt(1 + x^2))
|
||||
|
||||
EXAMPLE
|
||||
> print asinh(2, 1e-5), asinh(2, 1e-10), asinh(2, 1e-15), asinh(2, 1e-20)
|
||||
|
@@ -44,7 +44,7 @@ DESCRIPTION
|
||||
In simple assignments, = associates from right to left so that, for
|
||||
example,
|
||||
|
||||
a = b = c
|
||||
a = b = c
|
||||
|
||||
has the effect of a = (b = c) and results in assigning the value of c
|
||||
to both a and b. The expression (a = b) = c is acceptable, but has the
|
||||
@@ -66,7 +66,7 @@ DESCRIPTION
|
||||
that of A[0] = A[1].
|
||||
|
||||
If, in execution of a = b, a is changed by the evaluation of b, the
|
||||
value of b may be stored in an unintended or inaccessible location. For
|
||||
value of b may be stored in an unintended or inaccessible location. For
|
||||
example,
|
||||
mat A[2]= {1,2};
|
||||
A[0] = (A = 3);
|
||||
|
@@ -14,7 +14,7 @@ DESCRIPTION
|
||||
assignments of the forms
|
||||
|
||||
A[a_1] = v_1
|
||||
A[a_1, a_2] = v_2
|
||||
A[a_1, a_2] = v_2
|
||||
A[a_1, a_2, a_3] = v_3
|
||||
A[a_1, a_2, a_3, a_4] = v_4
|
||||
|
||||
@@ -53,7 +53,7 @@ DESCRIPTION
|
||||
a sequential scan through the elements difficult.
|
||||
|
||||
The search and rsearch functions can search for an element in an
|
||||
association which has the specified value. They return the index
|
||||
association which has the specified value. They return the index
|
||||
of the found element, or a NULL value if the value was not found.
|
||||
|
||||
Associations can be copied by an assignment, and can be compared
|
||||
|
@@ -18,8 +18,8 @@ DESCRIPTION
|
||||
|
||||
The following convention is used to declare modes:
|
||||
|
||||
base config
|
||||
value string
|
||||
base config
|
||||
value string
|
||||
|
||||
2 "binary" binary fractions
|
||||
8 "octal" octal fractions
|
||||
|
2
help/bit
2
help/bit
@@ -11,7 +11,7 @@ TYPES
|
||||
return int
|
||||
|
||||
DESCRIPTION
|
||||
Determine if the binary bit y is set in x. If:
|
||||
Determine if the binary bit y is set in x. If:
|
||||
|
||||
x
|
||||
int(---) mod 2 == 1
|
||||
|
8
help/blk
8
help/blk
@@ -26,7 +26,7 @@ DESCRIPTION
|
||||
... , B[len-1], these all initially having zero value.
|
||||
|
||||
The octets B[i] for i >= len always have zero value. If B[i] with
|
||||
some i >= len is referenced, len is increased by 1. For example:
|
||||
some i >= len is referenced, len is increased by 1. For example:
|
||||
|
||||
B[i] = x
|
||||
|
||||
@@ -70,7 +70,7 @@ DESCRIPTION
|
||||
If a block value B created by B = blk(len, chunk) is assigned to
|
||||
another variable by C = B, a new block of the same structure as B
|
||||
is created to become the value of C, and the octets in B are copied
|
||||
to this new block. A block with possibly different length or
|
||||
to this new block. A block with possibly different length or
|
||||
chunksize is created by C = blk(B, newlen, newchunk), only the first
|
||||
min(len, newlen) octets being copied from B; later octets are
|
||||
assigned zero value. If omitted, newlen and newchunk default to
|
||||
@@ -120,14 +120,14 @@ DESCRIPTION
|
||||
last two avoid printing of the new value for A.
|
||||
|
||||
Named blocks are assigned index numbers 0, 1, 2, ..., in the order
|
||||
of their creation. The block with index id is returned by blocks(id).
|
||||
of their creation. The block with index id is returned by blocks(id).
|
||||
With no argument, blocks() returns the number of current unfreed
|
||||
named blocks. A named block may be used
|
||||
|
||||
The memory allocated to a named block is freed by the blkfree()
|
||||
function with argument the named block, its name, or its id number.
|
||||
The block remains in existence but with a null data pointer,
|
||||
its length and size being reduced to zero. A new block of memory
|
||||
its length and size being reduced to zero. A new block of memory
|
||||
may be allocated to it, with possibly new length and chunksize by:
|
||||
|
||||
blk(val [, len, chunk])
|
||||
|
@@ -90,7 +90,7 @@ DESCRIPTION
|
||||
so that num can be at most size(B) - ssi.
|
||||
|
||||
For copying to a block B (named or unnamed), reallocation will be
|
||||
required if dsi + num > sizeof(B). (This will not be permitted if
|
||||
required if dsi + num > sizeof(B). (This will not be permitted if
|
||||
protect(B) has bit 4 set.)
|
||||
|
||||
For copying from a file stream fs, num can be at most size(fs) - ssi.
|
||||
|
12
help/blkfree
12
help/blkfree
@@ -12,7 +12,7 @@ TYPES
|
||||
DESCRIPTION
|
||||
If val is a named block, or the name of a named block, or the
|
||||
identifying index for a named block, blkfree(val) frees the
|
||||
memory block allocated to this named block. The block remains
|
||||
memory block allocated to this named block. The block remains
|
||||
in existence with the same name, identifying index, and chunksize,
|
||||
but its size and maxsize becomes zero and the pointer for the start
|
||||
of its data block null.
|
||||
@@ -26,16 +26,16 @@ EXAMPLE
|
||||
> B1 = blk("foo")
|
||||
> B2 = blk("Second block")
|
||||
show blocks
|
||||
id name
|
||||
id name
|
||||
---- -----
|
||||
0 foo
|
||||
1 Second block
|
||||
0 foo
|
||||
1 Second block
|
||||
|
||||
> blkfree(B1)
|
||||
> show blocks
|
||||
id name
|
||||
id name
|
||||
---- -----
|
||||
1 Second block
|
||||
1 Second block
|
||||
|
||||
> B1
|
||||
block 0: foo
|
||||
|
@@ -12,7 +12,7 @@ TYPES
|
||||
Otherwise, if x is an object of type tt, or if x is not an object or
|
||||
number but y is an object of type tt, and the function tt_bround has
|
||||
to be defined; the types for x, plcs, rnd, and the returned value,
|
||||
if any, are as required for specified in tt_bround. For the object
|
||||
if any, are as required for specified in tt_bround. For the object
|
||||
case, plcs and rnd default to the null value.
|
||||
|
||||
For other cases:
|
||||
@@ -31,7 +31,7 @@ DESCRIPTION
|
||||
If the number of binary places is n and eps = 10^-n, the
|
||||
result is the same as for appr(x, eps, rnd). This will be
|
||||
exactly x if x is a multiple of eps; otherwise rounding occurs
|
||||
to one of the nearest multiples of eps on either side of x. Which
|
||||
to one of the nearest multiples of eps on either side of x. Which
|
||||
of these multiples is returned is determined by z = rnd & 31, i.e.
|
||||
the five low order bits of rnd, as follows:
|
||||
|
||||
|
@@ -4,25 +4,25 @@
|
||||
to be set or read. If only one argument is given, then the current
|
||||
value of the named parameter is returned. If two arguments are given,
|
||||
then the named parameter is set to the value of the second argument,
|
||||
and the old value of the parameter is returned. Therefore you can
|
||||
and the old value of the parameter is returned. Therefore you can
|
||||
change a parameter and restore its old value later. The possible
|
||||
parameters are explained in the next section.
|
||||
|
||||
The scale function multiplies or divides a number by a power of 2.
|
||||
This is used for fractional calculations, unlike the << and >>
|
||||
operators, which are only defined for integers. For example,
|
||||
operators, which are only defined for integers. For example,
|
||||
scale(6, -3) is 3/4.
|
||||
|
||||
The quomod function is used to obtain both the quotient and remainder
|
||||
of a division in one operation. The first two arguments a and b are
|
||||
of a division in one operation. The first two arguments a and b are
|
||||
the numbers to be divided. The last two arguments c and d are two
|
||||
variables which will be assigned the quotient and remainder. For
|
||||
nonnegative arguments, the results are equivalent to computing a//b
|
||||
and a%b. If a is negative and the remainder is nonzero, then the
|
||||
quotient will be one less than a//b. This makes the following three
|
||||
properties always hold: The quotient c is always an integer. The
|
||||
properties always hold: The quotient c is always an integer. The
|
||||
remainder d is always 0 <= d < b. The equation a = b * c + d always
|
||||
holds. This function returns 0 if there is no remainder, and 1 if
|
||||
holds. This function returns 0 if there is no remainder, and 1 if
|
||||
there is a remainder. For examples, quomod(10, 3, x, y) sets x to 3,
|
||||
y to 1, and returns the value 1, and quomod(-4, 3.14159, x, y) sets x
|
||||
to -2, y to 2.28318, and returns the value 1.
|
||||
@@ -37,8 +37,8 @@
|
||||
|
||||
The digit and bit functions return individual digits of a number,
|
||||
either in base 10 or in base 2, where the lowest digit of a number
|
||||
is at digit position 0. For example, digit(5678, 3) is 5, and
|
||||
bit(0b1000100, 2) is 1. Negative digit positions indicate places
|
||||
is at digit position 0. For example, digit(5678, 3) is 5, and
|
||||
bit(0b1000100, 2) is 1. Negative digit positions indicate places
|
||||
to the right of the decimal or binary point, so that for example,
|
||||
digit(3.456, -1) is 4.
|
||||
|
||||
@@ -139,11 +139,11 @@
|
||||
|
||||
The functions rcin, rcmul, rcout, rcpow, and rcsq are used to
|
||||
perform modular arithmetic calculations for large odd numbers
|
||||
faster than the usual methods. To do this, you first use the
|
||||
faster than the usual methods. To do this, you first use the
|
||||
rcin function to convert all input values into numbers which are
|
||||
in a format called REDC format. Then you use rcmul, rcsq, and
|
||||
in a format called REDC format. Then you use rcmul, rcsq, and
|
||||
rcpow to multiply such numbers together to produce results also
|
||||
in REDC format. Finally, you use rcout to convert a number in
|
||||
in REDC format. Finally, you use rcout to convert a number in
|
||||
REDC format back to a normal number. The addition, subtraction,
|
||||
negation, and equality comparison between REDC numbers are done
|
||||
using the normal modular methods. For example, to calculate the
|
||||
@@ -185,8 +185,8 @@
|
||||
|
||||
The following convention is used to declare modes:
|
||||
|
||||
base config
|
||||
value string
|
||||
base config
|
||||
value string
|
||||
|
||||
2 "binary" binary fractions
|
||||
8 "octal" octal fractions
|
||||
|
@@ -1,8 +1,8 @@
|
||||
Builtin functions
|
||||
|
||||
There is a large number of built-in functions. Many of the
|
||||
There is a large number of built-in functions. Many of the
|
||||
functions work on several types of arguments, whereas some only
|
||||
work for the correct types (e.g., numbers or strings). In the
|
||||
work for the correct types (e.g., numbers or strings). In the
|
||||
following description, this is indicated by whether or not the
|
||||
description refers to values or numbers. This display is generated
|
||||
by the 'show builtin' command.
|
||||
|
@@ -10,7 +10,7 @@ TYPES
|
||||
DESCRIPTION
|
||||
This function returns the calculation level at which it is called.
|
||||
When a command is being read from a terminal or from a file,
|
||||
calc is at calculation level zero. The level is increased
|
||||
calc is at calculation level zero. The level is increased
|
||||
by 1 each time calculation starts of a user-defined function
|
||||
or of eval(S) for some expression S which evaluates to a string. It
|
||||
decreases to zero if an error occurs or a quit or abort statement
|
||||
|
@@ -6,7 +6,7 @@ SYNOPSIS
|
||||
|
||||
TYPES
|
||||
x real
|
||||
eps real with abs(eps) < 1, defaults to epsilon()
|
||||
eps real with abs(eps) < 1, defaults to epsilon()
|
||||
n real with n >= 1
|
||||
rnd integer, defaults to config("cfappr")
|
||||
|
||||
@@ -21,7 +21,7 @@ DESCRIPTION
|
||||
|
||||
If n >= 1 and den(x) > n, cfappr(x, n) returns the nearest above,
|
||||
nearest below, or nearest, approximation to x with denominator less
|
||||
than or equal to n. If den(x) <= n, cfappr(x,n) returns x.
|
||||
than or equal to n. If den(x) <= n, cfappr(x,n) returns x.
|
||||
|
||||
In either case when the result v is not x, how v relates to x is
|
||||
determined by bits 0, 1, 2 and 4 of the argument rnd in the same way as
|
||||
|
@@ -30,7 +30,7 @@ DESCRIPTION
|
||||
This corresponds to the use of rnd for functions like round(x, n, rnd).
|
||||
|
||||
If bit 3 or 4 of rnd is set, the lower order bits are ignored; bit 3
|
||||
is ignored if bit 4 is set. Thusi, for rnd > 3, it sufficient to
|
||||
is ignored if bit 4 is set. Thusi, for rnd > 3, it sufficient to
|
||||
consider the two cases rnd = 8 and rnd = 16.
|
||||
|
||||
If den(x) > 2, cfsim(x, 8) returns the value of the penultimate simple
|
||||
@@ -55,7 +55,7 @@ DESCRIPTION
|
||||
|
||||
rnd integer x half-integer x den(x) > 2
|
||||
|
||||
8 0 x - sgn(x)/2 approximant
|
||||
8 0 x - sgn(x)/2 approximant
|
||||
16 x - sgn(x) x + sgn(x)/2 nearest
|
||||
|
||||
From either cfsim(x, 0) and cfsim(x, 1), the other is easily
|
||||
@@ -72,7 +72,7 @@ DESCRIPTION
|
||||
Iteration of cfsim(x,8) until an integer is obtained gives a sequence of
|
||||
"good" approximations to x with decreasing denominators and
|
||||
correspondingly decreasing accuracy; each denominator is less than half
|
||||
the preceding denominator. (Unlike the "forward" sequence of
|
||||
the preceding denominator. (Unlike the "forward" sequence of
|
||||
continued-fraction approximants these are not necessarily alternately
|
||||
greater than and less than x.)
|
||||
|
||||
|
4
help/cmp
4
help/cmp
@@ -17,7 +17,7 @@ TYPES
|
||||
|
||||
return if x and y are both real: -1, 0, or 1
|
||||
if x and y are both numbers but not both real:
|
||||
-1, 0, 1, -1+1i, 1i, 1+1i, -1-1i, -1i, or 1-1i
|
||||
-1, 0, 1, -1+1i, 1i, 1+1i, -1-1i, -1i, or 1-1i
|
||||
if x and y are both strings: -1, 0, or 1
|
||||
all other cases: the null value
|
||||
|
||||
@@ -47,7 +47,7 @@ DESCRIPTION
|
||||
obj point {x,y};
|
||||
|
||||
if points with real components are to be partially ordered by their
|
||||
euclidean distance from the origin, an appropriate point_rel
|
||||
euclidean distance from the origin, an appropriate point_rel
|
||||
function may be that given by
|
||||
|
||||
define point_rel(a,b) = sgn(a.x^2 + a.y^2 - b.x^2 - b.y^2);
|
||||
|
14
help/command
14
help/command
@@ -3,7 +3,7 @@ Command sequence
|
||||
This is a sequence of any the following command formats, where
|
||||
each command is terminated by a semicolon or newline. Long command
|
||||
lines can be extended by using a back-slash followed by a newline
|
||||
character. When this is done, the prompt shows a double angle
|
||||
character. When this is done, the prompt shows a double angle
|
||||
bracket to indicate that the line is still in progress. Certain
|
||||
cases will automatically prompt for more input in a similar manner,
|
||||
even without the back-slash. The most common case for this is when
|
||||
@@ -25,7 +25,7 @@ Command sequence
|
||||
The second form defines a simple function which calculates
|
||||
the specified expression value from the specified parameters.
|
||||
The expression cannot be a statement. However, the comma
|
||||
and question mark operators can be useful. Examples of
|
||||
and question mark operators can be useful. Examples of
|
||||
simple functions are:
|
||||
|
||||
define sumcubes(a, b) = a^3 + b^3
|
||||
@@ -45,7 +45,7 @@ Command sequence
|
||||
read filename
|
||||
read -once filename
|
||||
This reads definitions from the specified filename.
|
||||
The name can be quoted if desired. The calculator
|
||||
The name can be quoted if desired. The calculator
|
||||
uses the CALCPATH environment variable to search
|
||||
through the specified directories for the filename,
|
||||
similarly to the use of the PATH environment variable.
|
||||
@@ -54,7 +54,7 @@ Command sequence
|
||||
directory followed by a general calc library directory).
|
||||
The ".cal" extension is defaulted for input files, so
|
||||
that if "filename" is not found, then "filename.cal" is
|
||||
then searched for. The contents of the filename are
|
||||
then searched for. The contents of the filename are
|
||||
command sequences which can consist of expressions to
|
||||
evaluate or functions to define, just like at the top
|
||||
level command level.
|
||||
@@ -82,7 +82,7 @@ Command sequence
|
||||
later read in order to recreate the variable values.
|
||||
For speed reasons, values are written as hex fractions.
|
||||
This command currently only saves simple types, so that
|
||||
matrices, lists, and objects are not saved. Function
|
||||
matrices, lists, and objects are not saved. Function
|
||||
definitions are also not saved.
|
||||
|
||||
If the -m mode disallows opening of files for writing,
|
||||
@@ -247,7 +247,7 @@ Command sequence
|
||||
> <==== calc interactive prompt
|
||||
|
||||
because the '-i' calc causes ABORT to drop into an
|
||||
interactive prompt. However typing a QUIT or ABORT
|
||||
interactive prompt. However typing a QUIT or ABORT
|
||||
at the interactive prompt level will always calc to exit,
|
||||
even when calc is invoked with '-i'.
|
||||
|
||||
@@ -304,5 +304,5 @@ Command sequence
|
||||
|
||||
Also see the help topic:
|
||||
|
||||
statement flow control and declaration statements
|
||||
statement flow control and declaration statements
|
||||
usage how to invoke the calc command and calc -options
|
||||
|
32
help/config
32
help/config
@@ -1,10 +1,10 @@
|
||||
Configuration parameters
|
||||
|
||||
Configuration parameters affect how the calculator performs certain
|
||||
operations. Among features that are controlled by these parameters
|
||||
operations. Among features that are controlled by these parameters
|
||||
are the accuracy of some calculations, the displayed format of results,
|
||||
the choice from possible alternative algorithms, and whether or not
|
||||
debugging information is displayed. The parameters are
|
||||
debugging information is displayed. The parameters are
|
||||
read or set using the "config" built-in function; they remain in effect
|
||||
until their values are changed by a config or equivalent instruction.
|
||||
The following parameters can be specified:
|
||||
@@ -65,7 +65,7 @@ Configuration parameters
|
||||
It allows functions to control their configuration without impacting
|
||||
the calling function.
|
||||
|
||||
There are two configuration state aliases that may be set. To
|
||||
There are two configuration state aliases that may be set. To
|
||||
set the backward compatible standard configuration:
|
||||
|
||||
config("all", "oldstd")
|
||||
@@ -105,7 +105,7 @@ Configuration parameters
|
||||
the decimal point to be printed in real or exponential mode in
|
||||
normal unformatted printing (print, strprint, fprint) or in
|
||||
formatted printing (printf, strprintf, fprintf) when precision is not
|
||||
specified. The initial value for oldstd is 20, for newstd 10.
|
||||
specified. The initial value for oldstd is 20, for newstd 10.
|
||||
The parameter may be changed to the value d by either
|
||||
config("display", d) or by display (d). This parameter does not change
|
||||
the stored value of a number. Where rounding is necessary to
|
||||
@@ -116,7 +116,7 @@ Configuration parameters
|
||||
calculation of functions for which exact values are not possible or
|
||||
not desired. For most functions, the
|
||||
|
||||
remainder = exact value - calculated value
|
||||
remainder = exact value - calculated value
|
||||
|
||||
has absolute value less than epsilon, but, except when the sign of
|
||||
the remainder is controlled by an appropriate parameter, the
|
||||
@@ -133,7 +133,7 @@ Configuration parameters
|
||||
The "mode" parameter is a string specifying the mode for printing of
|
||||
numbers by the unformatted print functions, and the default
|
||||
("%d" specifier) for formatted print functions. The initial mode
|
||||
is "real". The available modes are:
|
||||
is "real". The available modes are:
|
||||
|
||||
"frac" decimal fractions
|
||||
"int" decimal integer
|
||||
@@ -152,10 +152,10 @@ Configuration parameters
|
||||
runs in a time of O(N^2). The second method is a recursive and
|
||||
complicated method which runs in a time of O(N^1.585). The argument
|
||||
for these parameters is the number of binary words at which the
|
||||
second algorithm begins to be used. The minimum value is 2, and
|
||||
second algorithm begins to be used. The minimum value is 2, and
|
||||
the maximum value is very large. If 2 is used, then the recursive
|
||||
algorithm is used all the way down to single digits, which becomes
|
||||
slow since the recursion overhead is high. If a number such as
|
||||
slow since the recursion overhead is high. If a number such as
|
||||
1000000 is used, then the recursive algorithm is never used, causing
|
||||
calculations for large numbers to slow down. For a typical example
|
||||
on a 386, the two algorithms are about equal in speed for a value
|
||||
@@ -174,9 +174,9 @@ Configuration parameters
|
||||
Redc2 specifies the sizes of numbers at which calc switches from
|
||||
its first to its second algorithm when using the REDC algorithm.
|
||||
The first algorithm performs a multiply and a modular reduction
|
||||
together in one loop which runs in O(N^2). The second algorithm
|
||||
together in one loop which runs in O(N^2). The second algorithm
|
||||
does the REDC calculation using three multiplies, and runs in
|
||||
O(N^1.585). The argument for redc2 is the size of the modulus at
|
||||
O(N^1.585). The argument for redc2 is the size of the modulus at
|
||||
which the second algorithm begins to be used.
|
||||
|
||||
Config("tilde") controls whether or not a leading tilde ('~') is
|
||||
@@ -185,7 +185,7 @@ Configuration parameters
|
||||
specified maximum number. The initial "tilde" value is 1.
|
||||
|
||||
Config ("tab") controls the printing of a tab before results
|
||||
automatically displayed when working interactively. It does not
|
||||
automatically displayed when working interactively. It does not
|
||||
affect the printing by the functions print, printf, etc. The initial
|
||||
"tab" value is 1.
|
||||
|
||||
@@ -271,7 +271,7 @@ Configuration parameters
|
||||
The default is to print only the first 256 octets.
|
||||
|
||||
The "blkverbose" determines if all lines, including duplicates
|
||||
should be printed. If TRUE, then all lines are printed. If false,
|
||||
should be printed. If TRUE, then all lines are printed. If false,
|
||||
duplicate lines are skipped and only a "*" is printed in a style
|
||||
similar to od. This config value has not meaning if "blkfmt" is "str".
|
||||
|
||||
@@ -319,7 +319,7 @@ Configuration parameters
|
||||
|
||||
The "calc_debug" is intended for controlling internal calc routines
|
||||
that test its operation, or collect or display information that
|
||||
might be useful for debug purposes. Much of the output from these
|
||||
might be useful for debug purposes. Much of the output from these
|
||||
will make sense only to calc wizards. Zero value (the default for
|
||||
both oldstd and newstd) of config("lib_calc") corresponds to switching
|
||||
off all these routines. For nonzero value, particular bits
|
||||
@@ -401,16 +401,16 @@ Configuration parameters
|
||||
|
||||
The following are synonyms for true:
|
||||
|
||||
"on" "yes" "y" "true" "t" "1" any non-zero number
|
||||
"on" "yes" "y" "true" "t" "1" any non-zero number
|
||||
|
||||
The following are synonyms for false:
|
||||
|
||||
"off" "no" "n" "false" "f" "0" the number zero (0)
|
||||
"off" "no" "n" "false" "f" "0" the number zero (0)
|
||||
|
||||
Examples of setting some parameters are:
|
||||
|
||||
config("mode", "exp"); exponential output
|
||||
config("display", 50); 50 digits of output
|
||||
epsilon(epsilon() / 8); 3 bits more accuracy
|
||||
config("tilde", 0) disable roundoff tilde printing
|
||||
config("tilde", 0) disable roundoff tilde printing
|
||||
config("tab", "off") disable leading tab printing
|
||||
|
@@ -40,7 +40,7 @@ You should send submissions to:
|
||||
|
||||
[[ Replace 'at' with @, 'dot' is with . and remove the spaces ]]
|
||||
|
||||
Thanks for considering submitting code to calc. Calc is a collective
|
||||
Thanks for considering submitting code to calc. Calc is a collective
|
||||
work by a number of people. It would not be what it is today without
|
||||
your efforts and submissions!
|
||||
|
||||
|
@@ -15,7 +15,7 @@ Credits
|
||||
hist.c which is used to do the command line editing.
|
||||
|
||||
Thanks to Ernest W. Bowen for supplying many improvements in
|
||||
accuracy and generality for some numeric functions. Much of
|
||||
accuracy and generality for some numeric functions. Much of
|
||||
this was in terms of actual code which I gratefully accepted.
|
||||
Ernest also supplied the original text for many of the help files.
|
||||
|
||||
|
@@ -28,7 +28,7 @@ DESCRIPTION
|
||||
calc -C
|
||||
|
||||
In other words, explicit action must be taken in order to
|
||||
enable the use of custom functions. By default (no -C arg)
|
||||
enable the use of custom functions. By default (no -C arg)
|
||||
custom functions are compiled in but disabled so that only
|
||||
portable calc scripts may be used.
|
||||
|
||||
@@ -36,7 +36,7 @@ DESCRIPTION
|
||||
multi-precision calculations in a C-like environment. You should
|
||||
consider implementing algorithms in the calc language as a first
|
||||
choice. Sometimes an algorithm requires use of special hardware, a
|
||||
non-portable OS or pre-compiled C library. In these cases a custom
|
||||
non-portable OS or pre-compiled C library. In these cases a custom
|
||||
interface may be needed.
|
||||
|
||||
The custom function interface is intended to make is easy for
|
||||
|
@@ -9,7 +9,7 @@ Function definitions
|
||||
by a return statement, and the function definition is ended with a
|
||||
right brace.
|
||||
|
||||
There are some subtle differences, however. The types of parameters
|
||||
There are some subtle differences, however. The types of parameters
|
||||
and variables are not defined at compile time, and may vary during
|
||||
execution and be different in different calls to the function. For
|
||||
example, a two-argument function add may be defined by
|
||||
|
2
help/den
2
help/den
@@ -11,7 +11,7 @@ TYPES
|
||||
|
||||
DESCRIPTION
|
||||
For real x, den(x) returns the denominator of x when x is expressed
|
||||
in lowest terms with positive denominator. In calc,
|
||||
in lowest terms with positive denominator. In calc,
|
||||
real values are actually rational values. Each calc real
|
||||
value can be uniquely expressed as:
|
||||
|
||||
|
@@ -14,7 +14,7 @@ Environment variables
|
||||
|
||||
/usr/local/lib/calc
|
||||
|
||||
This value is used by the READ command. It is an error
|
||||
This value is used by the READ command. It is an error
|
||||
if no such readable file is found.
|
||||
|
||||
The CALCBINDINGS file searches the CALCPATH as well.
|
||||
|
@@ -1 +1 @@
|
||||
/^#define E_[^_].*[ ][1-9][0-9]*[ ]\/\* .* \*\//s/#define E_.*[ ]\([1-9][0-9]*\)[ ]*\/\* \(.*\)[ ][ ]*\*\// \1 \2/p
|
||||
/^#define E_[^_].*[ ][1-9][0-9]*[ ]\/\* .* \*\//s/#define E_.*[ ]\([1-9][0-9]*\)[ ]*\/\* \(.*\)[ ][ ]*\*\// \1 \2/p
|
||||
|
@@ -11,7 +11,7 @@ TYPES
|
||||
|
||||
DESCRIPTION
|
||||
For eval(str), the value of str is to be a string that could be the body
|
||||
of the definition of a function f(). This string may declare local
|
||||
of the definition of a function f(). This string may declare local
|
||||
variables and include keywords (while, for, ...) other than the
|
||||
reserved keywords (define, show, help, read, write, show, cd) intended
|
||||
for interactive use or for reading from a file.
|
||||
|
2
help/exp
2
help/exp
@@ -1,5 +1,5 @@
|
||||
NAME
|
||||
exp - exponential function
|
||||
exp - exponential function
|
||||
|
||||
SYNOPSIS
|
||||
exp(x [,eps])
|
||||
|
@@ -14,7 +14,7 @@ TYPES
|
||||
DESCRIPTION
|
||||
|
||||
If n >= 0 and n has a prime factor less than or equal to limit,
|
||||
factor(n, limit) returns the smallest such factor. If n >= 0
|
||||
factor(n, limit) returns the smallest such factor. If n >= 0
|
||||
and the smallest prime factor of n exceeds limit, 1 is returned.
|
||||
In particular, if n >= 0 and limit <= 1, factor(n, limit)
|
||||
always returns 1; factor(n,2) returns 2 if and only if n is even.
|
||||
|
@@ -13,7 +13,7 @@ DESCRIPTION
|
||||
This function closes the open file associated with the descriptor fd.
|
||||
When this is done, the file value associated with the file remains
|
||||
a file value, but appears 'closed', and cannot be used in further
|
||||
file-related calls (except fclose) without causing errors. This same
|
||||
file-related calls (except fclose) without causing errors. This same
|
||||
action occurs to all copies of the file value. You do not need to
|
||||
explicitly close all the copies of a file value.
|
||||
|
||||
@@ -26,7 +26,7 @@ DESCRIPTION
|
||||
there had been an error using the file, or the null value if
|
||||
there was no error.
|
||||
|
||||
Closing a closed file is permitted. Fclose returns null in
|
||||
Closing a closed file is permitted. Fclose returns null in
|
||||
this case.
|
||||
|
||||
EXAMPLE
|
||||
|
@@ -14,7 +14,7 @@ DESCRIPTION
|
||||
is set or clear.
|
||||
|
||||
The end-of-file flag for the stream fd is set if reading at the
|
||||
end-of-file position is attempted. The flag is cleared by
|
||||
end-of-file position is attempted. The flag is cleared by
|
||||
positioning operations (fseek, rewind, fsetpos) and by freopen.
|
||||
|
||||
EXAMPLE
|
||||
@@ -23,14 +23,14 @@ EXAMPLE
|
||||
> fflush(fd1)
|
||||
> fd2 = fopen("/tmp/newfile", "r")
|
||||
> feof(fd2)
|
||||
0
|
||||
0
|
||||
> fgetline(fd2)
|
||||
"Chongo was here"
|
||||
> feof(fd2)
|
||||
0
|
||||
0
|
||||
> fgetline(fd2)
|
||||
> feof(fd2)
|
||||
1
|
||||
1
|
||||
|
||||
LIMITS
|
||||
none
|
||||
|
@@ -20,7 +20,7 @@ DESCRIPTION
|
||||
EXAMPLE
|
||||
> fd = fopen("/etc/motd", "r")
|
||||
> ferror(fd)
|
||||
0
|
||||
0
|
||||
|
||||
LIMITS
|
||||
fd must be associaed with an open file
|
||||
|
@@ -14,7 +14,7 @@ DESCRIPTION
|
||||
associated with fd.
|
||||
|
||||
If there is a next character, this function returns a 1
|
||||
character string containing that character. In the case
|
||||
character string containing that character. In the case
|
||||
of EOF or error, nil is returned.
|
||||
|
||||
EXAMPLE
|
||||
|
@@ -16,7 +16,7 @@ DESCRIPTION
|
||||
characters are skipped. If the reading reaches end-of-file, the
|
||||
null value is returned. If non-whitespace is encountered, formation
|
||||
of a string begins, continuing until whitespace of '\0' or end-of-file
|
||||
is reached. The returned value is this string (terminated as usual
|
||||
is reached. The returned value is this string (terminated as usual
|
||||
by a null character). After the operation, the file position will
|
||||
be immediately after the first whitespace character of '\0' or at
|
||||
end-of-file.
|
||||
|
@@ -14,7 +14,7 @@ DESCRIPTION
|
||||
the open file associated with fd. Unlike fgets, the trailing
|
||||
newline is removed from the return string.
|
||||
|
||||
Empty lines return the null string. When the end of file is reached,
|
||||
Empty lines return the null string. When the end of file is reached,
|
||||
fgetline returns the null value. (Note the distinction between a null
|
||||
string and a null value.)
|
||||
|
||||
|
18
help/file
18
help/file
@@ -6,7 +6,7 @@ Using files
|
||||
Some differences do occur, as will be explained here.
|
||||
|
||||
Names of files are subject to ~ expansion just like the C or
|
||||
Korn shell. For example, the file name:
|
||||
Korn shell. For example, the file name:
|
||||
|
||||
~/.rc.cal
|
||||
|
||||
@@ -19,8 +19,8 @@ Using files
|
||||
|
||||
A file can be opened for either reading, writing, or appending.
|
||||
To do this, the 'fopen' function is used, which accepts a filename
|
||||
and an open mode, both as strings. You use 'r' for reading, 'w'
|
||||
for writing, and 'a' for appending. For example, to open the file
|
||||
and an open mode, both as strings. You use 'r' for reading, 'w'
|
||||
for writing, and 'a' for appending. For example, to open the file
|
||||
'foo' for reading, the following could be used:
|
||||
|
||||
fd = fopen('foo', 'r');
|
||||
@@ -53,7 +53,7 @@ Using files
|
||||
The 'fclose' function is used to close a file which had been opened.
|
||||
When this is done, the file value associated with the file remains
|
||||
a file value, but appears 'closed', and cannot be used in further
|
||||
file-related calls (except fclose) without causing errors. This same
|
||||
file-related calls (except fclose) without causing errors. This same
|
||||
action occurs to all copies of the file value. You do not need to
|
||||
explicitly close all the copies of a file value. The 'fclose'
|
||||
function returns the numeric value of errno if there had been an
|
||||
@@ -67,7 +67,7 @@ Using files
|
||||
print "error #" : badfile : ":", errno(badfile);
|
||||
}
|
||||
|
||||
File values can be printed. When this is done, the filename of the
|
||||
File values can be printed. When this is done, the filename of the
|
||||
opened file is printed inside of quote marks. If the file value had
|
||||
been closed, then the null string is printed. If a file value is the
|
||||
result of a top-level expression, then in addition to the filename,
|
||||
@@ -75,7 +75,7 @@ Using files
|
||||
status is also displayed.
|
||||
|
||||
File values can be used inside of 'if' tests. When this is done,
|
||||
an opened file is TRUE, and a closed file is FALSE. As an example
|
||||
an opened file is TRUE, and a closed file is FALSE. As an example
|
||||
of this, the following loop will print the names of all the currently
|
||||
opened non-standard files with their indexes, and then close them:
|
||||
|
||||
@@ -89,9 +89,9 @@ Using files
|
||||
The functions to read from files are 'fgetline' and 'fgetc'.
|
||||
The 'fgetline' function accepts a file value, and returns the next
|
||||
input line from a file. The line is returned as a string value, and
|
||||
does not contain the end of line character. Empty lines return the
|
||||
does not contain the end of line character. Empty lines return the
|
||||
null string. When the end of file is reached, fgetline returns the
|
||||
null value. (Note the distinction between a null string and a null
|
||||
null value. (Note the distinction between a null string and a null
|
||||
value.) If the line contained a numeric value, then the 'eval'
|
||||
function can then be used to convert the string to a numeric value.
|
||||
Care should be used when doing this, however, since eval will
|
||||
@@ -103,7 +103,7 @@ Using files
|
||||
The 'printf' and 'fprintf' functions are used to print results to a
|
||||
file (which could be stdout or stderr). The 'fprintf' function
|
||||
accepts a file variable, whereas the 'printf' function assumes the
|
||||
use of 'files(1)' (stdout). They both require a format string, which
|
||||
use of 'files(1)' (stdout). They both require a format string, which
|
||||
is used in almost the same way as in normal C. The differences come
|
||||
in the interpretation of values to be printed for various formats.
|
||||
Unlike in C, where an unmatched format type and value will cause
|
||||
|
@@ -25,7 +25,7 @@ DESCRIPTION
|
||||
files are already open by the calculator and cannot be closed.
|
||||
|
||||
When calc starts up, it scans for open file descriptors above
|
||||
stderr (2) and below MAXFILES (20). Any open descriptor found
|
||||
stderr (2) and below MAXFILES (20). Any open descriptor found
|
||||
is assumed to be an open file opened in an unknown mode. Calc
|
||||
will try to read and write to this file when directed.
|
||||
|
||||
|
@@ -20,7 +20,7 @@ DESCRIPTION
|
||||
"a" appending
|
||||
|
||||
Names of files are subject to ~ expansion just like the C or
|
||||
Korn shell. For example, the file name:
|
||||
Korn shell. For example, the file name:
|
||||
|
||||
~/lib/gleet
|
||||
|
||||
|
@@ -6,7 +6,7 @@ SYNOPSIS
|
||||
|
||||
TYPES
|
||||
fs file stream open for writing
|
||||
s_1, ... string
|
||||
s_1, ... string
|
||||
|
||||
return null or error value
|
||||
|
||||
@@ -22,9 +22,9 @@ EXAMPLE
|
||||
> fputstr(f, "Alpha", "Beta")
|
||||
> freopen(f, "r")
|
||||
> fgetstr(f)
|
||||
"Alpha"
|
||||
"Alpha"
|
||||
> fgetstr(f)
|
||||
"Beta"
|
||||
"Beta"
|
||||
> fgetstr(f)
|
||||
>
|
||||
> fputstr(f, "Gamma")
|
||||
|
@@ -5,14 +5,14 @@ SYNOPSIS
|
||||
free(a, b, ...)
|
||||
|
||||
TYPES
|
||||
a, b, ... any
|
||||
a, b, ... any
|
||||
|
||||
return null value
|
||||
|
||||
DESCRIPTION
|
||||
Those of the arguments a, b, ... that specify lvalues are assigned
|
||||
the null value, effectively freeing whatever memory is used to
|
||||
store their current values. Other arguments are ignored.
|
||||
store their current values. Other arguments are ignored.
|
||||
|
||||
free(.) frees the current "old value".
|
||||
|
||||
|
@@ -19,10 +19,10 @@ EXAMPLE
|
||||
|
||||
Name Level Type
|
||||
---- ----- -----
|
||||
a 1 real = 2
|
||||
a 0 real = 1
|
||||
b 0 list
|
||||
c 0 matrix
|
||||
a 1 real = 2
|
||||
a 0 real = 1
|
||||
b 0 list
|
||||
c 0 matrix
|
||||
|
||||
Number: 4
|
||||
> freeglobals()
|
||||
@@ -30,10 +30,10 @@ EXAMPLE
|
||||
|
||||
Name Level Type
|
||||
---- ----- -----
|
||||
a 1 null
|
||||
a 0 null
|
||||
b 0 null
|
||||
c 0 null
|
||||
a 1 null
|
||||
a 0 null
|
||||
b 0 null
|
||||
c 0 null
|
||||
|
||||
Number: 4
|
||||
|
||||
|
@@ -15,8 +15,8 @@ EXAMPLE
|
||||
> a = rcin(10,27)
|
||||
> b = rcin(10,15)
|
||||
> show redc
|
||||
0 1 27
|
||||
1 2 15
|
||||
0 1 27
|
||||
1 2 15
|
||||
> freeredc()
|
||||
> show redc
|
||||
>
|
||||
|
@@ -26,7 +26,7 @@ EXAMPLE
|
||||
|
||||
Name Scopes Type
|
||||
---- ------ -----
|
||||
a 1 0 real = 6
|
||||
a 1 0 real = 6
|
||||
|
||||
Number: 1
|
||||
> freestatics()
|
||||
|
@@ -14,7 +14,7 @@ DESCRIPTION
|
||||
If x and y are not zero and n is the largest non-negative integer
|
||||
for which y^n is a divisor of x, frem(x,y) returns abs(x/y^n).
|
||||
In particular, abs(x) is returned if x is not divisible by
|
||||
y or if abs(y) = 1. If abs(y) > 1, frem(x,y) is the greatest
|
||||
y or if abs(y) = 1. If abs(y) > 1, frem(x,y) is the greatest
|
||||
divisor of x not divisible by y.
|
||||
|
||||
For all x, frem(x,0) is defined to equal abs(x).
|
||||
|
@@ -18,7 +18,7 @@ DESCRIPTION
|
||||
|
||||
With three arguments, fs, if open, is closed, and an attempt is made to
|
||||
open the file with the specified name and assign it to the stream
|
||||
fs. A non-null value is returned only if the attempt fails.
|
||||
fs. A non-null value is returned only if the attempt fails.
|
||||
|
||||
EXAMPLE
|
||||
|
||||
|
@@ -31,7 +31,7 @@ DESCRIPTION
|
||||
'%'. A single '%' read from fmt is taken to indicate the beginning of
|
||||
a conversion specification field consisting in succession of:
|
||||
|
||||
an optional '*',
|
||||
an optional '*',
|
||||
optional decimal digits,
|
||||
one of 'c', 's', 'n', 'f', 'e', 'i' or a scanset specifier.
|
||||
|
||||
@@ -40,7 +40,7 @@ DESCRIPTION
|
||||
other sequence of characters follows the '%', characters before the
|
||||
first exceptional character (which could be the terminating null
|
||||
character of the fmt string) are ignored, e.g. the sequence " %*3d " does
|
||||
the same as " d ". If there is no '*' at the beginning of the specifier,
|
||||
the same as " d ". If there is no '*' at the beginning of the specifier,
|
||||
and the list x_1, x_2, ... has not been exhausted,
|
||||
a value will be assigned to the next lvalue in the list; if no lvalue
|
||||
remains, the reading of fs stops and the function returns the number
|
||||
@@ -68,7 +68,7 @@ DESCRIPTION
|
||||
|
||||
The cases 'f', 'e', 'r', 'i' may be considered to indicate expectation of
|
||||
floating-point, exponential, ratio, or integer representation of the
|
||||
number to be read. For example, 'i'
|
||||
number to be read. For example, 'i'
|
||||
might be taken to suggest a number like +2345; 'r' might suggest
|
||||
a representation like -27/49; 'e' might suggest a representation like
|
||||
1.24e-7; 'f' might suggest a representation like 27.145. However, there
|
||||
@@ -82,7 +82,7 @@ DESCRIPTION
|
||||
|
||||
2+3/4*7i+3.15e7
|
||||
|
||||
would be interpreted as for an ordinary evaluation. A decimal fraction
|
||||
would be interpreted as for an ordinary evaluation. A decimal fraction
|
||||
may have more than one dot: dots after the first, which is taken to be
|
||||
the decimal point, are ignored. Thus "12.3..45e6.7" is interpreted
|
||||
as if it were "12.345e67".
|
||||
|
2
help/gcd
2
help/gcd
@@ -5,7 +5,7 @@ SYNOPSIS
|
||||
gcd(x1, x2, ...)
|
||||
|
||||
TYPES
|
||||
x1, x2, ... rational number
|
||||
x1, x2, ... rational number
|
||||
|
||||
return rational number
|
||||
|
||||
|
@@ -15,12 +15,12 @@ DESCRIPTION
|
||||
The basis of this hash algorithm was taken from an idea sent
|
||||
as reviewer comments to the IEEE POSIX P1003.2 committee by:
|
||||
|
||||
Phong Vo (http://www.research.att.com/info/kpv/)
|
||||
Glenn Fowler (http://www.research.att.com/~gsf/)
|
||||
Phong Vo (http://www.research.att.com/info/kpv/)
|
||||
Glenn Fowler (http://www.research.att.com/~gsf/)
|
||||
|
||||
In a subsequent ballot round:
|
||||
|
||||
Landon Curt Noll (http://reality.sgi.com/chongo/)
|
||||
Landon Curt Noll (http://reality.sgi.com/chongo/)
|
||||
|
||||
improved on their algorithm. Some people tried this hash
|
||||
and found that it worked rather well. In an EMail message
|
||||
@@ -30,7 +30,7 @@ DESCRIPTION
|
||||
collision rate. The FNV speed allows one to quickly hash lots
|
||||
of data while maintaining a reasonable collision rate. See:
|
||||
|
||||
http://reality.sgi.com/chongo/tech/comp/fnv/
|
||||
http://reality.sgi.com/chongo/tech/comp/fnv/
|
||||
|
||||
for more details as well as other forms of the FNV hash.
|
||||
|
||||
|
@@ -60,7 +60,7 @@ For example:
|
||||
|
||||
help usage
|
||||
|
||||
will print the calc command usage information. One can obtain calc help
|
||||
will print the calc command usage information. One can obtain calc help
|
||||
without invoking any startup code by running calc as follows:
|
||||
|
||||
calc -q help topic
|
||||
@@ -76,7 +76,7 @@ for details of the -m mode.
|
||||
|
||||
The help command is able to display installed help files for custom builtin
|
||||
functions. However, if the custom name is the same as a standard help
|
||||
file, the standard help file will be displayed instead. The custom help
|
||||
file, the standard help file will be displayed instead. The custom help
|
||||
builtin should be used to directly access the custom help file.
|
||||
|
||||
For example, the custom help builtin has the same name as the standard
|
||||
|
@@ -11,7 +11,7 @@ TYPES
|
||||
|
||||
DESCRIPTION
|
||||
If x is a nonzero integer, highbit(x) returns the index of the
|
||||
highest bit in the binary representation of abs(x). Equivalently,
|
||||
highest bit in the binary representation of abs(x). Equivalently,
|
||||
highbit(x) = n if 2^n <= abs(x) < 2^(n + 1); the binary
|
||||
representation of x then has n + 1 digits.
|
||||
|
||||
|
@@ -11,7 +11,7 @@ Command history
|
||||
for future recall.
|
||||
|
||||
Before the return key is typed, the current line can be edited
|
||||
using emacs-like editing commands. As examples, ^A moves to
|
||||
using emacs-like editing commands. As examples, ^A moves to
|
||||
the beginning of the line, ^F moves forwards through the line,
|
||||
backspace removes characters from the line, and ^K kills the
|
||||
rest of the line.
|
||||
@@ -24,7 +24,7 @@ Command history
|
||||
|
||||
Typing <esc>h lists all of the commands in the command history
|
||||
and numbers the lines. The most recently executed line is always
|
||||
number 1, the next most recent number 2, and so on. The numbering
|
||||
number 1, the next most recent number 2, and so on. The numbering
|
||||
for a particular command therefore changes as lines are entered.
|
||||
|
||||
Typing a number at the beginning of a line followed by <esc>g
|
||||
@@ -51,11 +51,11 @@ Command history
|
||||
|
||||
The actual keys used for editing are defined in a bindings file,
|
||||
usually called /usr/local/lib/calc/bindings. Changing the entries
|
||||
in this file will change the key bindings used for editing. If the
|
||||
in this file will change the key bindings used for editing. If the
|
||||
file is not readable, then a message will be output and command
|
||||
line editing is disabled. In this case you can only edit each
|
||||
line as provided by the terminal driver in the operating system.
|
||||
|
||||
A shell command can be executed by typing '!cmd', where cmd
|
||||
is the command to execute. If cmd is not given, then a shell
|
||||
is the command to execute. If cmd is not given, then a shell
|
||||
command level is started.
|
||||
|
@@ -11,10 +11,10 @@ DESCRIPTION
|
||||
This function returns the input level at which it is called.
|
||||
When calc starts, it is at level zero. The level is increased
|
||||
by 1 each time execution starts of a read file command or a call to
|
||||
eval(S) for some expression S which evaluates to a string. It
|
||||
eval(S) for some expression S which evaluates to a string. It
|
||||
decreases by 1 when a file being read reaches EOF or a string
|
||||
being eval-ed reaches '\0', or earlier if a quit statement is
|
||||
encountered at top calculation-level in the flle or string. It
|
||||
encountered at top calculation-level in the flle or string. It
|
||||
decreases to zero if an abort statement is encountered at any
|
||||
function-level in the file or string. If a quit or abort
|
||||
statement is encountered at top calculation-level at top input-level,
|
||||
|
@@ -9,13 +9,13 @@ Interrupts
|
||||
|
||||
You can generate the SIGINT signal multiple times if necessary,
|
||||
and each time the calculator will abort the calculation at a more
|
||||
risky place within the calculation. Each new interrupt prints a
|
||||
risky place within the calculation. Each new interrupt prints a
|
||||
message of the form:
|
||||
|
||||
[Abort level n]
|
||||
|
||||
where n ranges from 1 to 3. For n equal to 1, the calculator will
|
||||
abort calculations at the next statement boundary. For n equal to 2,
|
||||
where n ranges from 1 to 3. For n equal to 1, the calculator will
|
||||
abort calculations at the next statement boundary. For n equal to 2,
|
||||
the calculator will abort calculations at the next opcode boundary.
|
||||
For n equal to 3, the calculator will abort calculations at the next
|
||||
lowest level arithmetic operation boundary.
|
||||
|
@@ -2,12 +2,12 @@ Quick introduction
|
||||
|
||||
This is an interactive calculator which provides for easy large
|
||||
numeric calculations, but which also can be easily programmed
|
||||
for difficult or long calculations. It can accept a command line
|
||||
for difficult or long calculations. It can accept a command line
|
||||
argument, in which case it executes that single command and exits.
|
||||
Otherwise, it enters interactive mode. In this mode, it accepts
|
||||
commands one at a time, processes them, and displays the answers.
|
||||
In the simplest case, commands are simply expressions which are
|
||||
evaluated. For example, the following line can be input:
|
||||
evaluated. For example, the following line can be input:
|
||||
|
||||
3 * (4 + 1)
|
||||
|
||||
|
@@ -14,7 +14,7 @@ DESCRIPTION
|
||||
named block, 0 otherwise.
|
||||
|
||||
Note that a named block B retains its name after its data block is
|
||||
freed by rmblk(B). That a named block B has null data block may be
|
||||
freed by rmblk(B). That a named block B has null data block may be
|
||||
tested using sizeof(B); this returns 0 if and only if the memory
|
||||
has been freed.
|
||||
|
||||
|
@@ -10,7 +10,7 @@ TYPES
|
||||
return int
|
||||
|
||||
DESCRIPTION
|
||||
Determine if x is an even integer. This function will return 1 if x is
|
||||
Determine if x is an even integer. This function will return 1 if x is
|
||||
even integer, 0 otherwise.
|
||||
|
||||
EXAMPLE
|
||||
|
@@ -10,7 +10,7 @@ TYPES
|
||||
return int
|
||||
|
||||
DESCRIPTION
|
||||
Determine if x is a matrix. This function will return 1 if x is
|
||||
Determine if x is a matrix. This function will return 1 if x is
|
||||
a matrix, 0 otherwise.
|
||||
|
||||
EXAMPLE
|
||||
|
@@ -10,7 +10,7 @@ TYPES
|
||||
return int
|
||||
|
||||
DESCRIPTION
|
||||
Determine if x is a numeric value. This function will return 1 if x
|
||||
Determine if x is a numeric value. This function will return 1 if x
|
||||
is a a numeric value, 0 otherwise.
|
||||
|
||||
EXAMPLE
|
||||
|
@@ -11,7 +11,7 @@ TYPES
|
||||
return int
|
||||
|
||||
DESCRIPTION
|
||||
Determine if x is is a small prime. This function will return
|
||||
Determine if x is is a small prime. This function will return
|
||||
1 if x is a small prime. If x is even, this function will
|
||||
return 0. If x is negative or a small composite (non-prime),
|
||||
0 will be returned.
|
||||
@@ -39,7 +39,7 @@ EXAMPLE
|
||||
-1 2 0
|
||||
|
||||
LIMITS
|
||||
err not given and (y is even or y < 2^32)
|
||||
err not given and (y is even or y < 2^32)
|
||||
|
||||
LIBRARY
|
||||
FLAG zisprime(ZVALUE x) (return 1 if prime, 0 not prime, -1 if >= 2^32)
|
||||
|
@@ -11,7 +11,7 @@ TYPES
|
||||
return int
|
||||
|
||||
DESCRIPTION
|
||||
Determine if x and y are relatively prime. If gcd(x,y) == 1, then
|
||||
Determine if x and y are relatively prime. If gcd(x,y) == 1, then
|
||||
return 1, otherwise return 0.
|
||||
|
||||
EXAMPLE
|
||||
|
@@ -10,7 +10,7 @@ TYPES
|
||||
return int
|
||||
|
||||
DESCRIPTION
|
||||
Determine if x is a square. If there exists integers a, b such that:
|
||||
Determine if x is a square. If there exists integers a, b such that:
|
||||
|
||||
x == a^2 / b^2 (b != 0)
|
||||
|
||||
|
@@ -10,7 +10,7 @@ TYPES
|
||||
return int
|
||||
|
||||
DESCRIPTION
|
||||
Determine if x is a string. This function will return 1 if x is
|
||||
Determine if x is a string. This function will return 1 if x is
|
||||
a string, 0 otherwise.
|
||||
|
||||
EXAMPLE
|
||||
|
@@ -29,7 +29,7 @@ DESCRIPTION
|
||||
where the p_i are primes, not necessarily distinct, the
|
||||
jacobi symbol function is given by
|
||||
|
||||
jacobi(x,y) = (x/p_1) * (x/p_2) * ... * (x/p_k).
|
||||
jacobi(x,y) = (x/p_1) * (x/p_2) * ... * (x/p_k).
|
||||
|
||||
where the functions on the right are Legendre symbol functions.
|
||||
|
||||
|
10
help/join
10
help/join
@@ -23,11 +23,11 @@ EXAMPLE
|
||||
> join(A, B)
|
||||
|
||||
list (5 elements, 5 nonzero):
|
||||
[[0]] = 1
|
||||
[[1]] = 2
|
||||
[[2]] = 3
|
||||
[[3]] = 4
|
||||
[[4]] = 5
|
||||
[[0]] = 1
|
||||
[[1]] = 2
|
||||
[[2]] = 3
|
||||
[[3]] = 4
|
||||
[[4]] = 5
|
||||
|
||||
LIMITS
|
||||
none
|
||||
|
2
help/lcm
2
help/lcm
@@ -5,7 +5,7 @@ SYNOPSIS
|
||||
lcm(x1, x2, ...)
|
||||
|
||||
TYPES
|
||||
x1, x2, ... rational number
|
||||
x1, x2, ... rational number
|
||||
|
||||
return rational number
|
||||
|
||||
|
@@ -24,12 +24,12 @@ DESCRIPTION
|
||||
4, 6, and 7.
|
||||
|
||||
The 'push' and 'pop' functions insert or remove an element from
|
||||
the beginning of the list. The 'append' and 'remove' functions
|
||||
the beginning of the list. The 'append' and 'remove' functions
|
||||
insert or remove an element from the end of the list. The 'insert'
|
||||
and 'delete' functions insert or delete an element from the middle
|
||||
(or ends) of a list. The functions which insert elements return
|
||||
the null value, but the functions which remove an element return
|
||||
the element as their value. The 'size' function returns the number
|
||||
the element as their value. The 'size' function returns the number
|
||||
of elements in the list.
|
||||
|
||||
Note that these functions manipulate the actual list argument,
|
||||
@@ -43,11 +43,11 @@ DESCRIPTION
|
||||
An arbitrary element of a linked list can be accessed by using the
|
||||
double-bracket operator. The beginning of the list has index 0.
|
||||
Thus in the new list x above, the expression x[[0]] returns the
|
||||
value of the first element of the list, which is 9. Note that this
|
||||
value of the first element of the list, which is 9. Note that this
|
||||
indexing does not remove elements from the list.
|
||||
|
||||
Since lists are doubly linked in memory, random access to arbitrary
|
||||
elements can be slow if the list is large. However, for each list
|
||||
elements can be slow if the list is large. However, for each list
|
||||
a pointer is kept to the latest indexed element, thus relatively
|
||||
sequential accesses to the elements in a list will not be slow.
|
||||
|
||||
|
@@ -11,7 +11,7 @@ TYPES
|
||||
|
||||
DESCRIPTION
|
||||
If x is a nonzero integer, lowbit(x) returns the index of the
|
||||
lowest nonzero bit in the binary representation of abs(x). Equivalently,
|
||||
lowest nonzero bit in the binary representation of abs(x). Equivalently,
|
||||
lowbit(x) is the greatest integer for which x/2^n is an integer;
|
||||
the binary representation of x then ends with n zero bits.
|
||||
|
||||
|
4
help/mat
4
help/mat
@@ -18,14 +18,14 @@ Using matrices
|
||||
x = name[3,5];
|
||||
|
||||
The double-square bracket operator can be used on any matrix to
|
||||
make references to the elements easy and efficient. This operator
|
||||
make references to the elements easy and efficient. This operator
|
||||
bypasses the normal indexing mechanism, and treats the array as if
|
||||
it was one-dimensional and with a lower bound of zero. In this
|
||||
indexing mode, elements correspond to the normal indexing mode where
|
||||
the rightmost index increases most frequently. For example, when
|
||||
using double-square bracket indexing on a two-dimensional matrix,
|
||||
increasing indexes will reference the matrix elements left to right,
|
||||
row by row. Thus in the following example, 'x' and 'y' are copied
|
||||
row by row. Thus in the following example, 'x' and 'y' are copied
|
||||
from the same matrix element:
|
||||
|
||||
mat m[1:2, 1:3];
|
||||
|
4
help/max
4
help/max
@@ -34,9 +34,9 @@ DESCRIPTION
|
||||
and returns a real-number value for any comparison that has to be made,
|
||||
max(x_1, x_2, ...) returns the value determined by max(x_1) = x_1,
|
||||
and succesively for later arguments, by the use of the equivalent of
|
||||
max(a,b) = (a < b) ? b : a. If the ordering determined by < is total,
|
||||
max(a,b) = (a < b) ? b : a. If the ordering determined by < is total,
|
||||
max(x_1, ...) will be the maximum value among the arguments. For a
|
||||
preorder relation it may be one of several maximal values. For
|
||||
preorder relation it may be one of several maximal values. For
|
||||
other relations, it may be difficult to predict the result.
|
||||
|
||||
EXAMPLE
|
||||
|
2
help/md5
2
help/md5
@@ -24,7 +24,7 @@ DESCRIPTION
|
||||
The new arg1 HASH state is returned.
|
||||
|
||||
If arg1 is not a a HASH state, then the initial HASH is
|
||||
used and modifed by arg1 and any val args supplied. The
|
||||
used and modifed by arg1 and any val args supplied. The
|
||||
return value is the new HASH state.
|
||||
|
||||
The following table gives a summary of actions and return values.
|
||||
|
@@ -10,7 +10,7 @@ TYPES
|
||||
return integer
|
||||
|
||||
DESCRIPTION
|
||||
This is analogous to the C operator sizeof. It attempts to assess
|
||||
This is analogous to the C operator sizeof. It attempts to assess
|
||||
the number of bytes in memory used to store a value and all its
|
||||
components plus all of the related structue overhead. Unlike
|
||||
sizeof(x), this builtin includes overhead.
|
||||
@@ -19,7 +19,7 @@ DESCRIPTION
|
||||
end of strings.
|
||||
|
||||
Unlike sizeof(x), this builtin includes the size demonitor for integers
|
||||
and the imaginary part for complex values. Storage for holding
|
||||
and the imaginary part for complex values. Storage for holding
|
||||
0, 1 and -1 values are also included.
|
||||
|
||||
The number returned by memsize(x) may be less than the actual number
|
||||
|
4
help/min
4
help/min
@@ -34,9 +34,9 @@ DESCRIPTION
|
||||
and returns a real-number value for any comparison that has to be made,
|
||||
min(x_1, x_2, ...) returns the value determined by min(x_1) = x_1,
|
||||
and succesively for later arguments, by the use of the equivalent of
|
||||
min(a,b) = (a < b) ? a : b. If the ordering determined by < is total,
|
||||
min(a,b) = (a < b) ? a : b. If the ordering determined by < is total,
|
||||
min(x_1, ...) will be the minimum value among the arguments. For a
|
||||
preorder relation it may be one of several minimal values. For other
|
||||
preorder relation it may be one of several minimal values. For other
|
||||
relations, it may be difficult to predict the result.
|
||||
|
||||
EXAMPLE
|
||||
|
12
help/minv
12
help/minv
@@ -6,7 +6,7 @@ SYNOPSIS
|
||||
|
||||
TYPES
|
||||
x integer
|
||||
md integer
|
||||
md integer
|
||||
|
||||
return integer
|
||||
|
||||
@@ -22,11 +22,11 @@ DESCRIPTION
|
||||
0 0 < v < md md < v < 0
|
||||
1 -md < v < 0 0 < v < -md
|
||||
4 0 < v < md 0 < v < -md
|
||||
5 -md < v < 0 md < v < 0
|
||||
16 -md/2 < v <= md/2 md/2 <= v < -md/2
|
||||
17 -md/2 <= v < md/2 md/2 < v <= -md/2
|
||||
20 -md/2 < v <= md/2 md/2 < v <= -md/2
|
||||
21 -md/2 <= v < md/2 md/2 <= v < -md/2
|
||||
5 -md < v < 0 md < v < 0
|
||||
16 -md/2 < v <= md/2 md/2 <= v < -md/2
|
||||
17 -md/2 <= v < md/2 md/2 < v <= -md/2
|
||||
20 -md/2 < v <= md/2 md/2 < v <= -md/2
|
||||
21 -md/2 <= v < md/2 md/2 <= v < -md/2
|
||||
|
||||
EXAMPLE
|
||||
> c = config("mod", 0)
|
||||
|
@@ -6,7 +6,7 @@ SYNOPSIS
|
||||
|
||||
TYPES
|
||||
x number (real or complex), matrix, list, object
|
||||
md real
|
||||
md real
|
||||
|
||||
return real
|
||||
|
||||
|
6
help/mod
6
help/mod
@@ -44,10 +44,10 @@ DESCRIPTION
|
||||
(Blank entries indicate that the description would be complicated
|
||||
and probably not of much interest.)
|
||||
|
||||
rnd & 15 sign of r parity of q
|
||||
rnd & 15 sign of r parity of q
|
||||
|
||||
0 sgn(y)
|
||||
1 -sgn(y)
|
||||
1 -sgn(y)
|
||||
2 sgn(x)
|
||||
3 -sgn(x)
|
||||
4 +
|
||||
@@ -55,7 +55,7 @@ DESCRIPTION
|
||||
6 sgn(x/y)
|
||||
7 -sgn(x/y)
|
||||
8 even
|
||||
9 odd
|
||||
9 odd
|
||||
10 even if x/y > 0, otherwise odd
|
||||
11 odd if x/y > 0, otherwise even
|
||||
12 even if y > 0, otherwise odd
|
||||
|
@@ -43,7 +43,7 @@ DESCRIPTION
|
||||
|
||||
RUNTIME
|
||||
The runtime for v = nextcand(n, ...) will depend strongly on the
|
||||
number and nature of the integers between n and v. If this number
|
||||
number and nature of the integers between n and v. If this number
|
||||
is reasonably large the size of count is largely irrelevant as the
|
||||
compositeness of the numbers between n and v will usually be
|
||||
determined by the test for small prime factors or one pseudoprime
|
||||
|
@@ -17,7 +17,7 @@ TYPES
|
||||
DESCRIPTION
|
||||
For real x, norm(x) returns:
|
||||
|
||||
x^2.
|
||||
x^2.
|
||||
|
||||
For complex x, norm(x) returns:
|
||||
|
||||
|
@@ -5,7 +5,7 @@ SYNOPSIS
|
||||
null([v_1, v_2,...])
|
||||
|
||||
TYPES
|
||||
v_1, v_2,... any
|
||||
v_1, v_2,... any
|
||||
return null
|
||||
|
||||
DESCRIPTION
|
||||
|
@@ -15,7 +15,7 @@ Using objects
|
||||
where D is a fixed integer, and 'a' and 'b' are arbitrary rational
|
||||
numbers. Addition, subtraction, multiplication, and division can be
|
||||
performed on such numbers, and the result can be put unambiguously
|
||||
into the same form. (Complex numbers are an example of surds, where
|
||||
into the same form. (Complex numbers are an example of surds, where
|
||||
D is -1.)
|
||||
|
||||
The "obj" statement defines either an object type or an actual
|
||||
@@ -53,8 +53,8 @@ Using objects
|
||||
called.
|
||||
|
||||
The user function is called with the necessary arguments for that
|
||||
operation. For example, for "surd_mul", there are two arguments,
|
||||
which are the two numbers. The order of the arguments is always
|
||||
operation. For example, for "surd_mul", there are two arguments,
|
||||
which are the two numbers. The order of the arguments is always
|
||||
the order of the binary operands. If only one of the operands to
|
||||
a binary operator is an object, then the user function for that
|
||||
object type is still called. If the two operands are of different
|
||||
@@ -64,7 +64,7 @@ Using objects
|
||||
The above rules mean that for full generality, user functions
|
||||
should detect that one of their arguments is not of its own object
|
||||
type by using the 'istype' function, and then handle these cases
|
||||
specially. In this way, users can mix normal numbers with object
|
||||
specially. In this way, users can mix normal numbers with object
|
||||
types. (Functions which only have one operand don't have to worry
|
||||
about this.) The following example of "surd_mul" demonstrates how
|
||||
to handle regular numbers when used together with surds:
|
||||
@@ -88,13 +88,13 @@ Using objects
|
||||
x.b = a.a * b.b + a.b * b.a;
|
||||
}
|
||||
if (x.b == 0)
|
||||
return x.a; /* normal number */
|
||||
return x.a; /* normal number */
|
||||
return x; /* return surd */
|
||||
}
|
||||
|
||||
In order to print the value of an object nicely, a user defined
|
||||
routine can be provided. For small amounts of output, the print
|
||||
routine should not print a newline. Also, it is most convenient
|
||||
routine should not print a newline. Also, it is most convenient
|
||||
if the printed object looks like the call to the creation routine.
|
||||
For output to be correctly collected within nested output calls,
|
||||
output should only go to stdout. This means use the 'print'
|
||||
@@ -121,50 +121,50 @@ Using objects
|
||||
in order to make object calls quicker in general.
|
||||
|
||||
The double-bracket operator can be used to reference the elements
|
||||
of any object in a generic manner. When this is done, index 0
|
||||
of any object in a generic manner. When this is done, index 0
|
||||
corresponds to the first element name, index 1 to the second name,
|
||||
and so on. The 'size' function will return the number of elements
|
||||
and so on. The 'size' function will return the number of elements
|
||||
in an object.
|
||||
|
||||
The following is a list of the operations possible for objects.
|
||||
The 'xx' in each function name is replaced with the actual object
|
||||
type name. This table is displayed by the 'show objfuncs' command.
|
||||
type name. This table is displayed by the 'show objfuncs' command.
|
||||
|
||||
Name Args Comments
|
||||
|
||||
xx_print 1 print value, default prints elements
|
||||
xx_one 1 multiplicative identity, default is 1
|
||||
xx_test 1 logical test (false,true => 0,1),
|
||||
xx_print 1 print value, default prints elements
|
||||
xx_one 1 multiplicative identity, default is 1
|
||||
xx_test 1 logical test (false,true => 0,1),
|
||||
default tests elements
|
||||
xx_add 2
|
||||
xx_sub 2 subtraction, default adds negative
|
||||
xx_neg 1 negative
|
||||
xx_mul 2
|
||||
xx_div 2 non-integral division, default multiplies
|
||||
xx_add 2
|
||||
xx_sub 2 subtraction, default adds negative
|
||||
xx_neg 1 negative
|
||||
xx_mul 2
|
||||
xx_div 2 non-integral division, default multiplies
|
||||
by inverse
|
||||
xx_inv 1 multiplicative inverse
|
||||
xx_abs 2 absolute value within given error
|
||||
xx_norm 1 square of absolute value
|
||||
xx_conj 1 conjugate
|
||||
xx_pow 2 integer power, default does multiply,
|
||||
xx_inv 1 multiplicative inverse
|
||||
xx_abs 2 absolute value within given error
|
||||
xx_norm 1 square of absolute value
|
||||
xx_conj 1 conjugate
|
||||
xx_pow 2 integer power, default does multiply,
|
||||
square, inverse
|
||||
xx_sgn 1 sign of value (-1, 0, 1)
|
||||
xx_cmp 2 equality (equal,non-equal => 0,1),
|
||||
xx_sgn 1 sign of value (-1, 0, 1)
|
||||
xx_cmp 2 equality (equal,non-equal => 0,1),
|
||||
default tests elements
|
||||
xx_rel 2 inequality (less,equal,greater => -1,0,1)
|
||||
xx_quo 2 integer quotient
|
||||
xx_mod 2 remainder of division
|
||||
xx_int 1 integer part
|
||||
xx_frac 1 fractional part
|
||||
xx_inc 1 increment, default adds 1
|
||||
xx_dec 1 decrement, default subtracts 1
|
||||
xx_square 1 default multiplies by itself
|
||||
xx_scale 2 multiply by power of 2
|
||||
xx_shift 2 shift left by n bits (right if negative)
|
||||
xx_round 2 round to given number of decimal places
|
||||
xx_bround 2 round to given number of binary places
|
||||
xx_root 3 root of value within given error
|
||||
xx_sqrt 2 square root within given error
|
||||
xx_rel 2 inequality (less,equal,greater => -1,0,1)
|
||||
xx_quo 2 integer quotient
|
||||
xx_mod 2 remainder of division
|
||||
xx_int 1 integer part
|
||||
xx_frac 1 fractional part
|
||||
xx_inc 1 increment, default adds 1
|
||||
xx_dec 1 decrement, default subtracts 1
|
||||
xx_square 1 default multiplies by itself
|
||||
xx_scale 2 multiply by power of 2
|
||||
xx_shift 2 shift left by n bits (right if negative)
|
||||
xx_round 2 round to given number of decimal places
|
||||
xx_bround 2 round to given number of binary places
|
||||
xx_root 3 root of value within given error
|
||||
xx_sqrt 2 square root within given error
|
||||
xx_or 2 boolean or
|
||||
xx_and 2 boolean and
|
||||
xx_not 1 boolean not
|
||||
|
@@ -12,7 +12,7 @@ DESCRIPTION
|
||||
which at top level when directly from a file or keyboard
|
||||
is automatically assigned the saved value for a line
|
||||
of statements when evaluation of that line is completed and this saved
|
||||
value is not null. A line of statements is normally completed by a
|
||||
value is not null. A line of statements is normally completed by a
|
||||
'\n' not within a block bounded by braces or an expression bounded by
|
||||
parentheses.
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
operators
|
||||
|
||||
The operators are similar to C, but there are some differences in
|
||||
the associativity and precedence rules for some operators. In
|
||||
the associativity and precedence rules for some operators. In
|
||||
addition, there are several operators not in C, and some C
|
||||
operators are missing. A more detailed discussion of situations
|
||||
that may be unexpected for the C programmer may be found in
|
||||
@@ -64,7 +64,7 @@ operators
|
||||
E.g., if A is a matrix, A[(a, b), c] evaluates a, b, and c, and
|
||||
returns the value of A[b, c].
|
||||
|
||||
+= -= *= /= %= //= &= |= <<= >>= ^= **=
|
||||
+= -= *= /= %= //= &= |= <<= >>= ^= **=
|
||||
Operator-with-assignments.
|
||||
These associate from left to right, e.g. a += b *= c has the
|
||||
effect of a = (a + b) * c, where only a is required to be an
|
||||
@@ -76,7 +76,7 @@ operators
|
||||
e.g. a = b = c has the effect of a = (b = c). Here both a and b
|
||||
are to be lvalues.
|
||||
|
||||
? : Conditional value.
|
||||
? : Conditional value.
|
||||
a ? b : c returns b if a tests as true (i.e. nonzero if
|
||||
a is a number), c otherwise. Thus it is equivalent to:
|
||||
if (a) return b; else return c;.
|
||||
@@ -99,7 +99,7 @@ operators
|
||||
true, b is returned, otherwise a. The effect in a
|
||||
test like "if (a && b) ... " is the same as in C.
|
||||
|
||||
== != <= >= < >
|
||||
== != <= >= < >
|
||||
Relations.
|
||||
|
||||
+ -
|
||||
@@ -134,7 +134,7 @@ operators
|
||||
|
||||
For the shift operators both arguments are to be
|
||||
integers, or if the first is complex, it is to have
|
||||
integral real and imaginary parts. Changing the
|
||||
integral real and imaginary parts. Changing the
|
||||
sign of the second argument reverses the shift, e.g.
|
||||
a >> -b = a << b. The result has the same sign as
|
||||
the first argument except that a nonzero value is
|
||||
@@ -143,8 +143,8 @@ operators
|
||||
e.g. a << b ^ c = a << (b ^ c).
|
||||
|
||||
+ - !
|
||||
Plus (+) and minus (-) have their usual meanings as unary
|
||||
prefix operators at this level of precedence when applied to
|
||||
Plus (+) and minus (-) have their usual meanings as unary
|
||||
prefix operators at this level of precedence when applied to
|
||||
other than a first or only term.
|
||||
|
||||
As a prefix operator, '!' is the logical NOT: !a returns 0 if
|
||||
@@ -156,13 +156,13 @@ operators
|
||||
As a postfix operator ! gives the factorial function, i.e.
|
||||
a! = fact(a).
|
||||
|
||||
++ --
|
||||
++ --
|
||||
Pre or post incrementing or decrementing.
|
||||
These are applicable only to variables.
|
||||
|
||||
[ ] [[ ]] . ( )
|
||||
[ ] [[ ]] . ( )
|
||||
Indexing, double-bracket indexing, element references,
|
||||
and function calls. Indexing can only be applied to matrices,
|
||||
and function calls. Indexing can only be applied to matrices,
|
||||
element references can only be applied to objects, but
|
||||
double-bracket indexing can be applied to matrices, objects,
|
||||
or lists.
|
||||
@@ -199,7 +199,7 @@ operators
|
||||
| &
|
||||
Both both arguments must be integers.
|
||||
|
||||
<< >>
|
||||
<< >>
|
||||
The shift amount must be an integer. The value being
|
||||
shifted must be an integer or a complex number with
|
||||
integral real and imaginary parts.
|
||||
|
@@ -6,13 +6,13 @@
|
||||
All numbers are represented as fractions with arbitrarily large
|
||||
numerators and denominators which are always reduced to lowest terms.
|
||||
Real or exponential format numbers can be input and are converted
|
||||
to the equivalent fraction. Hex, binary, or octal numbers can be
|
||||
to the equivalent fraction. Hex, binary, or octal numbers can be
|
||||
input by using numbers with leading '0x', '0b' or '0' characters.
|
||||
Complex numbers can be input using a trailing 'i', as in '2+3i'.
|
||||
Strings and characters are input by using single or double quotes.
|
||||
|
||||
Commands are statements in a C-like language, where each input
|
||||
line is treated as the body of a procedure. Thus the command
|
||||
line is treated as the body of a procedure. Thus the command
|
||||
line can contain variable declarations, expressions, labels,
|
||||
conditional tests, and loops. Assignments to any variable name
|
||||
will automatically define that name as a global variable. The
|
||||
@@ -20,7 +20,7 @@
|
||||
which are evaluated are automatically printed. Thus, you can evaluate
|
||||
an expression's value by simply typing it in.
|
||||
|
||||
Many useful built-in mathematical functions are available. Use
|
||||
Many useful built-in mathematical functions are available. Use
|
||||
the 'show builtins' command to list them. You can also define
|
||||
your own functions by using the 'define' keyword, followed by a
|
||||
function declaration very similar to C. Functions which only
|
||||
@@ -29,7 +29,7 @@
|
||||
Variables in functions can be defined as either 'global', 'local',
|
||||
or 'static'. Global variables are common to all functions and the
|
||||
command line, whereas local variables are unique to each function
|
||||
level, and are destroyed when the function returns. Static variables
|
||||
level, and are destroyed when the function returns. Static variables
|
||||
are scoped within single input files, or within functions, and are
|
||||
never destroyed. Variables are not typed at definition time, but
|
||||
dynamically change as they are used. So you must supply the correct
|
||||
@@ -80,7 +80,7 @@
|
||||
help full
|
||||
|
||||
By default, arguments to functions are passed by value (even
|
||||
matrices). For speed, you can put an ampersand before any
|
||||
matrices). For speed, you can put an ampersand before any
|
||||
variable argument in a function call, and that variable will be
|
||||
passed by reference instead. However, if the function changes
|
||||
its argument, the variable will change. Arguments to built-in
|
||||
@@ -117,17 +117,17 @@
|
||||
example 'x.real'. All user-defined routines have names composed
|
||||
of the object type and the action to perform separated by an
|
||||
underscore, as in the example 'complex_add'. The command 'show
|
||||
objfuncs' lists all the definable routines. Object routines
|
||||
objfuncs' lists all the definable routines. Object routines
|
||||
which accept two arguments should be prepared to handle cases
|
||||
in which either one of the arguments is not of the expected
|
||||
object type.
|
||||
|
||||
These are the differences between the normal C operators and
|
||||
the ones defined by the calculator. The '/' operator divides
|
||||
the ones defined by the calculator. The '/' operator divides
|
||||
fractions, so that '7 / 2' evaluates to 7/2. The '//' operator
|
||||
is an integer divide, so that '7 // 2' evaluates to 3. The '^'
|
||||
operator is a integral power function, so that 3^4 evaluates to
|
||||
81. Matrices of any dimension can be treated as a zero based
|
||||
81. Matrices of any dimension can be treated as a zero based
|
||||
linear array using double square brackets, as in 'foo[[3]]'.
|
||||
Matrices can be indexed by using commas between the indices, as
|
||||
in foo[3,4]. Object and list elements can be referenced by
|
||||
@@ -144,10 +144,10 @@
|
||||
affect calculations or the display of values. For example, the
|
||||
output display mode can be set using 'config(\"mode\", type)',
|
||||
where 'type' is one of 'frac', 'int', 'real', 'exp', 'hex',
|
||||
'oct', or 'bin'. The default output mode is real. For the
|
||||
'oct', or 'bin'. The default output mode is real. For the
|
||||
integer, real, or exponential formats, a leading '~' indicates
|
||||
that the number was truncated to the number of decimal places
|
||||
specified by the default precision. If the '~' does not
|
||||
specified by the default precision. If the '~' does not
|
||||
appear, then the displayed number is the exact value.
|
||||
|
||||
The number of decimal places printed is set by using
|
||||
|
10
help/pmod
10
help/pmod
@@ -25,11 +25,11 @@ DESCRIPTION
|
||||
0 0 < v < md md < v < 0
|
||||
1 -md < v < 0 0 < v < -md
|
||||
4 0 < v < md 0 < v < -md
|
||||
5 -md < v < 0 md < v < 0
|
||||
16 -md/2 < v <= md/2 md/2 <= v < -md/2
|
||||
17 -md/2 <= v < md/2 md/2 < v <= -md/2
|
||||
20 -md/2 < v <= md/2 md/2 < v <= -md/2
|
||||
21 -md/2 <= v < md/2 md/2 <= v < -md/2
|
||||
5 -md < v < 0 md < v < 0
|
||||
16 -md/2 < v <= md/2 md/2 <= v < -md/2
|
||||
17 -md/2 <= v < md/2 md/2 < v <= -md/2
|
||||
20 -md/2 < v <= md/2 md/2 < v <= -md/2
|
||||
21 -md/2 <= v < md/2 md/2 <= v < -md/2
|
||||
|
||||
EXAMPLE
|
||||
> c = config("mod",0)
|
||||
|
@@ -6,7 +6,7 @@ SYNOPSIS
|
||||
|
||||
TYPES
|
||||
r real
|
||||
t real
|
||||
t real
|
||||
eps nonzero real, defaults to epsilon()
|
||||
|
||||
return number (real or complex)
|
||||
|
10
help/poly
10
help/poly
@@ -24,7 +24,7 @@ TYPES
|
||||
|
||||
Here an arithmetic type is one for which the required + and *
|
||||
operations are defined, e.g. real or complex numbers or square
|
||||
matrices of the same size. A coefficient is either of arithmetic
|
||||
matrices of the same size. A coefficient is either of arithmetic
|
||||
type or a list of coefficients.
|
||||
|
||||
DESCRIPTION
|
||||
@@ -48,11 +48,11 @@ DESCRIPTION
|
||||
|
||||
In particular:
|
||||
|
||||
poly(a, x) returns the value of a.
|
||||
poly(a, x) returns the value of a.
|
||||
|
||||
poly(a, b, x) returns the value of b + a * x
|
||||
poly(a, b, x) returns the value of b + a * x
|
||||
|
||||
poly(a, b, c, x) returns the value of c + (b + a * x) * x
|
||||
poly(a, b, c, x) returns the value of c + (b + a * x) * x
|
||||
|
||||
|
||||
If the first argument is a list as if defined by:
|
||||
@@ -90,7 +90,7 @@ DESCRIPTION
|
||||
|
||||
returns the same as poly(list(1,2,3), x). If the number of
|
||||
arguments is less than greatest depth of lists in clist, the
|
||||
"missing" arguments are deemed to be zero. E.g.:
|
||||
"missing" arguments are deemed to be zero. E.g.:
|
||||
|
||||
poly(list(list(1,2), list(3,4), 5), x)
|
||||
|
||||
|
@@ -45,7 +45,7 @@ DESCRIPTION
|
||||
|
||||
RUNTIME
|
||||
The runtime for v = prevcand(n, ...) will depend strongly on the
|
||||
number and nature of the integers between n and v. If this number
|
||||
number and nature of the integers between n and v. If this number
|
||||
is reasonably large the size of count is largely irrelevant as the
|
||||
compositeness of the numbers between n and v will usually be
|
||||
determined by the test for small prime factors or one pseudoprime
|
||||
|
@@ -60,14 +60,14 @@ DESCRIPTION
|
||||
number of format specifiers in fmt, the "missing" arguments
|
||||
may be taken to be null values - these contribute nothing to the
|
||||
output; if a positive width w has been specified, the effect is
|
||||
to produce w spaces, e.g. printf("abc%6dxyz") prints "abc xyz".
|
||||
to produce w spaces, e.g. printf("abc%6dxyz") prints "abc xyz".
|
||||
|
||||
If i <= the number of specifiers in fmt, the value of argument x_i
|
||||
is printed in the format specified by the i-th specifier.
|
||||
If a positive width w has been specified and normal printing of x_i
|
||||
does not include a '\n' character, what is printed will if necessary
|
||||
be padded with spaces so that the length of the printed output
|
||||
is at least the w. Note that control
|
||||
is at least the w. Note that control
|
||||
characters like '\t', '\b' each count as one character. If
|
||||
the 'right-pad' flag has been set, the padding is on the right;
|
||||
otherwise it is on the left.
|
||||
@@ -79,13 +79,13 @@ DESCRIPTION
|
||||
|
||||
If the i-th specifier is of numerical type, any numbers in the
|
||||
printing of x_i will be printed in the specified format, unless
|
||||
this is modified by the printing procedure for x_i's type. Any
|
||||
this is modified by the printing procedure for x_i's type. Any
|
||||
specified precision will be ignored except for floating-point
|
||||
mode.
|
||||
|
||||
In the case of floating-point (f) format the precision determines
|
||||
the maximum number of decimal places to be
|
||||
displayed. Other aspects of this printing may be affected by the
|
||||
displayed. Other aspects of this printing may be affected by the
|
||||
configuration parameters "outround", "tilde", "fullzero", "leadzero".
|
||||
|
||||
EXAMPLE
|
||||
|
@@ -19,13 +19,13 @@ EXAMPLE
|
||||
> x = prompt("? ");
|
||||
? 273
|
||||
> x
|
||||
"273"
|
||||
"273"
|
||||
|
||||
> for (;;) {s = prompt("? "); if (s=="end") break; print "\t":eval(s)^2;}
|
||||
? 3
|
||||
9
|
||||
9
|
||||
? 2 + 3
|
||||
25
|
||||
25
|
||||
? end
|
||||
>
|
||||
|
||||
|
@@ -17,7 +17,7 @@ DESCRIPTION
|
||||
protection status for var or nblk.
|
||||
|
||||
With two arguments, protect(var, sts) or protect(nblk, sts) sets the
|
||||
protection status for var or nblk to the value sts. Each nonzero bit
|
||||
protection status for var or nblk to the value sts. Each nonzero bit
|
||||
of sts corresponds to one kind of protection as follows:
|
||||
|
||||
sts protection
|
||||
@@ -42,7 +42,7 @@ DESCRIPTION
|
||||
|
||||
protect(A, 1);
|
||||
|
||||
an error state is established if A = expr is attempted. It does
|
||||
an error state is established if A = expr is attempted. It does
|
||||
not imply constancy if, for example, the current value of A is a list
|
||||
or matrix; such a value may be changed by assignments to the elements
|
||||
of A, or by push or copy commands.
|
||||
@@ -169,7 +169,7 @@ EXAMPLE
|
||||
|
||||
mat [2] (2 elements, 1 nonzero):
|
||||
[0] = 0
|
||||
[1] = 4
|
||||
[1] = 4
|
||||
|
||||
> A = blk("alpha") = {1,2,3,4}
|
||||
> protect(A, 0)
|
||||
|
@@ -55,7 +55,7 @@ DESCRIPTION
|
||||
For the random case (skip = 0), the probability that any one test
|
||||
with random base b will return 1 if n is composite is always
|
||||
less than 1/4, so with count = k, the probability is less
|
||||
than 1/4^k. For most values of n the probability is much
|
||||
than 1/4^k. For most values of n the probability is much
|
||||
smaller, possible zero.
|
||||
|
||||
RUNTIME
|
||||
@@ -77,7 +77,7 @@ RUNTIME
|
||||
|
||||
If the word-count for n is less than conf("redc2"), REDC algorithms
|
||||
are used in evaluating ptest(n, count, skip) when small-factor
|
||||
cases have been eliminated. For small word-counts (say < 10)
|
||||
cases have been eliminated. For small word-counts (say < 10)
|
||||
this may more than double the speed of evaluation compared with
|
||||
the standard algorithms.
|
||||
|
||||
@@ -114,7 +114,7 @@ EXAMPLE
|
||||
|
||||
These results show that a is a strong pseudoprime for all 11 prime
|
||||
bases less than or equal to 31, and for all positive integer bases
|
||||
less than or equal to 21, but not for the bases 37 and 22. The
|
||||
less than or equal to 21, but not for the bases 37 and 22. The
|
||||
probability that ptest(a,-1,0) (or ptest(a,1,0)) will return 1 is
|
||||
about 0.19.
|
||||
|
||||
|
6
help/quo
6
help/quo
@@ -35,10 +35,10 @@ DESCRIPTION
|
||||
one of the two integers v for which abs(x/y - v) < 1. Which
|
||||
integer is returned is controlled by rnd as follows:
|
||||
|
||||
rnd sign of x/y - v Description of rounding
|
||||
rnd sign of x/y - v Description of rounding
|
||||
|
||||
0 + down, towards minus infinity
|
||||
1 - up, towards infinity
|
||||
0 + down, towards minus infinity
|
||||
1 - up, towards infinity
|
||||
2 sgn(x/y) towards zero
|
||||
3 -sgn(x/y) from zero
|
||||
4 sgn(y)
|
||||
|
@@ -14,7 +14,7 @@ TYPES
|
||||
|
||||
DESCRIPTION
|
||||
Returns 0 or 1 according as x is or is not a multiple of y.
|
||||
Let x = q * y + r where q is an integer and 0 <= r < y
|
||||
Let x = q * y + r where q is an integer and 0 <= r < y
|
||||
This function assigns the values q and r to the variables
|
||||
Q and R. If x >= 0, the results for Q and R are the same as
|
||||
those given by Q = x // y, R = x % y.
|
||||
@@ -39,4 +39,4 @@ LIBRARY
|
||||
BOOL qquomod(NUMBER *q1, NUMBER *q2, NUMBER **retqdiv, NUMBER **retqmod)
|
||||
|
||||
SEE ALSO
|
||||
//, %
|
||||
//, %
|
||||
|
20
help/rand
20
help/rand
@@ -19,7 +19,7 @@ DESCRIPTION
|
||||
pseudo-random generator. If you need a fast generator and do not
|
||||
need a cryptographically strong one, this generator is likely to do
|
||||
the job. Casual direct use of the shuffle generator may be
|
||||
acceptable. For a much higher quality cryptographically strong
|
||||
acceptable. For a much higher quality cryptographically strong
|
||||
(but slower) generator use the Blum-Blum-Shub generator (see the
|
||||
random help page).
|
||||
|
||||
@@ -55,9 +55,9 @@ DESCRIPTION
|
||||
by Knuth, Vol 2, 2nd edition (1981), Section 3.2.2, page 32,
|
||||
Algorithm B.
|
||||
|
||||
The rand generator has a good period, and is fast. It is reasonable as
|
||||
The rand generator has a good period, and is fast. It is reasonable as
|
||||
generators go, though there are better ones available. The shuffle
|
||||
method has a very good period, and is fast. It is fairly good as
|
||||
method has a very good period, and is fast. It is fairly good as
|
||||
generators go, particularly when it is feed reasonably random
|
||||
numbers. Because of this, we use feed values from the additive 55
|
||||
method into the shuffle method.
|
||||
@@ -120,7 +120,7 @@ DESCRIPTION
|
||||
perceptions that are noted above.
|
||||
|
||||
It should be noted that the purpose of randreseed64 is to scramble a
|
||||
seed ONLY. We do not care if these generators produce good random
|
||||
seed ONLY. We do not care if these generators produce good random
|
||||
numbers. We only want to help eliminate the human factors & perceptions
|
||||
noted above.
|
||||
|
||||
@@ -144,8 +144,8 @@ DESCRIPTION
|
||||
|
||||
We will select the randreseed64 multiplier 'a' such that:
|
||||
|
||||
a mod 8 == 5 (based on note iii)
|
||||
0.01*m < a < 0.99*m (based on note iv)
|
||||
a mod 8 == 5 (based on note iii)
|
||||
0.01*m < a < 0.99*m (based on note iv)
|
||||
0.01*2^64 < a < 0.99*2^64
|
||||
a is prime (help keep the generators independent)
|
||||
|
||||
@@ -159,10 +159,10 @@ DESCRIPTION
|
||||
gcd(a, c) == 1 (adders & multipliers will be more independent)
|
||||
|
||||
The values 'a' and 'c for randreseed64 are taken from the Rand book
|
||||
of numbers. Because m=2^64 is 20 decimal digits long, we will
|
||||
of numbers. Because m=2^64 is 20 decimal digits long, we will
|
||||
search the Rand book of numbers 20 at a time. We will skip any of
|
||||
the 55 values that were used to initialize the additive 55
|
||||
generators. The values obtained from the Rand book are:
|
||||
generators. The values obtained from the Rand book are:
|
||||
|
||||
a = 6316878969928993981
|
||||
c = 1363042948800878693
|
||||
@@ -180,12 +180,12 @@ DESCRIPTION
|
||||
One might object to the complexity of the seed scramble/mapping via
|
||||
the randreseed64 process. But Calling srand(0) with the randreseed64
|
||||
process would be the same as calling srand(10239951819489363767)
|
||||
without it. No extra security is gained or reduced by using the
|
||||
without it. No extra security is gained or reduced by using the
|
||||
randreseed64 process. The meaning of seeds are exchanged, but not
|
||||
lost or favored (used by more than one input seed).
|
||||
|
||||
The randreseed64 process does not reduce the security of the rand
|
||||
generator. Every seed is converted into a different unique seed.
|
||||
generator. Every seed is converted into a different unique seed.
|
||||
No seed is ignored or favored.
|
||||
|
||||
The truly paranoid might suggest that my claims in the MAGIC NUMBERS
|
||||
|
@@ -11,7 +11,7 @@ TYPES
|
||||
|
||||
DESCRIPTION
|
||||
If x > 0, randbit(x) returns a pseudo-random integer in [0, 2^x),
|
||||
i.e. the same as rand(2^x). If the integer returned is
|
||||
i.e. the same as rand(2^x). If the integer returned is
|
||||
|
||||
b_1 * 2^(x-1) + b_2 * 2^(x-2) + ... + b_n,
|
||||
|
||||
|
12
help/random
12
help/random
@@ -25,7 +25,7 @@ DESCRIPTION
|
||||
random() Same as rand(0, 2^64)
|
||||
random(max) Same as rand(0, max)
|
||||
|
||||
The random generator generates the highest order bit first. Thus:
|
||||
The random generator generates the highest order bit first. Thus:
|
||||
|
||||
random(256)
|
||||
|
||||
@@ -37,7 +37,7 @@ DESCRIPTION
|
||||
|
||||
The basic idea behind the Blum-Blum-Shub generator is to use
|
||||
the low bit bits of quadratic residues modulo a product of
|
||||
two 3 mod 4 primes. The lowest int(log2(log2(p*q))) bits are used
|
||||
two 3 mod 4 primes. The lowest int(log2(log2(p*q))) bits are used
|
||||
where log2() is log base 2 and p,q are two primes 3 mod 4.
|
||||
|
||||
The Blum-Blum-Shub generator is described in the papers:
|
||||
@@ -52,7 +52,7 @@ DESCRIPTION
|
||||
|
||||
U. V. Vazirani and V. V. Vazirani, "Trapdoor Pseudo-Random
|
||||
Number Generators with Applications to Protocol Design",
|
||||
Proceedings of the 24th IEEE Symposium on the Foundations
|
||||
Proceedings of the 24th IEEE Symposium on the Foundations
|
||||
of Computer Science, 1983, pp. 23-30.
|
||||
|
||||
U. V. Vazirani and V. V. Vazirani, "Efficient and Secure
|
||||
@@ -71,7 +71,7 @@ DESCRIPTION
|
||||
1st edition (1994), pp 365-366.
|
||||
|
||||
This generator is considered 'strong' in that it passes all
|
||||
polynomial-time statistical tests. The sequences produced are
|
||||
polynomial-time statistical tests. The sequences produced are
|
||||
random in an absolutely precise way. There is absolutely no better
|
||||
way to predict the sequence than by tossing a coin (as with TRULY
|
||||
random numbers) EVEN IF YOU KNOW THE MODULUS! Furthermore, having
|
||||
@@ -86,7 +86,7 @@ DESCRIPTION
|
||||
|
||||
To compromise the generator, an adversary must either factor the
|
||||
modulus or perform an exhaustive search just to determine the next
|
||||
(or previous) bit. If we make the modulus hard to factor (such as
|
||||
(or previous) bit. If we make the modulus hard to factor (such as
|
||||
the product of two large well chosen primes) breaking the sequence
|
||||
could be intractable for todays computers and methods.
|
||||
|
||||
@@ -130,7 +130,7 @@ DESCRIPTION
|
||||
is given in the source. While this does not reduce the quality
|
||||
of the generator, knowing the factors of the Blum modulus would
|
||||
help someone determine the next or previous bit when they did
|
||||
not know the seed. If this bothers you, feel free to use one
|
||||
not know the seed. If this bothers you, feel free to use one
|
||||
of the other compiled in Blum moduli or provide your own. See
|
||||
the srandom help page for details.
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user