mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
Release calc version 2.12.2.2
This commit is contained in:
@@ -18,8 +18,8 @@
|
||||
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# @(#) $Revision: 30.4 $
|
||||
# @(#) $Id: Makefile,v 30.4 2007/09/02 05:49:56 chongo Exp $
|
||||
# @(#) $Revision: 30.5 $
|
||||
# @(#) $Id: Makefile,v 30.5 2007/09/21 01:27:27 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/help/RCS/Makefile,v $
|
||||
#
|
||||
# Under source code control: 1991/07/23 06:47:57
|
||||
@@ -111,9 +111,6 @@ CALC_SHAREDIR= /usr/share/calc
|
||||
# ---------------------------------------------------------------
|
||||
# ${HELPDIR} where the help directory is installed
|
||||
# ${CALC_INCDIR} where the calc include files are installed
|
||||
# ${CUSTOMCALDIR} where custom *.cal files are installed
|
||||
# ${CUSTOMHELPDIR} where custom help files are installed
|
||||
# ${CUSTOMINCPDIR} where custom .h files are installed
|
||||
# ${SCRIPTDIR} where calc shell scripts are installed
|
||||
#
|
||||
# NOTE: The install rule prepends installation paths with ${T}, which
|
||||
@@ -124,16 +121,10 @@ CALC_SHAREDIR= /usr/share/calc
|
||||
#
|
||||
# HELPDIR= ${CALC_SHAREDIR}/help
|
||||
# CALC_INCDIR= ${INCDIR}/calc
|
||||
# CUSTOMCALDIR= ${CALC_SHAREDIR}/custom
|
||||
# CUSTOMHELPDIR= ${CALC_SHAREDIR}/custhelp
|
||||
# CUSTOMINCDIR= ${CALC_INCDIR}/custom
|
||||
# SCRIPTDIR= ${BINDIR}/cscript
|
||||
#
|
||||
HELPDIR= ${CALC_SHAREDIR}/help
|
||||
CALC_INCDIR= ${INCDIR}/calc
|
||||
CUSTOMCALDIR= ${CALC_SHAREDIR}/custom
|
||||
CUSTOMHELPDIR= ${CALC_SHAREDIR}/custhelp
|
||||
CUSTOMINCDIR= ${CALC_INCDIR}/custom
|
||||
SCRIPTDIR= ${BINDIR}/cscript
|
||||
|
||||
# T - top level directory under which calc will be installed
|
||||
|
@@ -600,7 +600,9 @@ DESCRIPTION
|
||||
|
||||
6 Report on rand() subtractive 100 shuffle generator issues.
|
||||
|
||||
Bits >= 7 are reserved for future use and should not be used at this time.
|
||||
7 Report on custom function issues.
|
||||
|
||||
Bits >= 8 are reserved for future use and should not be used at this time.
|
||||
|
||||
By default, "calc_debug" is 0. The initial value may be overridden
|
||||
by the -D command line option.
|
||||
@@ -972,8 +974,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## @(#) $Revision: 30.2 $
|
||||
## @(#) $Id: config,v 30.2 2007/07/05 17:37:41 chongo Exp $
|
||||
## @(#) $Revision: 30.3 $
|
||||
## @(#) $Id: config,v 30.3 2007/09/21 01:27:27 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/config,v $
|
||||
##
|
||||
## Under source code control: 1991/07/21 04:37:17
|
||||
|
25
help/rand
25
help/rand
@@ -2,18 +2,21 @@ NAME
|
||||
rand - subtractive 100 shuffle pseudo-random number generator
|
||||
|
||||
SYNOPSIS
|
||||
rand([[min, ] max])
|
||||
rand([[min, ] beyond])
|
||||
|
||||
TYPES
|
||||
min integer
|
||||
max integer
|
||||
beyond integer
|
||||
|
||||
return integer
|
||||
|
||||
DESCRIPTION
|
||||
Generate a pseudo-random number using an subtractive 100 shuffle generator.
|
||||
We return a pseudo-random number over the half closed interval [min,max).
|
||||
By default, min is 0 and max is 2^64.
|
||||
We return a pseudo-random number over the half closed interval:
|
||||
|
||||
[min,beyond) ((min <= return < beyond))
|
||||
|
||||
By default, min is 0 and beyond is 2^64.
|
||||
|
||||
The shuffle method is fast and serves as a fairly good standard
|
||||
pseudo-random generator. If you need a fast generator and do not
|
||||
@@ -26,7 +29,7 @@ DESCRIPTION
|
||||
Other arg forms:
|
||||
|
||||
rand() Same as rand(0, 2^64)
|
||||
rand(max) Same as rand(0, max)
|
||||
rand(beyond) Same as rand(0, beyond)
|
||||
|
||||
The rand generator generates the highest order bit first. Thus:
|
||||
|
||||
@@ -230,17 +233,17 @@ EXAMPLE
|
||||
2 658186291252503497642116 1 -324097
|
||||
|
||||
LIMITS
|
||||
min < max
|
||||
min < beyond
|
||||
|
||||
LINK LIBRARY
|
||||
void zrand(long cnt, ZVALUE *res)
|
||||
void zrandrange(ZVALUE low, ZVALUE high, ZVALUE *res)
|
||||
long irand(long max)
|
||||
void zrandrange(ZVALUE low, ZVALUE beyond, ZVALUE *res)
|
||||
long irand(long beyond)
|
||||
|
||||
SEE ALSO
|
||||
seed, srand, randbit, isrand, random, srandom, israndom
|
||||
|
||||
## Copyright (C) 1999 Landon Curt Noll
|
||||
## Copyright (C) 1999-2007 Landon Curt Noll
|
||||
##
|
||||
## Calc is open software; you can redistribute it and/or modify it under
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -256,8 +259,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## @(#) $Revision: 30.1 $
|
||||
## @(#) $Id: rand,v 30.1 2007/03/16 11:10:42 chongo Exp $
|
||||
## @(#) $Revision: 30.3 $
|
||||
## @(#) $Id: rand,v 30.3 2007/09/21 02:16:29 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/rand,v $
|
||||
##
|
||||
## Under source code control: 1996/01/01 02:16:09
|
||||
|
27
help/random
27
help/random
@@ -2,18 +2,21 @@ NAME
|
||||
random - Blum-Blum-Shub pseudo-random number generator
|
||||
|
||||
SYNOPSIS
|
||||
random([[min, ] max])
|
||||
random([[min, ] beyond])
|
||||
|
||||
TYPES
|
||||
min integer
|
||||
max integer
|
||||
beyond integer
|
||||
|
||||
return integer
|
||||
|
||||
DESCRIPTION
|
||||
Generate a pseudo-random number using a Blum-Blum-Shub generator.
|
||||
We return a pseudo-random number over the half closed interval [min,max).
|
||||
By default, min is 0 and max is 2^64.
|
||||
We return a pseudo-random number over the half closed interval:
|
||||
|
||||
[min,beyond) ((min <= return < beyond))
|
||||
|
||||
By default, min is 0 and beyond is 2^64.
|
||||
|
||||
While the Blum-Blum-Shub generator is not painfully slow, it is not
|
||||
a fast generator. For a faster, but lesser quality generator
|
||||
@@ -22,8 +25,8 @@ DESCRIPTION
|
||||
|
||||
Other arg forms:
|
||||
|
||||
random() Same as rand(0, 2^64)
|
||||
random(max) Same as rand(0, max)
|
||||
random() Same as random(0, 2^64)
|
||||
random(beyond) Same as random(0, beyond)
|
||||
|
||||
The random generator generates the highest order bit first. Thus:
|
||||
|
||||
@@ -146,17 +149,17 @@ EXAMPLE
|
||||
10 483381144668580304003305 0 -70235
|
||||
|
||||
LIMITS
|
||||
min < max
|
||||
min < beyond
|
||||
|
||||
LINK LIBRARY
|
||||
void zrandom(long cnt, ZVALUE *res)
|
||||
void zrandomrange(ZVALUE low, ZVALUE high, ZVALUE *res)
|
||||
long irandom(long max)
|
||||
void zrandomrange(ZVALUE low, ZVALUE beyond, ZVALUE *res)
|
||||
long irandom(long beyond)
|
||||
|
||||
SEE ALSO
|
||||
seed, srand, randbit, isrand, rand, srandom, israndom
|
||||
|
||||
## Copyright (C) 1999 Landon Curt Noll
|
||||
## Copyright (C) 1999-2007 Landon Curt Noll
|
||||
##
|
||||
## Calc is open software; you can redistribute it and/or modify it under
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -172,8 +175,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## @(#) $Revision: 30.1 $
|
||||
## @(#) $Id: random,v 30.1 2007/03/16 11:10:42 chongo Exp $
|
||||
## @(#) $Revision: 30.3 $
|
||||
## @(#) $Id: random,v 30.3 2007/09/21 02:16:29 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/random,v $
|
||||
##
|
||||
## Under source code control: 1997/02/17 01:18:22
|
||||
|
14
help/todo
14
help/todo
@@ -51,6 +51,12 @@ Very High priority items:
|
||||
|
||||
* Consider using GNU autoconf / configure to build calc.
|
||||
|
||||
* It is overkill to have nearly everything wind up in libcalc.
|
||||
Form a libcalcmath and a libcalclang so that an application
|
||||
that just wants to link with the calc math libs can use them
|
||||
without dragging in all of the other calc language, I/O,
|
||||
and builtin functions.
|
||||
|
||||
* Fix any 'Known bugs' as noted in the BUGS file or as
|
||||
displayed by 'calc help bugs'.
|
||||
|
||||
@@ -102,8 +108,6 @@ Medium priority items:
|
||||
at by 'fizbin' and the HALF array pointer at by 'data' should be
|
||||
treated as read-only.
|
||||
|
||||
* It is overkill to have nearly everything wind up in libcalc.a.
|
||||
|
||||
One should make available a the fundamental math operations
|
||||
on ZVALUE, NUMBER and perhaps COMPLEX (without all of the
|
||||
other stuff) in a separate library.
|
||||
@@ -113,7 +117,7 @@ Medium priority items:
|
||||
* Add a builtin function to access the 64 bit FNV hash which
|
||||
is currently being used internally in seed.c.
|
||||
|
||||
## Copyright (C) 1999-2006 Landon Curt Noll
|
||||
## Copyright (C) 1999-2007 Landon Curt Noll
|
||||
##
|
||||
## Calc is open software; you can redistribute it and/or modify it under
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -129,8 +133,8 @@ Medium priority items:
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## @(#) $Revision: 30.1 $
|
||||
## @(#) $Id: todo,v 30.1 2007/03/16 11:10:42 chongo Exp $
|
||||
## @(#) $Revision: 30.2 $
|
||||
## @(#) $Id: todo,v 30.2 2007/09/08 02:52:42 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/todo,v $
|
||||
##
|
||||
## Under source code control: 1999/10/20 07:42:55
|
||||
|
@@ -4,6 +4,10 @@ Unexpected
|
||||
surprises in calc syntax and usage. Persons familiar with C should
|
||||
review this file.
|
||||
|
||||
Persons familiar with shell scripting may want to review this file
|
||||
as well, particularly notes dealing with command line evaluation
|
||||
and execution.
|
||||
|
||||
|
||||
The Comma
|
||||
=========
|
||||
@@ -75,7 +79,7 @@ Unexpected
|
||||
|
||||
(-1) ^ 0.5 == 1i
|
||||
|
||||
because the above expresssion in parsed as:
|
||||
because the above expression in parsed as:
|
||||
|
||||
-(1 ^ 0.5) == -1
|
||||
|
||||
@@ -335,7 +339,66 @@ Unexpected
|
||||
NOTE: See "help statement", "help todo", and "help bugs".
|
||||
|
||||
|
||||
## Copyright (C) 1999-2006 Landon Curt Noll
|
||||
Shell evaluation of command line arguments
|
||||
==========================================
|
||||
|
||||
In most interactive shells:
|
||||
|
||||
calc 2 * 3
|
||||
|
||||
will frequently produce a "Missing operator" error because the '*' is
|
||||
evaluated as a "shell glob". To avoid this you must quote or escape
|
||||
argument with characters that your interactive shell interprets.
|
||||
|
||||
For example, bash / ksh / sh shell users should use:
|
||||
|
||||
calc '2 * 3'
|
||||
|
||||
or:
|
||||
|
||||
calc 2 \* 3
|
||||
|
||||
or some other form of shell meta-character escaping.
|
||||
|
||||
|
||||
Calc reads standard input after processing command line args
|
||||
============================================================
|
||||
|
||||
The shell command:
|
||||
|
||||
seq 5 | while read i; do calc "($i+3)^2"; done
|
||||
|
||||
FYI: The command "seq 5" will write 1 through 5 on separate
|
||||
lines on standard output, while read i sets $i to
|
||||
the value of each line that is read from stdin.
|
||||
|
||||
will produce:
|
||||
|
||||
16
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
|
||||
The reason why the last 4 lines of output are 2 through 5 is
|
||||
that after calc evaluates the first line and prints (1+3)^2
|
||||
(i.e., 16), calc continues to read stdin and slurps up all
|
||||
of the remaining data on the pipe.
|
||||
|
||||
To avoid this problem, use:
|
||||
|
||||
seq 5 | while read i; do calc "($i+3)^2" </dev/null; done
|
||||
|
||||
which produces the expected results:
|
||||
|
||||
16
|
||||
25
|
||||
36
|
||||
49
|
||||
64
|
||||
|
||||
|
||||
## Copyright (C) 1999-2007 Landon Curt Noll
|
||||
##
|
||||
## Calc is open software; you can redistribute it and/or modify it under
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -351,8 +414,8 @@ Unexpected
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## @(#) $Revision: 30.2 $
|
||||
## @(#) $Id: unexpected,v 30.2 2007/07/11 23:00:39 chongo Exp $
|
||||
## @(#) $Revision: 30.3 $
|
||||
## @(#) $Id: unexpected,v 30.3 2007/09/08 02:48:45 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/unexpected,v $
|
||||
##
|
||||
## Under source code control: 1997/03/21 13:15:18
|
||||
|
Reference in New Issue
Block a user