Release calc version 2.12.0

This commit is contained in:
Landon Curt Noll
2006-05-21 01:11:18 -07:00
parent 7165fa17c7
commit 58d94b08d8
342 changed files with 8845 additions and 6327 deletions

View File

@@ -18,8 +18,8 @@
# received a copy with calc; if not, write to Free Software Foundation, Inc.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
#
# @(#) $Revision: 29.25 $
# @(#) $Id: Makefile,v 29.25 2004/07/28 12:21:05 chongo Exp $
# @(#) $Revision: 29.28 $
# @(#) $Id: Makefile,v 29.28 2006/05/07 12:59:51 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/help/RCS/Makefile,v $
#
# Under source code control: 1991/07/23 06:47:57
@@ -258,32 +258,41 @@ BLT_HELP_FILES= ${BLT_HELP_FILES_3} ${BLT_HELP_FILES_5} \
# This list is prodiced by the detaillist rule when no WARNINGS are detected.
#
# Please use:
#
# make detaillist
#
# to keep this list in nice sorted order and to check that these
# non-special help files are under RCS control.
#
DETAIL_HELP= abs access acos acosh acot acoth acsc acsch address agd append \
appr arg argv arrow asec asech asin asinh assign atan atan2 atanh \
avg base base2 bernoulli bit blk blkcpy blkfree blocks bround btrunc \
calc_tty calclevel catalan ceil cfappr cfsim char cmdbuf cmp comb \
conj cos cosh cot coth count cp csc csch ctime delete den dereference \
det digit digits display dp epsilon errcount errmax errno error euler \
eval exp fact factor fclose fcnt feof ferror fflush fgetc fgetfield \
fgetline fgets fgetstr fib files floor fopen forall fprintf fputc \
fputs fputstr frac free freebernoulli freeeuler freeglobals freeredc \
freestatics frem freopen fscan fscanf fseek fsize ftell gcd gcdrem \
gd getenv hash head highbit hmean hnrmod hypot ilog ilog10 ilog2 \
im indices inputlevel insert int inverse iroot isassoc isatty isblk \
isconfig isdefined iserror iseven isfile ishash isident isint islist \
ismat ismult isnull isnum isobj isobjtype isodd isprime isptr isqrt \
isrand israndom isreal isrel issimple issq isstr istype jacobi join \
lcm lcmfact lfactor ln lowbit ltol makelist matdim matfill matmax \
matmin matsum mattrace mattrans max md5 memsize meq min minv mmin \
mne mod modify name near newerror nextcand nextprime norm null \
num oldvalue ord param perm pfact pi pix places pmod polar poly \
pop popcnt power prevcand prevprime printf prompt protect ptest \
push putenv quo quomod rand randbit random randombit randperm rcin \
rcmul rcout rcpow rcsq re remove reverse rewind rm root round rsearch \
runtime saveval scale scan scanf search sec sech seed segment select \
sgn sha sha1 sin sinh size sizeof sleep sort sqrt srand srandom \
ssq str strcat strerror strlen strpos strprintf strscan strscanf \
substr sum swap system tail tan tanh test time trunc version xor
det digit digits display dp epsilon errcount errmax errno error \
euler eval exp fact factor fclose fcnt feof ferror fflush fgetc \
fgetfield fgetline fgets fgetstr fib files floor fopen forall \
fpathopen fprintf fputc fputs fputstr frac free freebernoulli \
freeeuler freeglobals freeredc freestatics frem freopen fscan \
fscanf fseek fsize ftell gcd gcdrem gd getenv hash head highbit \
hmean hnrmod hypot ilog ilog10 ilog2 im indices inputlevel insert \
int inverse iroot isassoc isatty isblk isconfig isdefined iserror \
iseven isfile ishash isident isint islist ismat ismult isnull isnum \
isobj isobjtype isodd isprime isptr isqrt isrand israndom isreal \
isrel issimple issq isstr istype jacobi join lcm lcmfact lfactor \
ln log lowbit ltol makelist matdim matfill matmax matmin matsum \
mattrace mattrans max md5 memsize meq min minv mmin mne mod modify \
name near newerror nextcand nextprime norm null num oldvalue ord \
param perm pfact pi pix places pmod polar poly pop popcnt power \
prevcand prevprime printf prompt protect ptest push putenv quo \
quomod rand randbit random randombit randperm rcin rcmul rcout \
rcpow rcsq re remove reverse rewind rm root round rsearch runtime \
saveval scale scan scanf search sec sech seed segment select sgn \
sha sha1 sin sinh size sizeof sleep sort sqrt srand srandom ssq \
str strcat strcmp strcpy strerror strlen strncmp strncpy strpos \
strprintf strscan strscanf substr sum swap system tail tan tanh \
test time trunc version xor
# This list is of files that are clones of DETAIL_HELP files. They are
# built from DETAIL_HELP files.

View File

@@ -29,10 +29,10 @@ DESCRIPTION
the result will be the absolute value correct to n decimal places.
EXAMPLE
> print abs(3.4), abs(-3.4)
; print abs(3.4), abs(-3.4)
3.4 3.4
> print abs(3+4i, 1e-5), abs(4+5i, 1e-5), abs(4+5i, 1e-10)
; print abs(3+4i, 1e-5), abs(4+5i, 1e-5), abs(4+5i, 1e-10)
5 6.40312 6.4031242374
LIMITS
@@ -60,8 +60,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: abs,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: abs,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/abs,v $
##
## Under source code control: 1994/03/19 01:40:22

View File

@@ -23,19 +23,19 @@ EXAMPLE
The system error-numbers and messages may differ for different
implementations
> !rm -f junk
> access("junk")
; !rm -f junk
; access("junk")
System error 2
> strerror(.)
; strerror(.)
"No such file or directory"
> f = fopen("junk", "w")
> access("junk")
> fputs(f, "Alpha")
> fclose(f)
> !chmod u-w junk
> access("junk", "w")
; f = fopen("junk", "w")
; access("junk")
; fputs(f, "Alpha")
; fclose(f)
; !chmod u-w junk
; access("junk", "w")
System error 13
> strerror(.)
; strerror(.)
"Permission denied"
LIMITS
@@ -64,8 +64,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: access,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: access,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/access,v $
##
## Under source code control: 1996/04/30 03:36:20

View File

@@ -17,7 +17,7 @@ DESCRIPTION
v = acos(x) is the number in [0, pi] for which cos(v) = x.
EXAMPLE
> print acos(.5, 1e-5), acos(.5, 1e-10), acos(.5, 1e-15), acos(.5, 1e-20)
; print acos(.5, 1e-5), acos(.5, 1e-10), acos(.5, 1e-15), acos(.5, 1e-20)
1.0472 1.0471975512 1.047197551196598 1.04719755119659774615
LIMITS
@@ -45,8 +45,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: acos,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: acos,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/acos,v $
##
## Under source code control: 1994/03/19 01:40:23

View File

@@ -20,7 +20,7 @@ DESCRIPTION
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)
; print acosh(2, 1e-5), acosh(2, 1e-10), acosh(2, 1e-15), acosh(2, 1e-20)
1.31696 1.3169578969 1.316957896924817 1.31695789692481670862
LIMITS
@@ -48,8 +48,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: acosh,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: acosh,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/acosh,v $
##
## Under source code control: 1994/03/19 01:40:24

View File

@@ -17,7 +17,7 @@ DESCRIPTION
v = acot(x) is the number in (0, pi) for which cot(v) = x.
EXAMPLE
> print acot(2, 1e-5), acot(2, 1e-10), acot(2, 1e-15), acot(2, 1e-20)
; print acot(2, 1e-5), acot(2, 1e-10), acot(2, 1e-15), acot(2, 1e-20)
.46365 .463647609 .463647609000806 .46364760900080611621
LIMITS
@@ -45,8 +45,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: acot,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: acot,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/acot,v $
##
## Under source code control: 1995/11/13 03:49:00

View File

@@ -19,7 +19,7 @@ DESCRIPTION
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)
; print acoth(2, 1e-5), acoth(2, 1e-10), acoth(2, 1e-15), acoth(2, 1e-20)
.54931 .5493061443 .549306144334055 .5493061443340548457
LIMITS
@@ -47,8 +47,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: acoth,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: acoth,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/acoth,v $
##
## Under source code control: 1995/11/13 03:49:01

View File

@@ -17,7 +17,7 @@ DESCRIPTION
v = acsc(x) is the number in [-pi/2, pi/2] for which csc(v) = x.
EXAMPLE
> print acsc(2, 1e-5), acsc(2, 1e-10), acsc(2, 1e-15), acsc(2, 1e-20)
; print acsc(2, 1e-5), acsc(2, 1e-10), acsc(2, 1e-15), acsc(2, 1e-20)
.5236 .5235987756 .523598775598299 .52359877559829887308
LIMITS
@@ -45,8 +45,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: acsc,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: acsc,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/acsc,v $
##
## Under source code control: 1995/11/13 03:49:00

View File

@@ -20,7 +20,7 @@ DESCRIPTION
EXAMPLE
> print acsch(2, 1e-5), acsch(2, 1e-10), acsch(2, 1e-15), acsch(2, 1e-20)
; print acsch(2, 1e-5), acsch(2, 1e-10), acsch(2, 1e-15), acsch(2, 1e-20)
.48121 .4812118251 .481211825059603 .4812118250596034475
LIMITS
@@ -48,8 +48,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: acsch,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: acsch,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/acsch,v $
##
## Under source code control: 1995/11/13 03:49:01

View File

@@ -134,21 +134,21 @@ DESCRIPTION
EXAMPLE
Addresses for particular systems may differ from those displayed here.
> mat A[3]
> B = blk()
; mat A[3]
; B = blk()
> print &A, &A[0], &A[1]
; print &A, &A[0], &A[1]
v-ptr: 1400470d0 v-ptr: 140044b70 v-ptr: 140044b80
> print &B, &B[0], &B[1]
; print &B, &B[0], &B[1]
v-ptr: 140047130 o-ptr: 140044d00 o-ptr: 140044d01
> a = A[0] = 27
> print &*a, &*A[0]. &27
; a = A[0] = 27
; print &*a, &*A[0]. &27
n_ptr: 14003a850 n_ptr: 14003a850 n_ptr: 14003a850
> a = A[0] = "abc"
> print &*a, &*A[0], &"abc"
; a = A[0] = "abc"
; print &*a, &*A[0], &"abc"
s_ptr: 14004cae0 s_ptr: 14004cae0 s_ptr: 14004cae0
LIMITS
@@ -176,8 +176,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.3 $
## @(#) $Id: address,v 29.3 2002/07/10 11:47:04 chongo Exp $
## @(#) $Revision: 29.4 $
## @(#) $Id: address,v 29.4 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/address,v $
##
## Under source code control: 1997/09/06 20:03:34

View File

@@ -35,16 +35,16 @@ DESCRIPTION
EXAMPLE
> print agd(1, 1e-5), agd(1, 1e-10), agd(1, 1e-15)
; print agd(1, 1e-5), agd(1, 1e-10), agd(1, 1e-15)
1.22619 1.2261911709 1.226191170883517
> print agd(2, 1e-5), agd(2, 1e-10)
; print agd(2, 1e-5), agd(2, 1e-10)
1.52345-3.14159i 1.5234524436-3.1415926536i
> print agd(5, 1e-5), agd(5, 1e-10), agd(5, 1e-15)
; print agd(5, 1e-5), agd(5, 1e-10), agd(5, 1e-15)
-1.93237 -1.9323667197 -1.932366719745925
> print agd(1+2i, 1e-5), agd(1+2i, 1e-10)
; print agd(1+2i, 1e-5), agd(1+2i, 1e-10)
.22751+1.42291i .2275106584+1.4229114625i
LIMITS
@@ -72,8 +72,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.3 $
## @(#) $Id: agd,v 29.3 2005/10/18 10:48:29 chongo Exp $
## @(#) $Revision: 29.4 $
## @(#) $Id: agd,v 29.4 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/agd,v $
##
## Under source code control: 1997/09/06 20:03:34

View File

@@ -19,9 +19,9 @@ DESCRIPTION
append(x, y_0, y_1, ...) is equivalent to insert(x, n, y_0, y_1, ...).
EXAMPLE
> x = list(2,3,4)
> append(x, 5, 6)
> print x
; x = list(2,3,4)
; append(x, 5, 6)
; print x
list (5 elements, 5 nonzero):
[[0]] = 2
@@ -30,8 +30,8 @@ EXAMPLE
[[3]] = 5
[[4]] = 6
> append(x, pop(x), pop(x))
> print x
; append(x, pop(x), pop(x))
; print x
list (5 elements, 5 nonzero):
[[0]] = 4
@@ -40,8 +40,8 @@ EXAMPLE
[[3]] = 2
[[4]] = 3
> append(x, (remove(x), 7))
> print x
; append(x, (remove(x), 7))
; print x
list (5 elements, 5 nonzero):
[[0]] = 4
@@ -75,8 +75,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: append,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: append,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/append,v $
##
## Under source code control: 1994/03/19 03:13:17

View File

@@ -97,47 +97,47 @@ PROPERTIES
If y is nonzero, appr(x,y,8)/y = an odd integer n only if x = n * y.
EXAMPLES
> print appr(-5.44,0.1,0), appr(5.44,0.1,0), appr(5.7,1,0), appr(-5.7,1,0)
; print appr(-5.44,0.1,0), appr(5.44,0.1,0), appr(5.7,1,0), appr(-5.7,1,0)
-5.5 5.4 5 -6
> print appr(-5.44,-.1,0), appr(5.44,-.1,0), appr(5.7,-1,0), appr(-5.7,-1,0)
; print appr(-5.44,-.1,0), appr(5.44,-.1,0), appr(5.7,-1,0), appr(-5.7,-1,0)
-5.4 5.5 6 -5
> print appr(-5.44,0.1,3), appr(5.44,0.1,3), appr(5.7,1,3), appr(-5.7,1,3)
; print appr(-5.44,0.1,3), appr(5.44,0.1,3), appr(5.7,1,3), appr(-5.7,1,3)
-5.5 5.5 6 -6
> print appr(-5.44,0.1,4), appr(5.44,0.1,4), appr(5.7,1,4), appr(-5.7,1,4)
; print appr(-5.44,0.1,4), appr(5.44,0.1,4), appr(5.7,1,4), appr(-5.7,1,4)
-5.5 5.4 5 -6
> print appr(-5.44,0.1,6), appr(5.44,0.1,6), appr(5.7,1,6), appr(-5.7,1,6)
; print appr(-5.44,0.1,6), appr(5.44,0.1,6), appr(5.7,1,6), appr(-5.7,1,6)
-5.4 5.4 6 -5
> print appr(-5.44,-.1,6), appr(5.44,-.1,6), appr(5.7,-1,6), appr(-5.7,-1,6)
; print appr(-5.44,-.1,6), appr(5.44,-.1,6), appr(5.7,-1,6), appr(-5.7,-1,6)
-5.5 5.5 6 -6
> print appr(-5.44,0.1,9), appr(5.44,0.1,9), appr(5.7,1,9), appr(-5.7,1,9)
; print appr(-5.44,0.1,9), appr(5.44,0.1,9), appr(5.7,1,9), appr(-5.7,1,9)
-5.5 5.5 5 -5
> print appr(-.44,0.1,11), appr(.44,0.1,11), appr(5.7,1,11), appr(-5.7,1,11)
; print appr(-.44,0.1,11), appr(.44,0.1,11), appr(5.7,1,11), appr(-5.7,1,11)
-.4 .5 5 -6
> print appr(-.44,-.1,11),appr(.44,-.1,11),appr(5.7,-1,11),appr(-5.7,-1,11)
; print appr(-.44,-.1,11),appr(.44,-.1,11),appr(5.7,-1,11),appr(-5.7,-1,11)
-.5 .4 6 -5
> print appr(-.44,0.1,12), appr(.44,0.1,12), appr(5.7,1,12), appr(-5.7,1,12)
; print appr(-.44,0.1,12), appr(.44,0.1,12), appr(5.7,1,12), appr(-5.7,1,12)
-.4 .5 5 -6
> print appr(-.44,-.1,12),appr(.44,-.1,12),appr(5.7,-1,12),appr(-5.7,-1,12)
; print appr(-.44,-.1,12),appr(.44,-.1,12),appr(5.7,-1,12),appr(-5.7,-1,12)
-.5 .4 6 -5
> print appr(-.44,0.1,15), appr(.44,0.1,15), appr(5.7,1,15), appr(-5.7,1,15)
; print appr(-.44,0.1,15), appr(.44,0.1,15), appr(5.7,1,15), appr(-5.7,1,15)
-.4 .5 5 -6
> print appr(-.44,-.1,15),appr(.44,-.1,15),appr(5.7,-1,15),appr(-5.7,-1,15)
; print appr(-.44,-.1,15),appr(.44,-.1,15),appr(5.7,-1,15),appr(-5.7,-1,15)
-.4 .5 5 -6
> x = sqrt(7-3i, 1e-20)
> print appr(x,1e-5,0), appr(x,1e-5,1), appr(x,1e-5,2), appr(x,1e-6,3)
; x = sqrt(7-3i, 1e-20)
; print appr(x,1e-5,0), appr(x,1e-5,1), appr(x,1e-5,2), appr(x,1e-6,3)
2.70331-.55488i 2.70332-.55487i 2.70331-.55487i 2.70332-.55488i
LIMITS
@@ -167,8 +167,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: appr,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: appr,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/appr,v $
##
## Under source code control: 1994/09/25 17:18:21

View File

@@ -16,11 +16,11 @@ DESCRIPTION
but usually less than 0.5 * abs(eps).
EXAMPLE
> print arg(2), arg(2+3i, 1e-5), arg(2+3i, 1e-10), arg(2+3i, 1e-20)
; print arg(2), arg(2+3i, 1e-5), arg(2+3i, 1e-10), arg(2+3i, 1e-20)
0 .98279 .9827937232 .98279372324732906799
> pi = pi(1e-10); deg = pi/180; eps = deg/10000
> print arg(2+3i, eps)/deg, arg(-1 +1i, eps)/deg, arg(-1 - 1i,eps)/deg
; pi = pi(1e-10); deg = pi/180; eps = deg/10000
; print arg(2+3i, eps)/deg, arg(-1 +1i, eps)/deg, arg(-1 - 1i,eps)/deg
56.3099 135 -135
LIMITS
@@ -48,8 +48,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: arg,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: arg,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/arg,v $
##
## Under source code control: 1994/09/25 20:22:31

View File

@@ -38,8 +38,8 @@ DESCRIPTION
EXAMPLE
$ calc -s a bb ccc
> argc = argv();
> for (i = 0; i < argc; i++) print "argv[": i : '] = "': argv(i) : '"';
; argc = argv();
; for (i = 0; i < argc; i++) print "argv[": i : '] = "': argv(i) : '"';
argv[0] = "a"
argv[1] = "bb"
argv[2] = "ccc"
@@ -69,8 +69,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: argv,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: argv,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/argv,v $
##
## Under source code control: 1999/11/23 19:45:05

View File

@@ -23,21 +23,21 @@ DESCRIPTION
Spaces or tabs on either side of -> are optional.
EXAMPLES
> obj pair {one, two}
> obj pair A, B
> p = &A
> p->one = 1; p->two = 2
> A
; obj pair {one, two}
; obj pair A, B
; p = &A
; p->one = 1; p->two = 2
; A
obj pair {1, 2}
> A->two = &B
> p->two->one = 3; p->two->two = 4
; A->two = &B
; p->two->one = 3; p->two->two = 4
> *p->ptwo
; *p->ptwo
obj pair {3, 4}
> B = {5,6}
> *p->two
; B = {5,6}
; *p->two
obj pair {5, 6}
@@ -66,8 +66,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.3 $
## @(#) $Id: arrow,v 29.3 2002/07/10 11:47:04 chongo Exp $
## @(#) $Revision: 29.4 $
## @(#) $Id: arrow,v 29.4 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/arrow,v $
##
## Under source code control: 1997/09/06 20:03:34

View File

@@ -17,7 +17,7 @@ DESCRIPTION
v = asec(x) is the number in [0, pi] for which sec(v) = x.
EXAMPLE
> print asec(2, 1e-5), asec(2, 1e-10), asec(2, 1e-15), asec(2, 1e-20)
; print asec(2, 1e-5), asec(2, 1e-10), asec(2, 1e-15), asec(2, 1e-20)
1.0472 1.0471975512 1.047197551196598 1.04719755119659774615
LIMITS
@@ -45,8 +45,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: asec,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: asec,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/asec,v $
##
## Under source code control: 1995/11/13 03:49:00

View File

@@ -19,7 +19,7 @@ DESCRIPTION
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)
; print asech(.5,1e-5), asech(.5,1e-10), asech(.5,1e-15), asech(.5,1e-20)
1.31696 1.3169578969 1.316957896924817 1.31695789692481670862
LIMITS
@@ -47,8 +47,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: asech,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: asech,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/asech,v $
##
## Under source code control: 1995/11/13 03:49:00

View File

@@ -17,7 +17,7 @@ DESCRIPTION
v = asin(x) is the number in [-pi/2, pi/2] for which sin(v) = x.
EXAMPLE
> print asin(.5, 1e-5), asin(.5, 1e-10), asin(.5, 1e-15), asin(.5, 1e-20)
; print asin(.5, 1e-5), asin(.5, 1e-10), asin(.5, 1e-15), asin(.5, 1e-20)
.5236 .5235987756 .523598775598299 .52359877559829887308
LIMITS
@@ -45,8 +45,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.3 $
## @(#) $Id: asin,v 29.3 2002/07/10 11:47:04 chongo Exp $
## @(#) $Revision: 29.4 $
## @(#) $Id: asin,v 29.4 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/asin,v $
##
## Under source code control: 1994/03/19 01:40:24

View File

@@ -19,7 +19,7 @@ DESCRIPTION
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)
; print asinh(2, 1e-5), asinh(2, 1e-10), asinh(2, 1e-15), asinh(2, 1e-20)
1.44363 1.4436354752 1.44363547517881 1.44363547517881034249
LIMITS
@@ -47,8 +47,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: asinh,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: asinh,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/asinh,v $
##
## Under source code control: 1994/03/19 01:40:25

View File

@@ -76,32 +76,32 @@ DESCRIPTION
EXAMPLE
> b = 3+1
> a = b
> print a, b
; b = 3+1
; a = b
; print a, b
4 4
> obj point {x,y}
> mat A[3] = {1, list(2,3), obj point = {4,5}}
; obj point {x,y}
; mat A[3] = {1, list(2,3), obj point = {4,5}}
> A[1][[0]] = 6; A[2].x = 7
> print A[1]
; A[1][[0]] = 6; A[2].x = 7
; print A[1]
list (2 elements, 2 nonzero):
[[0]] = 6
[[1]] = 3
> print A[2]
; print A[2]
obj point {7, 5}
> A = {A[2], , {9,10}}
> print A[0]
; A = {A[2], , {9,10}}
; print A[0]
obj point {7, 5}
> print A[2]
; print A[2]
obj point {9, 10}
> A = {, {2}}
; A = {, {2}}
print A[1]
list (2 elements, 2 nonzero):
@@ -133,8 +133,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: assign,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: assign,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/assign,v $
##
## Under source code control: 1995/05/11 21:03:23

View File

@@ -60,12 +60,12 @@ DESCRIPTION
and are illegal.
EXAMPLE
> A = assoc(); print A
; A = assoc(); print A
assoc (0 elements):
> A["zero"] = 0; A["one"] = 1; A["two"] = 2; A["three"] = 3;
> A["smallest", "prime"] = 2;
> print A
; A["zero"] = 0; A["one"] = 1; A["two"] = 2; A["three"] = 3;
; A["smallest", "prime"] = 2;
; print A
assoc (5 elements);
["two"] = 2
["three"] = 3
@@ -98,8 +98,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.3 $
## @(#) $Id: assoc,v 29.3 2002/07/10 11:47:04 chongo Exp $
## @(#) $Revision: 29.4 $
## @(#) $Id: assoc,v 29.4 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/assoc,v $
##
## Under source code control: 1994/09/25 20:22:31

View File

@@ -17,7 +17,7 @@ DESCRIPTION
v = atan(x) is the number in (-pi/2, pi/2) for which tan(v) = x.
EXAMPLE
> print atan(2, 1e-5), atan(2, 1e-10), atan(2, 1e-15), atan(2, 1e-20)
; print atan(2, 1e-5), atan(2, 1e-10), atan(2, 1e-15), atan(2, 1e-20)
1.10715 1.1071487178 1.107148717794091 1.10714871779409050302
LIMITS
@@ -45,8 +45,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.3 $
## @(#) $Id: atan,v 29.3 2002/07/10 11:47:04 chongo Exp $
## @(#) $Revision: 29.4 $
## @(#) $Id: atan,v 29.4 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/atan,v $
##
## Under source code control: 1994/03/19 01:40:25

View File

@@ -24,7 +24,7 @@ DESCRIPTION
returns 0.
EXAMPLE
> print atan2(0,0), atan2(1,sqrt(3)), atan2(17,53,1e-100)
; print atan2(0,0), atan2(1,sqrt(3)), atan2(17,53,1e-100)
0 ~.52359877559829887307 ~.31038740713235146535
LIMITS
@@ -52,8 +52,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: atan2,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: atan2,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/atan2,v $
##
## Under source code control: 1994/03/19 01:40:26

View File

@@ -19,7 +19,7 @@ DESCRIPTION
atanh(x) = ln((1 + x)/(1 - x))/2
EXAMPLE
> print atanh(.5,1e-5), atanh(.5,1e-10), atanh(.5,1e-15), atanh(.5,1e-20)
; print atanh(.5,1e-5), atanh(.5,1e-10), atanh(.5,1e-15), atanh(.5,1e-20)
.54931 .5493061443 .549306144334055 .5493061443340548457
LIMITS
@@ -47,8 +47,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: atanh,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: atanh,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/atanh,v $
##
## Under source code control: 1994/03/19 01:40:27

View File

@@ -27,12 +27,12 @@ DESCRIPTION
be averaged.
EXAMPLE
> print avg(1,2,3,4,5), avg(list(1,2,3,4,5)), avg(1,2,list(3,4,5))
; print avg(1,2,3,4,5), avg(list(1,2,3,4,5)), avg(1,2,list(3,4,5))
3 3 3
> mat x[2,2] = {1,2,3,4}
> mat y[2,2] = {1,2,4,8}
> avg(x,y)
; mat x[2,2] = {1,2,3,4}
; mat y[2,2] = {1,2,4,8}
; avg(x,y)
mat [2,2] (4 elements, 4 nonzero):
[0,0] = 1
@@ -65,8 +65,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: avg,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: avg,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/avg,v $
##
## Under source code control: 1994/09/25 20:22:31

View File

@@ -60,13 +60,13 @@ DESCRIPTION
listed in the table above.
EXAMPLE
> base()
; base()
10
> base(8)
; base(8)
012
> print 10
; print 10
012
LIMITS
@@ -97,8 +97,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.5 $
## @(#) $Id: base,v 29.5 2002/12/29 09:17:54 chongo Exp $
## @(#) $Revision: 29.6 $
## @(#) $Id: base,v 29.6 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/base,v $
##
## Under source code control: 1994/09/30 00:09:39

View File

@@ -68,16 +68,16 @@ DESCRIPTION
listed in the table above.
EXAMPLE
> base2()
; base2()
0
> base2(8)
; base2(8)
0 /* 0 */
> print 10
; print 10
10 /* 012 */
> base2(16),
> 131072
; base2(16),
; 131072
131072 /* 0x20000 */
> 2345
; 2345
2345 /* 0x929 */
LIMITS
@@ -109,8 +109,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 1.3 $
## @(#) $Id: base2,v 1.3 2002/12/29 09:17:54 chongo Exp $
## @(#) $Revision: 1.4 $
## @(#) $Id: base2,v 1.4 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/base2,v $
##
## Under source code control: 2002/12/29 00:21:07

View File

@@ -28,8 +28,8 @@ DESCRIPTION
freebernoulli().
EXAMPLE
> config("mode", "frac"),;
> for (n = 0; n <= 6; n++) print bernoulli(n),; print;
; config("mode", "frac"),;
; for (n = 0; n <= 6; n++) print bernoulli(n),; print;
1 -1/2 1/6 0 -1/30 0 1/42
LIMITS
@@ -57,8 +57,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.5 $
## @(#) $Id: bernoulli,v 29.5 2002/07/10 11:47:04 chongo Exp $
## @(#) $Revision: 29.6 $
## @(#) $Id: bernoulli,v 29.6 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/bernoulli,v $
##
## Under source code control: 2000/07/13 01:33:00

View File

@@ -20,17 +20,17 @@ DESCRIPTION
return 1, otherwise return 0.
EXAMPLE
> print bit(9,0), bit(9,1), bit(9,2), bit(9,3)
; print bit(9,0), bit(9,1), bit(9,2), bit(9,3)
1 0 0 1
> print bit(9,4), bit(0,0), bit(9,-1)
; print bit(9,4), bit(0,0), bit(9,-1)
0 0 0
> print bit(1.25, -2), bit(1.25, -1), bit(1.25, 0)
; print bit(1.25, -2), bit(1.25, -1), bit(1.25, 0)
1 0 1
> p = pi()
> print bit(p, 1), bit(p, -2), bit(p, -3)
; p = pi()
; print bit(p, 1), bit(p, -2), bit(p, -3)
1 0 1
LIMITS
@@ -58,8 +58,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: bit,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: bit,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/bit,v $
##
## Under source code control: 1994/10/21 02:21:30

View File

@@ -14,7 +14,7 @@ TYPES
DESCRIPTION
With only integer arguments, blk(len, chunk) attempts to
allocate a block of memory consisting of N octets (unsigned 8-bit
allocate a block of memory consisting of len octets (unsigned 8-bit
bytes). Allocation is always done in multiples of chunk
octets, so the actual allocation size of len rounded up
to the next multiple of chunk.
@@ -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, size(B) is increased to i + 1. For example:
B[i] = x
@@ -56,7 +56,7 @@ DESCRIPTION
will append one octet to B and increment size(B).
The builtin test(B) returns 1 or 0 according as at least one octet
is zero or all octets are zero. If B1 and B2 are blocks, they are
is nonzero or all octets are zero. If B1 and B2 are blocks, they are
considered equal (B1 == B2) if they have the same length and the
same data, i.e. B1[i] == B2[i] for 0 <= i < len. Chunksizes
and maxsizes are ignored.
@@ -107,7 +107,7 @@ DESCRIPTION
will give a second variable B referring to the same block as A.
Either A[i] = x or B[i] = x may then be used to assign a value
to an octet in the book. Its length or chunksize may be changed by
to an octet in the block. Its length or chunksize may be changed by
instructions like:
blk(A, len, chunk);
@@ -154,55 +154,55 @@ DESCRIPTION
EXAMPLE
> B = blk(15,10)
; B = blk(15,10)
> B[7] = 0xff
> B
; B[7] = 0xff
; B
chunksize = 10, maxsize = 20, datalen = 15
00000000000000ff00000000000000
> B[18] = 127
> B
; B[18] = 127
; B
chunksize = 10, maxsize = 20, datalen = 18
00000000000000ff0000000000000000007f
> B[20] = 2
; B[20] = 2
Index out of bounds for block
> print size(B), sizeof(B)
; print size(B), sizeof(B)
18 20
> B = blk(B, 100, 20)
> B
; B = blk(B, 100, 20)
; B
chunksize = 20, maxsize = 120, datalen = 100
00000000000000ff0000000000000000007f000000000000000000000000...
> C = blk(B, 10} = {1,2,3}
> C
; C = blk(B, 10} = {1,2,3}
; C
chunksize = 20, maxsize = 20, datalen = 10
01020300000000ff0000
> A1 = blk("alpha")
> A1
; A1 = blk("alpha")
; A1
block 0: alpha
chunksize = 256, maxsize = 256, datalen = 0
> A1[7] = 0xff
> A2 = A1
> A2[17] = 127
> A1
; A1[7] = 0xff
; A2 = A1
; A2[17] = 127
; A1
block 0: alpha
chunksize = 256, maxsize = 256, datalen = 18
00000000000000ff0000000000000000007f
> A1 = blk(A1, 1000)
> A1
; A1 = blk(A1, 1000)
; A1
block 0: alpha
chunksize = 256, maxsize = 1024, datalen = 1000
00000000000000ff0000000000000000007f000000000000000000000000...
> A1 = blk(A1, , 16)
> A1
; A1 = blk(A1, , 16)
; A1
block 0: alpha
chunksize = 16, maxsize = 1008, datalen = 1000
00000000000000ff0000000000000000007f000000000000000000000000...
@@ -234,8 +234,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.3 $
## @(#) $Id: blk,v 29.3 2002/07/10 11:47:04 chongo Exp $
## @(#) $Revision: 29.4 $
## @(#) $Id: blk,v 29.4 2006/05/07 07:16:42 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/blk,v $
##
## Under source code control: 1997/04/05 13:07:13

View File

@@ -108,74 +108,74 @@ DESCRIPTION
EXAMPLE
> A = blk() = {1,2,3,4}
> B = blk()
> blkcpy(B,A)
> B
; A = blk() = {1,2,3,4}
; B = blk()
; blkcpy(B,A)
; B
chunksize = 256, maxsize = 256, datalen = 4
01020304
>
> blkcpy(B,A)
> B
; blkcpy(B,A)
; B
chunksize = 256, maxsize = 256, datalen = 8
0102030401020304
> blkcpy(B, A, 2, 10)
> B
; blkcpy(B, A, 2, 10)
; B
chunksize = 256, maxsize = 256, datalen = 12
010203040102030400000102
> blkcpy(B,32767)
> B
; blkcpy(B,32767)
; B
chunksize = 256, maxsize = 256, datalen = 16
010203040102030400000102ff7f0000
> mat M[2,2]
> blkcpy(M, A)
> M
; mat M[2,2]
; blkcpy(M, A)
; M
mat [2,2] (4 elements, 4 nonzero):
[0,0] = 1
[0,1] = 2
[1,0] = 3
[1,1] = 4
> blkcpy(M, A, 2, 2)
> M
; blkcpy(M, A, 2, 2)
; M
mat [2,2] (4 elements, 4 nonzero):
[0,0] = 1
[0,1] = 2
[1,0] = 1
[1,1] = 2
> A = blk() = {1,2,3,4}
> B = blk()
> copy(A,B)
> B
; A = blk() = {1,2,3,4}
; B = blk()
; copy(A,B)
; B
chunksize = 256, maxsize = 256, datalen = 4
01020304
> copy(A,B)
> B
; copy(A,B)
; B
chunksize = 256, maxsize = 256, datalen = 8
0102030401020304
> copy(A,B,1,2)
> B
; copy(A,B,1,2)
; B
chunksize = 256, maxsize = 256, datalen = 10
01020304010203040203
> mat M[2,2]
> copy(A,M)
> M
; mat M[2,2]
; copy(A,M)
; M
mat [2,2] (4 elements, 4 nonzero):
[0,0] = 1
[0,1] = 2
[1,0] = 3
[1,1] = 4
> copy(A,M,2)
> M
; copy(A,M,2)
; M
mat [2,2] (4 elements, 4 nonzero):
[0,0] = 3
[0,1] = 4
[1,0] = 3
[1,1] = 4
> copy(A,M,0,2,2)
> M
; copy(A,M,0,2,2)
; M
mat [2,2] (4 elements, 4 nonzero):
[0,0] = 3
[0,1] = 4
@@ -207,8 +207,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: blkcpy,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: blkcpy,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/blkcpy,v $
##
## Under source code control: 1997/04/05 14:08:50

View File

@@ -23,27 +23,27 @@ DESCRIPTION
EXAMPLE
> B1 = blk("foo")
> B2 = blk("Second block")
; B1 = blk("foo")
; B2 = blk("Second block")
show blocks
id name
---- -----
0 foo
1 Second block
> blkfree(B1)
> show blocks
; blkfree(B1)
; show blocks
id name
---- -----
1 Second block
> B1
; B1
block 0: foo
chunksize = 256, maxsize = 0, datalen = 0
NULL
> blk(B1); B[7] = 5
> B1
; blk(B1); B[7] = 5
; B1
block 0: foo
chunksize = 256, maxsize = 256, datalen = 8
0000000000000005
@@ -73,8 +73,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: blkfree,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: blkfree,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/blkfree,v $
##
## Under source code control: 1997/04/05 13:07:13

View File

@@ -20,17 +20,17 @@ DESCRIPTION
EXAMPLE
> A = blk("alpha")
> B = blk("beta") = {1,2,3}
> blocks()
; A = blk("alpha")
; B = blk("beta") = {1,2,3}
; blocks()
2
> blocks(1)
; blocks(1)
block 1: beta
chunksize = 256, maxsize = 256, datalen = 3
010203
> blocks(2)
; blocks(2)
Error 10211
> strerror()
; strerror()
"Non-allocated index number for blocks"
LIMITS
@@ -58,8 +58,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.3 $
## @(#) $Id: blocks,v 29.3 2002/07/10 11:47:04 chongo Exp $
## @(#) $Revision: 29.4 $
## @(#) $Id: blocks,v 29.4 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/blocks,v $
##
## Under source code control: 1997/04/05 13:07:13

View File

@@ -66,38 +66,38 @@ DESCRIPTION
variables, so their values are not changed by the call.
EXAMPLES
> a = 7/32, b = -7/32
; a = 7/32, b = -7/32
> print a, b
; print a, b
.21875 -.21875
> print round(a,3,0), round(a,3,1), round(a,3,2), print round(a,3,3)
; print round(a,3,0), round(a,3,1), round(a,3,2), print round(a,3,3)
.218, .219, .218, .219
> print round(b,3,0), round(b,3,1), round(b,3,2), print round(b,3,3)
; print round(b,3,0), round(b,3,1), round(b,3,2), print round(b,3,3)
-.219, -.218, -.218, -.219
> print round(a,3,16), round(a,3,17), round(a,3,18), print round(a,3,19)
; print round(a,3,16), round(a,3,17), round(a,3,18), print round(a,3,19)
.2188 .2188 .2188 .2188
> print round(a,4,16), round(a,4,17), round(a,4,18), print round(a,4,19)
; print round(a,4,16), round(a,4,17), round(a,4,18), print round(a,4,19)
.2187 .2188 .2187 .2188
> print round(a,2,8), round(a,3,8), round(a,4,8), round(a,5,8)
; print round(a,2,8), round(a,3,8), round(a,4,8), round(a,5,8)
.22 .218 .2188 .21875
> print round(a,2,24), round(a,3,24), round(a,4,24), round(a,5,24)
; print round(a,2,24), round(a,3,24), round(a,4,24), round(a,5,24)
.22 .219 .2188 .21875
> c = 21875
> print round(c,-2,0), round(c,-2,1), round(c,-3,0), round(c,-3,16)
; c = 21875
; print round(c,-2,0), round(c,-2,1), round(c,-3,0), round(c,-3,16)
21800 21900 21000 22000
> print round(c,2,32), round(c,2,33), round(c,2,56), round(c,4,56)
; print round(c,2,32), round(c,2,33), round(c,2,56), round(c,4,56)
21000 22000 22000 21880
> A = list(1/8, 2/8, 3/8, 4/8, 5/8, 6/8, 7/8)
> print round(A,2,24)
; A = list(1/8, 2/8, 3/8, 4/8, 5/8, 6/8, 7/8)
; print round(A,2,24)
list(7 elements, 7 nonzero):
[[0]] = .12
@@ -138,8 +138,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: bround,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: bround,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/bround,v $
##
## Under source code control: 1994/09/30 00:22:35

View File

@@ -22,16 +22,16 @@ DESCRIPTION
int(x).
EXAMPLE
> print btrunc(pi()), btrunc(pi(), 10)
; print btrunc(pi()), btrunc(pi(), 10)
3 3.140625
> print btrunc(3.3), btrunc(3.7), btrunc(3.3, 2), btrunc(3.7, 2)
; print btrunc(3.3), btrunc(3.7), btrunc(3.3, 2), btrunc(3.7, 2)
3 3 3.25 3.5
> print btrunc(-3.3), btrunc(-3.7), btrunc(-3.3, 2), btrunc(-3.7, 2)
; print btrunc(-3.3), btrunc(-3.7), btrunc(-3.3, 2), btrunc(-3.7, 2)
-3 -3 -3.25 -3.5
> print btrunc(55.123, -4), btrunc(-55.123, -4)
; print btrunc(55.123, -4), btrunc(-55.123, -4)
48 -48
LIMITS
@@ -59,8 +59,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: btrunc,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: btrunc,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/btrunc,v $
##
## Under source code control: 1994/09/30 00:44:27

View File

@@ -18,7 +18,7 @@ DESCRIPTION
> !stty echo -cbreak
EXAMPLE
> calc_tty();
; calc_tty();
LIBRARY
none
@@ -42,8 +42,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.1 $
## @(#) $Id: calc_tty,v 29.1 2000/12/14 10:31:45 chongo Exp $
## @(#) $Revision: 29.2 $
## @(#) $Id: calc_tty,v 29.2 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/calc_tty,v $
##
## Under source code control: 2000/12/14 01:33:00

View File

@@ -25,7 +25,7 @@ DESCRIPTION
from (x,y) = (0,0) to (x,y) = (n,n) for which always y <= x.
EXAMPLE
> print catalan(2), catalan(3), catalan(4), catalan(20)
; print catalan(2), catalan(3), catalan(4), catalan(20)
2 5 14 6564120420
LIMITS
@@ -53,8 +53,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: catalan,v 29.2 2000/12/17 12:27:58 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: catalan,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/catalan,v $
##
## Under source code control: 2000/12/14 01:33:00

View File

@@ -20,7 +20,7 @@ DESCRIPTION
by ceil(t).
EXAMPLE
> print ceil(27), ceil(1.23), ceil(-4.56), ceil(7.8 - 9.1i)
; print ceil(27), ceil(1.23), ceil(-4.56), ceil(7.8 - 9.1i)
27 2 -4 8-9i
LIMITS
@@ -48,8 +48,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: ceil,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: ceil,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/ceil,v $
##
## Under source code control: 1994/09/30 01:12:01

View File

@@ -66,17 +66,17 @@ DESCRIPTION
exceeding n is 1/cfappr(1/x, n, 16).
EXAMPLE
> c = config("mode", "frac")
> x = 43/30; u = cfappr(x, 10, 0); v = cfappr(x, 10, 1);
> print u, v, x - u, v - x, v - u, cfappr(x, 10, 16)
; c = config("mode", "frac")
; x = 43/30; u = cfappr(x, 10, 0); v = cfappr(x, 10, 1);
; print u, v, x - u, v - x, v - u, cfappr(x, 10, 16)
10/7 13/9 1/210 1/90 1/63 10/7
> pi = pi(1e-10)
> print cfappr(pi, 100, 16), cfappr(pi, .01, 16), cfappr(pi, 1e-6, 16)
; pi = pi(1e-10)
; print cfappr(pi, 100, 16), cfappr(pi, .01, 16), cfappr(pi, 1e-6, 16)
311/99 22/7 355/113
> x = 17/12; u = cfappr(x,4,0); v = cfappr(x,4,1);
> print u, v, x - u, v - x, cfappr(x,4,16)
; x = 17/12; u = cfappr(x,4,0); v = cfappr(x,4,1);
; print u, v, x - u, v - x, cfappr(x,4,16)
4/3 3/2 1/12 1/12 3/2
LIMITS
@@ -104,8 +104,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: cfappr,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: cfappr,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/cfappr,v $
##
## Under source code control: 1994/09/30 01:23:59

View File

@@ -95,13 +95,13 @@ DESCRIPTION
cfsim(1/x, rnd) = 1/cfsim(x, rnd).
EXAMPLE
> c = config("mode", "frac");
; c = config("mode", "frac");
> print cfsim(43/30, 0), cfsim(43/30, 1), cfsim(43/30, 8), cfsim(43/30,16)
; print cfsim(43/30, 0), cfsim(43/30, 1), cfsim(43/30, 8), cfsim(43/30,16)
10/7 33/23 10/7 33/23
> x = pi(1e-20); c = config("mode", "frac");
> while (!isint(x)) {x = cfsim(x,8); if (den(x) < 1e6) print x,:;}
; x = pi(1e-20); c = config("mode", "frac");
; while (!isint(x)) {x = cfsim(x,8); if (den(x) < 1e6) print x,:;}
1146408/364913 312689/99532 104348/33215 355/113 22/7 3
LIMITS
@@ -129,8 +129,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: cfsim,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: cfsim,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/cfsim,v $
##
## Under source code control: 1994/09/30 01:29:45

View File

@@ -14,7 +14,7 @@ DESCRIPTION
the same value as j. For j = 0, returns the null string "".
EXAMPLE
> print char(0102), char(0x6f), char(119), char(0145), char(0x6e)
; print char(0102), char(0x6f), char(119), char(0145), char(0x6e)
B o w e n
LIMITS
@@ -42,8 +42,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: char,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: char,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/char,v $
##
## Under source code control: 1994/09/30 01:45:45

View File

@@ -92,16 +92,16 @@ DESCRIPTION
for example, cmp(2, "2"), returns the null value.
EXAMPLE
> print cmp(3,4), cmp(4,3), cmp(4,4), cmp("a","b"), cmp("abcd","abc")
; print cmp(3,4), cmp(4,3), cmp(4,4), cmp("a","b"), cmp("abcd","abc")
-1 1 0 -1 1
> print cmp(3,4i), cmp(4,4i), cmp(5,4i), cmp(-5,4i), cmp(-4i,5), cmp(-4i,-5)
; print cmp(3,4i), cmp(4,4i), cmp(5,4i), cmp(-5,4i), cmp(-4i,5), cmp(-4i,-5)
1-1i 1-1i 1-1i -1-1i -1-1i 1-1i
> print cmp(3i,4i), cmp(4i,4i), cmp(5i,4i), cmp(3+4i,5), cmp(3+4i,-5)
; print cmp(3i,4i), cmp(4i,4i), cmp(5i,4i), cmp(3+4i,5), cmp(3+4i,-5)
-1i 0 1i -1+1i 1+1i
> print cmp(3+4i,3+4i), cmp(3+4i,3-4i), cmp(3+4i,2+3i), cmp(3+4i,-4-5i)
; print cmp(3+4i,3+4i), cmp(3+4i,3-4i), cmp(3+4i,2+3i), cmp(3+4i,-4-5i)
0 1i 1+1i 1+1i
LIMITS
@@ -130,8 +130,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: cmp,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: cmp,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/cmp,v $
##
## Under source code control: 1994/10/20 02:52:30

View File

@@ -21,10 +21,10 @@ DESCRIPTION
may be chosen from x items ignoring the order in which they are chosen.
EXAMPLE
> print comb(7,3), comb(7,4), comb(7,5), comb(3,0), comb(0,0)
; print comb(7,3), comb(7,4), comb(7,5), comb(3,0), comb(0,0)
35 35 21 1 1
> print comb(2^31+1,2^31-1)
; print comb(2^31+1,2^31-1)
2305843010287435776
LIMITS
@@ -54,8 +54,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: comb,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: comb,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/comb,v $
##
## Under source code control: 1994/10/20 04:03:02

View File

@@ -18,6 +18,7 @@ Command sequence
-----------------
define function(params) { body }
define function(params) = expression
This first form defines a full function which can consist
of declarations followed by many statements which implement
the function.
@@ -42,16 +43,30 @@ Command sequence
read calc commands
------------------
read $var
read -once $var
read filename
read -once filename
This reads definitions from the specified calc resource filename.
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. If CALCPATH is not defined,
then a default path which is usually ":/usr/local/lib/calc"
is used.
In the 1st and 2nd forms, if var is a global variable string
value, then the value of that variable is used as a filename.
The following is equivalent to read lucas.cal or read "lucas.cal":
global var = "lucas.cal";
read $var;
In the 3rd or 4th forms, the filename argument is treated
as a literal string, not a variable. In these forms, 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.
If CALCPATH is not defined, then a default path which is
usually ":/usr/local/lib/calc" is used.
The ".cal" extension is defaulted for input files, so that
if "filename" is not found, then "filename.cal" is then
@@ -76,7 +91,9 @@ Command sequence
write calc commands
-------------------
write $var
write filename
This writes the values of all global variables to the
specified filename, in such a way that the file can be
later read in order to recreate the variable values.
@@ -85,6 +102,19 @@ Command sequence
matrices, lists, and objects are not saved. Function
definitions are also not saved.
In the 1st form, if var is a global variable string
value, then the value of that variable is used as a filename.
The following is equivalent to write dump.out or
write "dump.out":
global var = "dump.out";
write $var;
In the 2nd form, the filename argument is treated as a literal
string, not a variable. In this form, the name can be quoted
if desired.
If the -m mode disallows opening of files for writing,
this command will be disabled.
@@ -95,6 +125,7 @@ Command sequence
quit string
exit
exit string
The action of these commands depends on where they are used.
At the interactive level, they will cause calc it edit.
This is the normal way to leave the calculator. In any
@@ -131,6 +162,7 @@ Command sequence
-----
abort
abort string
This command behaves like QUIT except that it will attempt
to return to the interactive level if permitted, otherwise
calc exit.
@@ -143,6 +175,7 @@ Command sequence
------------------------
cd
cd dir
Change the current directory to 'dir'. If 'dir' is ommitted,
change the current directory to the home directory, if $HOME
is set in the environment.
@@ -151,6 +184,7 @@ Command sequence
show information
----------------
show item
This command displays some information where 'item' is
one of the following:
@@ -185,11 +219,24 @@ Command sequence
calc help
---------
help
help $var
help name
This displays a help related to 'name' or general
help of none is given.
In the 1st form, if var is a global variable string
value, then the value of that variable is used as a name.
The following is equivalent to help command or help "command":
global var = "command";
help $var;
In the 2nd form, the filename argument is treated as a literal
string, not a variable. In this form, the name can be quoted
if desired.
=-=
@@ -323,8 +370,8 @@ Command sequence
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: command,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: command,v 29.3 2006/05/20 10:01:33 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/command,v $
##
## Under source code control: 1991/07/21 04:37:17

View File

@@ -28,7 +28,7 @@ DESCRIPTION
conjugate of the corresponding component of a.
EXAMPLE
> print conj(3), conj(3 + 4i)
; print conj(3), conj(3 + 4i)
3 3-4i
LIMITS
@@ -56,8 +56,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: conj,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: conj,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/conj,v $
##
## Under source code control: 1995/10/03 10:40:01

View File

@@ -15,14 +15,14 @@ DESCRIPTION
absolute value than .75 * eps.
EXAMPLE
> print cos(1, 1e-5), cos(1, 1e-10), cos(1, 1e-15), cos(1, 1e-20)
; print cos(1, 1e-5), cos(1, 1e-10), cos(1, 1e-15), cos(1, 1e-20)
.5403 .5403023059 .54030230586814 .5403023058681397174
> print cos(2 + 3i, 1e-5), cos(2 + 3i, 1e-10)
; print cos(2 + 3i, 1e-5), cos(2 + 3i, 1e-10)
-4.18963-9.10923i -4.189625691-9.1092278938i
> pi = pi(1e-20)
> print cos(pi/3, 1e-10), cos(pi/2, 1e-10), cos(pi, 1e-10)
; pi = pi(1e-20)
; print cos(pi/3, 1e-10), cos(pi/2, 1e-10), cos(pi, 1e-10)
.5 0 -1
LIMITS
@@ -51,8 +51,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.3 $
## @(#) $Id: cos,v 29.3 2005/10/18 10:48:29 chongo Exp $
## @(#) $Revision: 29.4 $
## @(#) $Id: cos,v 29.4 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/cos,v $
##
## Under source code control: 1994/03/19 01:40:27

View File

@@ -17,7 +17,7 @@ DESCRIPTION
cosh(x) = (exp(x) + exp(-x))/2
EXAMPLE
> print cosh(1, 1e-5), cosh(1, 1e-10), cosh(1, 1e-15), cosh(1, 1e-20)
; print cosh(1, 1e-5), cosh(1, 1e-10), cosh(1, 1e-15), cosh(1, 1e-20)
1.54308 1.5430806348 1.543080634815244 1.54308063481524377848
LIMITS
@@ -45,8 +45,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: cosh,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: cosh,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/cosh,v $
##
## Under source code control: 1994/03/19 01:40:28

View File

@@ -15,7 +15,7 @@ DESCRIPTION
in absolute value than .75 * eps.
EXAMPLE
> print cot(1, 1e-5), cot(1, 1e-10), cot(1, 1e-15), cot(1, 1e-20)
; print cot(1, 1e-5), cot(1, 1e-10), cot(1, 1e-15), cot(1, 1e-20)
.64209 .6420926159 .642092615934331 .64209261593433070301
LIMITS
@@ -43,8 +43,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: cot,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: cot,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/cot,v $
##
## Under source code control: 1995/11/13 03:49:00

View File

@@ -17,7 +17,7 @@ DESCRIPTION
coth(x) = (exp(2*x) + 1)/(exp(2*x) - 1)
EXAMPLE
> print coth(1, 1e-5), coth(1, 1e-10), coth(1, 1e-15), coth(1, 1e-20)
; print coth(1, 1e-5), coth(1, 1e-10), coth(1, 1e-15), coth(1, 1e-20)
1.31304 1.3130352855 1.313035285499331 1.31303528549933130364
LIMITS
@@ -45,8 +45,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: coth,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: coth,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/coth,v $
##
## Under source code control: 1995/11/13 03:49:00

View File

@@ -16,9 +16,9 @@ DESCRIPTION
tests as "true".
EXAMPLE
> define f(a) = (a < 5)
> A = list(1,2,7,6,4,8)
> count(A, "f")
; define f(a) = (a < 5)
; A = list(1,2,7,6,4,8)
; count(A, "f")
3
LIMITS
@@ -46,8 +46,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: count,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: count,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/count,v $
##
## Under source code control: 1995/07/10 02:09:31

10
help/cp
View File

@@ -17,9 +17,9 @@ DESCRIPTION
{x1 * y2 - x2 * y1, x3 * y1 - x1 * y3, x1 * y2 - x2 * y1}
EXAMPLE
> mat x[3] = {2,3,4}
> mat y[3] = {3,4,5}
> print cp(x,y)
; mat x[3] = {2,3,4}
; mat y[3] = {3,4,5}
; print cp(x,y)
mat [3] (3 elements, 3 nonzero):
[0] = -1
@@ -52,8 +52,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: cp,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: cp,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/cp,v $
##
## Under source code control: 1995/10/05 04:52:26

View File

@@ -15,7 +15,7 @@ DESCRIPTION
in absolute value than .75 * eps.
EXAMPLE
> print csc(1, 1e-5), csc(1, 1e-10), csc(1, 1e-15), csc(1, 1e-20)
; print csc(1, 1e-5), csc(1, 1e-10), csc(1, 1e-15), csc(1, 1e-20)
1.1884 1.1883951058 1.188395105778121 1.18839510577812121626
LIMITS
@@ -43,8 +43,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: csc,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: csc,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/csc,v $
##
## Under source code control: 1995/11/13 03:49:00

View File

@@ -17,7 +17,7 @@ DESCRIPTION
csch(x) = 2/(exp(x) - exp(-x))
EXAMPLE
> print csch(1, 1e-5), csch(1, 1e-10), csch(1, 1e-15), csch(1, 1e-20)
; print csch(1, 1e-5), csch(1, 1e-10), csch(1, 1e-15), csch(1, 1e-20)
.85092 .8509181282 .850918128239322 .85091812823932154513
LIMITS
@@ -45,8 +45,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: csch,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: csch,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/csch,v $
##
## Under source code control: 1995/11/13 03:49:00

View File

@@ -16,7 +16,7 @@ DESCRIPTION
The 25th ctime() character, '\n' is removed.
EXAMPLE
> printf("The time is now %s.\n", ctime())
; printf("The time is now %s.\n", ctime())
The time is now Mon Apr 15 12:41:44 1996.
LIMITS
@@ -44,8 +44,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: ctime,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: ctime,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/ctime,v $
##
## Under source code control: 1996/04/30 03:05:18

View File

@@ -70,19 +70,19 @@ DESCRIPTION
EXAMPLE
If calc compiled with ALLOW_CUSTOM= (custom disabled):
> print custom("sysinfo", "baseb")
; print custom("sysinfo", "baseb")
Calc was built with custom functions disabled
Error 10195
If calc compiled with ALLOW_CUSTOM= -DCUSTOM and is invoked without -C:
> print custom("sysinfo", "baseb")
; print custom("sysinfo", "baseb")
Calc must be run with a -C argument to use custom function
Error 10194
If calc compiled with ALLOW_CUSTOM= -DCUSTOM and is invoked with -C:
> print custom("sysinfo", "baseb")
; print custom("sysinfo", "baseb")
32
LIMITS
@@ -110,8 +110,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: custom,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: custom,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/custom,v $
##
## Under source code control: 1997/03/09 16:33:22

View File

@@ -166,8 +166,8 @@ DESCRIPTION
matrices or objects.
EXAMPLE
> define f(a,b) = 2*a + b;
> define g(alpha, beta)
; define f(a,b) = 2*a + b;
; define g(alpha, beta)
>> {
>> local a, pi2;
>>
@@ -207,8 +207,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.3 $
## @(#) $Id: define,v 29.3 2000/07/17 15:36:26 chongo Exp $
## @(#) $Revision: 29.4 $
## @(#) $Id: define,v 29.4 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/define,v $
##
##

View File

@@ -15,7 +15,7 @@ DESCRIPTION
the value of this element.
EXAMPLE
> lst = list(2,3,4,5)
; lst = list(2,3,4,5)
list (4 elements, 4 nonzero):
[[0]] = 2
@@ -23,9 +23,9 @@ EXAMPLE
[[2]] = 4
[[3]] = 5
> delete(lst, 2)
; delete(lst, 2)
4
> print lst
; print lst
list (3 elements, 3 nonzero):
[[0]] = 2
@@ -57,8 +57,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: delete,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: delete,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/delete,v $
##
## Under source code control: 1994/03/19 03:13:18

View File

@@ -26,7 +26,7 @@ DESCRIPTION
The denominator for this n/d is d.
EXAMPLE
> print den(7), den(-1.25), den(121/33)
; print den(7), den(-1.25), den(121/33)
1 4 3
LIMITS
@@ -54,8 +54,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: den,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: den,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/den,v $
##
## Under source code control: 1995/10/05 04:52:26

View File

@@ -58,18 +58,18 @@ DESCRIPTION
**c returns the lvalue a; ***c returns the value of a.
EXAMPLE
> mat A[3] = {1,2,3}
> p = &A[0]
> print *p, *(p + 1), *(p + 2)
; mat A[3] = {1,2,3}
; p = &A[0]
; print *p, *(p + 1), *(p + 2)
1 2 3
> *(p + 1) = 4
> print A[1]
; *(p + 1) = 4
; print A[1]
4
> A[0] = &a
> a = 7
> print **p
; A[0] = &a
; a = 7
; print **p
7
LIMITS
@@ -97,8 +97,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: dereference,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: dereference,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/dereference,v $
##
## Under source code control: 1997/09/06 20:03:34

View File

@@ -37,25 +37,25 @@ DESCRIPTION
- (a * h - g * b) * (a * f - d * c))/a.
EXAMPLE
> mat A[3,3] = {2, 3, 5, 7, 11, 13, 17, 19, 23}
> c = config("mode", "frac")
> print det(A), det(A^2), det(A^3), det(A^-1)
; mat A[3,3] = {2, 3, 5, 7, 11, 13, 17, 19, 23}
; c = config("mode", "frac")
; print det(A), det(A^2), det(A^3), det(A^-1)
-78 6084 -474552 -1/78
> obj res {r}
> global md
> define res_test(a) = !ismult(a.r, md)
> define res_sub(a,b) {local obj res v = {(a.r - b.r) % md}; return v;}
> define res_mul(a,b) {local obj res v = {(a.r * b.r) % md}; return v;}
> define res_neg(a) {local obj res v = {(-a.r) % md}; return v;}
> define res(x) {local obj res v = {x % md}; return v;}
> md = 0
> mat A[2,2] = {res(2), res(3), res(5), res(7)}
> md = 5
> print det(A)
; obj res {r}
; global md
; define res_test(a) = !ismult(a.r, md)
; define res_sub(a,b) {local obj res v = {(a.r - b.r) % md}; return v;}
; define res_mul(a,b) {local obj res v = {(a.r * b.r) % md}; return v;}
; define res_neg(a) {local obj res v = {(-a.r) % md}; return v;}
; define res(x) {local obj res v = {x % md}; return v;}
; md = 0
; mat A[2,2] = {res(2), res(3), res(5), res(7)}
; md = 5
; print det(A)
obj res {4}
> md = 6
> print det(A)
; md = 6
; print det(A)
obj res {5}
Note that if A had been a 3 x 3 or larger matrix, res_div(a,b) for
@@ -89,8 +89,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: det,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: det,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/det,v $
##
## Under source code control: 1995/11/28 11:17:47

View File

@@ -29,16 +29,16 @@ DESCRIPTION
digits(-0.123) == 1 combination of all of the above
EXAMPLE
> print digits(100), digits(23209), digits(2^72)
; print digits(100), digits(23209), digits(2^72)
3 5 22
> print digits(0), digits(1), digits(-1)
; print digits(0), digits(1), digits(-1)
1 1 1
> print digits(-1234), digits(12.3456), digits(107.207)
; print digits(-1234), digits(12.3456), digits(107.207)
4 2 3
> print digits(17^463-1, 17), digits(10000, 100), digits(21701, 2)
; print digits(17^463-1, 17), digits(10000, 100), digits(21701, 2)
3, 15 14
LIMITS
@@ -66,8 +66,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.5 $
## @(#) $Id: digits,v 29.5 2003/01/26 19:41:35 chongo Exp $
## @(#) $Revision: 29.6 $
## @(#) $Id: digits,v 29.6 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/digits,v $
##
## Under source code control: 1995/10/03 10:40:01

View File

@@ -36,13 +36,13 @@ DESCRIPTION
the type of rounding to be used is controlled by config("outround").
EXAMPLE
> print display(), 2/3
; print display(), 2/3
20 ~0.66666666666666666667
> print display(40), 2/3
; print display(40), 2/3
20 ~0.6666666666666666666666666666666666666667
> print display(5), 2/3
; print display(5), 2/3
40 ~0.66667
LIMITS
@@ -70,8 +70,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.1 $
## @(#) $Id: display,v 29.1 2004/07/26 06:54:41 chongo Exp $
## @(#) $Revision: 29.2 $
## @(#) $Id: display,v 29.2 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/display,v $
##
## Under source code control: 2004/07/25 23:50:40

10
help/dp
View File

@@ -22,9 +22,9 @@ DESCRIPTION
x0*y0 + x1*y1 + ... + xn*yn
EXAMPLE
> mat x[3] = {2,3,4}
> mat y[1:3] = {3,4,5}
> print dp(x,y)
; mat x[3] = {2,3,4}
; mat y[1:3] = {3,4,5}
; print dp(x,y)
38
LIMITS
@@ -52,8 +52,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: dp,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: dp,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/dp,v $
##
## Under source code control: 1995/10/05 04:52:26

View File

@@ -3,8 +3,9 @@ Environment variables
CALCPATH
A :-separated list of directories used to search for
resource filenames (*.cal files) that do not begin with
/, ./ or ~.
resource filenames (*.cal files) that do not begin with:
/ ./ ../ ~
If this variable does not exist, a compiled value
is used. Typically compiled in value is:
@@ -104,8 +105,8 @@ Environment variables
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.3 $
## @(#) $Id: environment,v 29.3 2004/07/26 07:10:43 chongo Exp $
## @(#) $Revision: 29.4 $
## @(#) $Id: environment,v 29.4 2006/05/07 07:22:20 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/environment,v $
##
## Under source code control: 1991/07/23 05:47:25

View File

@@ -19,9 +19,9 @@ DESCRIPTION
the functions appr(x, eps, rnd), sqrt(x, eps, rnd), etc.
EXAMPLE
> oldeps = epsilon(1e-6)
> print epsilon(), sqrt(2), epsilon(1e-4), sqrt(2), epsilon(oldeps)
> .000001 1.414214 .000001 1.4142 .0001
; oldeps = epsilon(1e-6)
; print epsilon(), sqrt(2), epsilon(1e-4), sqrt(2), epsilon(oldeps)
; .000001 1.414214 .000001 1.4142 .0001
LIMITS
none
@@ -49,8 +49,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: epsilon,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: epsilon,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/epsilon,v $
##
## Under source code control: 1995/10/05 04:52:26

View File

@@ -28,12 +28,12 @@ DESCRIPTION
errcount.
EXAMPLE
> errmax(10)
; errmax(10)
0
> errcount()
; errcount()
0
> a = 1/0; b = 2 + ""; c = error(27); d = newerror("a");
> print errcount(), a, errcount(), errmax();
; a = 1/0; b = 2 + ""; c = error(27); d = newerror("a");
; print errcount(), a, errcount(), errmax();
4 Error 10001 4 10
LIMITS
@@ -43,9 +43,10 @@ LINK LIBRARY
none
SEE ALSO
errmax, error, strerror, iserror, errno, newerror, errorcodes
errmax, error, strerror, iserror, errno, newerror, errorcodes,
stoponerror
## Copyright (C) 1999 Landon Curt Noll
## Copyright (C) 1999-2006 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
@@ -61,8 +62,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: errcount,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.4 $
## @(#) $Id: errcount,v 29.4 2006/05/21 07:31:35 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/errcount,v $
##
## Under source code control: 1997/03/08 08:51:14

View File

@@ -13,33 +13,39 @@ DESCRIPTION
Without an argument, errmax() returns the current value of an
internal variable errmax. Calling errmax(num) returns this value
but then resets its value to num. Execution is aborted if
evaluation of an error value if this makes errcount > errmax.
An error message displays the errno for the error.
evaluation of an error value if this makes errcount > errmax
and errmax is >= 0.
When errmax is -1, there is no limit on the number of errors.
EXAMPLE
> errmax(2)
; errmax(2)
0
> errcount()
; errcount()
0
> a = 1/0; b = 2 + ""; c = error(27); d = newerror("alpha");
; a = 1/0; b = 2 + ""; c = error(27); d = newerror("alpha");
Error 27 caused errcount to exceed errmax
> print c, d
## Here global variables c and d were created when compiling the line
## but execution was aborted before the intended assignments to c and d.
; print c, d
0 0
Here global variables c and d were created when compiling the line
but execution was aborted before the intended assignments to c and d.
; errmax(-1)
2
LIMITS
0 <= num < 2^32
-1 <= num <= 2147483647
LINK LIBRARY
none
SEE ALSO
errcount, error, strerror, iserror, errno, newerror, errorcodes
errcount, error, strerror, iserror, errno, newerror, errorcodes,
stoponerror
## Copyright (C) 1999 Landon Curt Noll
## Copyright (C) 2006 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
@@ -55,8 +61,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: errmax,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.6 $
## @(#) $Id: errmax,v 29.6 2006/05/21 07:31:35 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/errmax,v $
##
## Under source code control: 1997/03/08 08:51:14

View File

@@ -33,15 +33,15 @@ DESCRIPTION
EXAMPLE
Assuming there is no file with name "not_a_file"
> errno(0)
> errmax(errcount()+4)
; errno(0)
; errmax(errcount()+4)
0
> badfile = fopen("not_a_file", "r")
> print errno(), error(), strerror()
; badfile = fopen("not_a_file", "r")
; print errno(), error(), strerror()
2 System error 2 No such file or directory
> a = 1/0
> print errno(), error(), strerror()
; a = 1/0
; print errno(), error(), strerror()
10001 Error 10001 Division by zero
LIMITS
@@ -51,9 +51,10 @@ LINK LIBRARY
none
SEE ALSO
errmax, errcount, error, strerror, iserror, newerror, errorcodes
errmax, errcount, error, strerror, iserror, newerror, errorcodes,
stoponerror
## Copyright (C) 1999 Landon Curt Noll
## Copyright (C) 1999-2006 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
@@ -69,8 +70,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: errno,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.4 $
## @(#) $Id: errno,v 29.4 2006/05/21 07:31:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/errno,v $
##
## Under source code control: 1994/10/27 03:05:08

View File

@@ -22,13 +22,13 @@ EXAMPLE
Note that by default, errmax() is 0 so unless errmax() is
increased you will get:
> ba = error(10009)
; ba = error(10009)
Error 10009 caused errcount to exceed errmax
> errmax(errcount()+1)
; errmax(errcount()+1)
0
> a = error(10009)
> a
; a = error(10009)
; a
Error 10009
LIMITS
@@ -38,9 +38,10 @@ LINK LIBRARY
none
SEE ALSO
errcount, errmax, errorcodes, iserror, errno, strerror, newerror
errcount, errmax, errorcodes, iserror, errno, strerror, newerror,
stoponerror
## Copyright (C) 1999 Landon Curt Noll
## Copyright (C) 1999-2006 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
@@ -56,8 +57,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: error,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.4 $
## @(#) $Id: error,v 29.4 2006/05/21 07:31:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/error,v $
##
## Under source code control: 1995/12/18 03:30:59

View File

@@ -25,7 +25,7 @@ DESCRIPTION
euler(n) for large even n.
EXAMPLE
> for (n = 0; n <= 6; n++) print euler(n),; print;
; for (n = 0; n <= 6; n++) print euler(n),; print;
1 0 -1 0 5 0 -61
LIMITS
@@ -53,8 +53,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: euler,v 29.2 2000/12/17 12:27:58 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: euler,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/euler,v $
##
## Under source code control: 2000/12/14 01:33:00

View File

@@ -30,18 +30,18 @@ DESCRIPTION
the scanerror messages and returns the value error(49).
EXAMPLE
> str1 = "2 + 3"; print eval(str1);
; str1 = "2 + 3"; print eval(str1);
5
> i = 10; str2 = "local i = 0; 7; while (i++ < 5) print i^2,:;"
> print i, eval(str2), i
; i = 10; str2 = "local i = 0; 7; while (i++ < 5) print i^2,:;"
; print i, eval(str2), i
10 1 4 9 16 25 7 10
(The print statements in str2 return the null value, so execution of
eval(str2) ends by returning the saved value 7. The global variable
i is unchanged.)
> eval("2 + ");
; eval("2 + ");
Missing expression
49
@@ -76,8 +76,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: eval,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: eval,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/eval,v $
##
## Under source code control: 1995/12/18 03:30:59

View File

@@ -18,16 +18,16 @@ DESCRIPTION
will give many significant figures.
EXAMPLE
> print exp(2, 1e-5), exp(2,1e-10), exp(2, 1e-15), exp(2, 1e-20)
; print exp(2, 1e-5), exp(2,1e-10), exp(2, 1e-15), exp(2, 1e-20)
7.38906 7.3890560989 7.38905609893065 7.38905609893065022723
> print exp(30, 1e5), exp(30, 1), exp(30, 1e-10)
; print exp(30, 1e5), exp(30, 1), exp(30, 1e-10)
10686474600000 10686474581524 10686474581524.4621469905
> print exp(-20, 1e-5), exp(-20, 1e-10), exp(-20, 1e-15), exp(-20, 1e-20)
; print exp(-20, 1e-5), exp(-20, 1e-10), exp(-20, 1e-15), exp(-20, 1e-20)
0 .0000000021 .000000002061154 .00000000206115362244
> print exp(1+2i, 1e-5), exp(1+2i, 1e-10)
; print exp(1+2i, 1e-5), exp(1+2i, 1e-10)
-1.1312+2.47173i -1.1312043838+2.471726672i
LIMITS
@@ -56,8 +56,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.3 $
## @(#) $Id: exp,v 29.3 2005/10/18 10:48:29 chongo Exp $
## @(#) $Revision: 29.4 $
## @(#) $Id: exp,v 29.4 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/exp,v $
##
## Under source code control: 1995/10/11 04:41:26

View File

@@ -16,10 +16,10 @@ DESCRIPTION
0! = 1
EXAMPLE
> print fact(10), fact(5), fact(2), fact(1), fact(0)
; print fact(10), fact(5), fact(2), fact(1), fact(0)
3628800 120 2 1 1
> print fact(40)
; print fact(40)
815915283247897734345611269596115894272000000000
LIMITS
@@ -48,8 +48,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: fact,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: fact,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fact,v $
##
## Under source code control: 1994/10/20 04:03:02

View File

@@ -25,10 +25,10 @@ DESCRIPTION
factor(n, limit, err) returns the value of err.
EXAMPLE
> print factor(35,4), factor(35,5), factor(35), factor(-35)
; print factor(35,4), factor(35,5), factor(35), factor(-35)
1 5 5 -1
> print factor(2^32 + 1), factor(2^47 - 1), factor(2^59 - 1)
; print factor(2^32 + 1), factor(2^47 - 1), factor(2^59 - 1)
641 2351 179951
LIMITS
@@ -56,8 +56,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: factor,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: factor,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/factor,v $
##
## Under source code control: 1995/12/18 12:34:57

View File

@@ -30,15 +30,15 @@ DESCRIPTION
this case.
EXAMPLE
> fd = fopen("/etc/motd", "r")
> if (fd) print "file is open";
; fd = fopen("/etc/motd", "r")
; if (fd) print "file is open";
file is open
> err = fclose(fd);
> if (isnull(err)) print "close successful"; else errno(err);
; err = fclose(fd);
; if (isnull(err)) print "close successful"; else errno(err);
close successful
> if (!fd) print "file is closed";
; if (!fd) print "file is closed";
file is closed
LIMITS
@@ -67,8 +67,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: fclose,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: fclose,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fclose,v $
##
## Under source code control: 1994/10/27 03:04:16

View File

@@ -18,7 +18,7 @@ DESCRIPTION
If x is zero or if y = -1, 0 or 1, fcnt(x,y) is defined to be zero.
EXAMPLE
> print fcnt(7,4), fcnt(24,4), fcnt(48,4)
; print fcnt(7,4), fcnt(24,4), fcnt(48,4)
0 1 2
LIMITS
@@ -46,8 +46,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: fcnt,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: fcnt,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fcnt,v $
##
## Under source code control: 1995/12/18 12:03:02

View File

@@ -18,18 +18,18 @@ DESCRIPTION
positioning operations (fseek, rewind, fsetpos) and by freopen.
EXAMPLE
> fd1 = fopen("/tmp/newfile", "w")
> fputs(fd1, "Chongo was here\n")
> fflush(fd1)
> fd2 = fopen("/tmp/newfile", "r")
> feof(fd2)
; fd1 = fopen("/tmp/newfile", "w")
; fputs(fd1, "Chongo was here\n")
; fflush(fd1)
; fd2 = fopen("/tmp/newfile", "r")
; feof(fd2)
0
> fgetline(fd2)
; fgetline(fd2)
"Chongo was here"
> feof(fd2)
; feof(fd2)
0
> fgetline(fd2)
> feof(fd2)
; fgetline(fd2)
; feof(fd2)
1
LIMITS
@@ -59,8 +59,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: feof,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: feof,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/feof,v $
##
## Under source code control: 1994/10/27 03:04:17

View File

@@ -18,8 +18,8 @@ DESCRIPTION
0 is returned.
EXAMPLE
> fd = fopen("/etc/motd", "r")
> ferror(fd)
; fd = fopen("/etc/motd", "r")
; ferror(fd)
0
LIMITS
@@ -48,8 +48,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: ferror,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: ferror,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/ferror,v $
##
## Under source code control: 1994/10/27 03:04:17

View File

@@ -13,9 +13,9 @@ DESCRIPTION
This function forces a buffered output to the file associated with fd.
EXAMPLE
> fd = fopen("/tmp/file", "w")
> fputc(fd, "@");
> fflush(fd)
; fd = fopen("/tmp/file", "w")
; fputc(fd, "@");
; fflush(fd)
LIMITS
fd must be associated with an open file
@@ -43,8 +43,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: fflush,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: fflush,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fflush,v $
##
## Under source code control: 1994/10/27 03:04:17

View File

@@ -18,10 +18,10 @@ DESCRIPTION
of EOF or error, nil is returned.
EXAMPLE
> fd = fopen("/tmp/newfile", "w")
> fputs(fd, "chongo was here\n")
> fd2 = fopen("/tmp/newfile", "r")
> fgetc(fd2)
; fd = fopen("/tmp/newfile", "w")
; fputs(fd, "chongo was here\n")
; fd2 = fopen("/tmp/newfile", "r")
; fgetc(fd2)
"c"
LIMITS
@@ -50,8 +50,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: fgetc,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: fgetc,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fgetc,v $
##
## Under source code control: 1995/03/04 11:33:19

View File

@@ -23,23 +23,23 @@ DESCRIPTION
EXAMPLE
> f = fopen("/tmp/junk", "w")
> fputs(f, " Alpha Beta \n")
> freopen(f, "r")
> fgetfield(f)
; f = fopen("/tmp/junk", "w")
; fputs(f, " Alpha Beta \n")
; freopen(f, "r")
; fgetfield(f)
"Alpha"
> fgetfield(f)
; fgetfield(f)
"Beta"
> fgetfield(f)
; fgetfield(f)
>
> freopen(f, "w")
> fputstr(f, " Alpha ", "Beta")
> freopen(f, "r")
> fgetfield(f)
; freopen(f, "w")
; fputstr(f, " Alpha ", "Beta")
; freopen(f, "r")
; fgetfield(f)
"Alpha"
> fgetfield(f)
; fgetfield(f)
""
> fgetfield(f)
; fgetfield(f)
"Beta"
LIMITS
@@ -67,8 +67,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: fgetfield,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: fgetfield,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fgetfield,v $
##
## Under source code control: 1996/04/30 03:05:17

View File

@@ -25,19 +25,19 @@ DESCRIPTION
(EOF or ERROR) nil is returned.
EXAMPLE
> fd = fopen("/tmp/newfile", "w")
> fputs(fd, "chongo was here\n")
> fputs(fd, "123\n")
> fd2 = fopen("/tmp/newfile", "r")
> fgets(fd2)
; fd = fopen("/tmp/newfile", "w")
; fputs(fd, "chongo was here\n")
; fputs(fd, "123\n")
; fd2 = fopen("/tmp/newfile", "r")
; fgets(fd2)
"chongo was here
"
> fclose(fd2)
> fd2 = fopen("/tmp/newfile", "r")
> fgetline(fd2)
; fclose(fd2)
; fd2 = fopen("/tmp/newfile", "r")
; fgetline(fd2)
"chongo was here"
> eval(fgetline(fd2))
; eval(fgetline(fd2))
123
LIMITS
@@ -66,8 +66,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: fgetline,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: fgetline,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fgetline,v $
##
## Under source code control: 1995/03/04 11:33:19

View File

@@ -17,16 +17,16 @@ DESCRIPTION
If a line is read, it is returned, otherwise (EOF or ERROR) nil is returned.
EXAMPLE
> fd = fopen("/tmp/newfile", "w")
> fputs(fd, "chongo was here\n")
> fd2 = fopen("/tmp/newfile", "r")
> fgets(fd2)
; fd = fopen("/tmp/newfile", "w")
; fputs(fd, "chongo was here\n")
; fd2 = fopen("/tmp/newfile", "r")
; fgets(fd2)
"chongo was here
"
> fclose(fd2)
> fd2 = fopen("/tmp/newfile", "r")
> fgetline(fd2)
; fclose(fd2)
; fd2 = fopen("/tmp/newfile", "r")
; fgetline(fd2)
"chongo was here"
LIMITS
@@ -55,8 +55,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: fgets,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: fgets,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fgets,v $
##
## Under source code control: 1995/03/04 11:33:19

View File

@@ -25,17 +25,17 @@ DESCRIPTION
entered (on many terminals this is by ctrl-@).
EXAMPLE
> f = fopen("/tmp/junk", "w")
> fputstr(f, " Alpha Beta ", "", "Gamma\n\tDelta")
> freopen(f, "r")
> fgetstr(f)
; f = fopen("/tmp/junk", "w")
; fputstr(f, " Alpha Beta ", "", "Gamma\n\tDelta")
; freopen(f, "r")
; fgetstr(f)
" Alpha Beta "
> fgetstr(f)
; fgetstr(f)
""
> fgetstr(f)
; fgetstr(f)
"Gamma
Delta"
> fgetstr(f)
; fgetstr(f)
>
LIMITS
@@ -63,8 +63,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: fgetstr,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: fgetstr,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fgetstr,v $
##
## Under source code control: 1996/04/30 03:05:17

View File

@@ -15,7 +15,7 @@ DESCRIPTION
or negative) fib(n) = fib(n-1) + fib(n-2).
EXAMPLE
> print fib(-2), fib(-1), fib(0), fib(1), fib(2), fib(3), fib(4), fib(5)
; print fib(-2), fib(-1), fib(0), fib(1), fib(2), fib(3), fib(4), fib(5)
-1 1 0 1 1 2 3 5 -8
LIMITS
@@ -43,8 +43,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: fib,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: fib,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fib,v $
##
## Under source code control: 1995/10/25 04:03:45

View File

@@ -42,20 +42,20 @@ DESCRIPTION
"A line of text in the file on descriptor 5"
EXAMPLE
> fd = fopen("/etc/motd", "r")
> fd
; fd = fopen("/etc/motd", "r")
; fd
FILE 3 "/etc/motd" (reading, pos 0)
> files(3)
; files(3)
FILE 3 "/etc/motd" (reading, pos 0)
> if (isnull(files(4))) print "not open"
; if (isnull(files(4))) print "not open"
not open
> stdin = files(0)
> stdout = files(1)
> stderr = files(2)
; stdin = files(0)
; stdout = files(1)
; stderr = files(2)
> print files()
; print files()
20
LIMITS
@@ -84,8 +84,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: files,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: files,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/files,v $
##
## Under source code control: 1995/03/04 11:33:19

View File

@@ -20,7 +20,7 @@ DESCRIPTION
by floor(t).
EXAMPLE
> print floor(27), floor(1.23), floor(-4.56), floor(7.8 - 9.1i)
; print floor(27), floor(1.23), floor(-4.56), floor(7.8 - 9.1i)
27 1 -5 7-10i
LIMITS
@@ -48,8 +48,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: floor,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: floor,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/floor,v $
##
## Under source code control: 1994/09/30 01:12:01

View File

@@ -78,20 +78,20 @@ DESCRIPTION
You can the errno() builtin to determine what the errno number means.
EXAMPLE
> fd = fopen("/etc/motd", "r")
> print fd
; fd = fopen("/etc/motd", "r")
; print fd
"/etc/motd"
> fd
; fd
FILE 3 "/etc/motd" (reading, pos 0)
> outfile = fopen("~/tmp/output", "w")
> print outfile
; outfile = fopen("~/tmp/output", "w")
; print outfile
"~/tmp/output"
> outfile
; outfile
FILE 4 "~/tmp/output" (writing, pos 0)
> badfile = fopen("not_a_file", "r")
> if (!isfile(badfile)) print "error #" : badfile : ":", errno(badfile);
; badfile = fopen("not_a_file", "r")
; if (!isfile(badfile)) print "error #" : badfile : ":", errno(badfile);
error #2: No such file or directory
LIMITS
@@ -102,7 +102,8 @@ LINK LIBRARY
SEE ALSO
errno, fclose, feof, ferror, fflush, fgetc, fgetline, fgets, files, fopen,
fprintf, fputc, fputs, fseek, fsize, ftell, isfile, printf, prompt
fprintf, fputc, fputs, fseek, fsize, ftell, isfile, printf, prompt,
fpathopen
## Copyright (C) 1999 Landon Curt Noll
##
@@ -120,8 +121,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.3 $
## @(#) $Id: fopen,v 29.3 2001/04/10 21:46:45 chongo Exp $
## @(#) $Revision: 29.4 $
## @(#) $Id: fopen,v 29.4 2006/05/07 07:18:26 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fopen,v $
##
## Under source code control: 1994/10/27 03:04:17

View File

@@ -16,15 +16,15 @@ DESCRIPTION
to modify(x, y) but x is not changed.
EXAMPLE
> global n = 0
> define s(a) {n += a;}
> A = list(1,2,3,4)
> forall(A, "s")
> n
; global n = 0
; define s(a) {n += a;}
; A = list(1,2,3,4)
; forall(A, "s")
; n
10
> define e(a) {if (iseven(a)) print a;}
> forall(A, "e")
; define e(a) {if (iseven(a)) print a;}
; forall(A, "e")
2
4
@@ -53,8 +53,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: forall,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: forall,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/forall,v $
##
## Under source code control: 1995/07/10 02:09:31

206
help/fpathopen Normal file
View File

@@ -0,0 +1,206 @@
NAME
fpathopen - open an absolute filename, or a relative filename along a search path
SYNOPSIS
fpathopen(filename, mode [,searchpath])
TYPES
filename string
mode string
searchpath string
return file
DESCRIPTION
This function opens the file named filename, potentially searching
for the file along a search path given by searchpath. If searchpath
is not given, then CALCPATH search path is used.
If the filename is absolute, or it has an implied path, then
searchpath is ignored and the filename is opened directly.
Absolute filenames, and filenames with an implied path are files
that begin with:
/ # absolute path
./ # implied path through the current working directory
../ # implied path through the current working directory parent
~ # absolute path going through a home directory
A search path is a :-separated list of directories used to search for
a filename. For example:
fpathopen("whey", "r", ".:/tmp:/var/tmp:~chongo/pub:~/tmp");
will cause this function to open the first readable file it
files while searching through these paths in order:
./whey
/tmp/whey
/var/tmp/whey
~chongo/pub/whey
~/tmp/whey
IMPORTANT NOTE:
This function searches along a path by attempting
to open files under the given mode. If the mode allows for
writing and a file can be created, then that file is returned.
This call open "./gleet" for writing if the current directory is
writable, even if "./gleet" did not previously exist:
fpathopen("gleet", "r", ".:/tmp:/var/tmp:~chongo/pub:~/tmp");
This call will likely open (and create if needded) for appending,
the file "/tmp/log" assuming that the user is not allowed to
create files in the previous system directories:
fpathopen("log", "a", "/:/etc:/bin:/usr/bin:/tmp");
The CALCPATH search path is taken from the $CALCPATH environment
variable or if no such variable exists, a compiled in default search
path is used. See "help environment" and "help calcpath" for more
information on CALCPATH.
It should be noted that while CALCPATH is typically used to find
resource files (*.cal files), this function is not restricted those
files. Any filename may be opened.
A file can be opened for either reading, writing, or appending.
The mode is controlled by the mode flag as follows:
allow allow file is positioned file(*)
mode reading writing truncated at mode
---- ------- ------- --------- --------- ----
r Y N N beginning text
rb Y N N beginning binary
r+ Y N N beginning text
r+b Y N N beginning binary
rb+ Y N N beginning binary
w N Y Y beginning text
wb N Y Y beginning binary
w+ Y Y Y beginning text
w+b Y Y Y beginning binary
wb+ Y Y Y beginning binary
a N Y Y end text
ab N Y Y end binary
a+ Y Y Y end text
a+b Y Y Y end binary
ab+ Y Y Y end binary
(*) NOTE on 'b' / binary/text mode:
The 'b' or fopen binary mode has no effect on POSIX / Linux
/ Un*x-like systems. On those systems a text file is the
same as a binary file (as it should be for any modern-day
operating system). Adding 'b' to an fopen has no effect
and is ignored.
Some non-POSIX systems sucn as MS Windoz treat text files
and binary files differently. In text mode MS Windoz consider
"\r\n" and end-of-line character. On an Apple MAC, the
text mode end-of-line character is "\r".
Names of files are subject to ~ expansion just like the C or
Korn shell. For example, the file name:
~/lib/gleet
refers to the file 'gleet' under the directory lib located
in your home directory. The file name:
~chongo/was_here
refers to the a file 'was_here' under the home directory of
the user 'chongo'.
If the open is successful, a value of type 'file' will be returned.
You can use the 'isfile' function to test the return value to see
if the open succeeded. You should assign the return value of fopen
to a variable for later use. File values can be copied to more than
one variable, and using any of the variables with the same file value
will produce the same results.
Standard input, standard output and standard error are always opened
and cannot be closed.
The truth value of an opened file is TRUE.
If the open is unsuccessful, the numeric value of errno is returned.
You can the errno() builtin to determine what the errno number means.
EXAMPLE
; fd = fpathopen("motd", "r", "/etc:.")
; print fd
"/etc/motd"
; fd
FILE 3 "/etc/motd" (reading, pos 0)
; fd2 = fpathopen("lucas.cal", "r")
; print fd2
"/usr/share/calc/lucas.cal"
; fd2
FILE 4 "/usr/share/calc/lucas.cal" (reading, pos 0)
; fd3 = fpathopen("randmprime.cal", "r", calcpath())
; print fd3
"/usr/share/calc/randmprime.cal"
; fd3
FILE 5 "/usr/share/calc/randmprime.cal" (reading, pos 0)
; fd4 = fpathopen("output", "w", "~/tmp:/tmp:/var/tmp")
; print fd4
"/home/chongo/tmp/output"
; fd4
FILE 6 "/home/chongo/tmp/output" (writing, pos 0)
; !mkdir -p /tmp/log
; !touch /tmp/log/file
; logfile = fpathopen("log/file", "a", "/tmp:/var/tmp")
; print logfile
"/tmp/log/file"
; logfile
FILE 7 "/home/chongo/tmp/output" (writing, pos 0)
; badfile = fpathopen("no_such_file", "r")
; if (!isfile(badfile)) print "error #" : badfile : ":", errno(badfile);
error #2: No such file or directory
LIMITS
none
LINK LIBRARY
none
SEE ALSO
errno, fclose, feof, ferror, fflush, fgetc, fgetline, fgets, files, fopen,
fprintf, fputc, fputs, fseek, fsize, ftell, isfile, printf, prompt,
environment, calcpath
## Copyright (C) 2006 Landon Curt Noll
##
## Calc is open software; you can redistribute it and/or modify it under
## the terms of the version 2.1 of the GNU Lesser General Public License
## as published by the Free Software Foundation.
##
## Calc is distributed in the hope that it will be useful, but WITHOUT
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
## Public License for more details.
##
## A copy of version 2.1 of the GNU Lesser General Public License is
## distributed with calc under the filename COPYING-LGPL. You should have
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: fpathopen,v 29.2 2006/05/07 07:24:34 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fpathopen,v $
##
## Under source code control: 2006/05/07 23:56:04
## File existed as early as: 2006
##
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/

View File

@@ -16,22 +16,22 @@ DESCRIPTION
the standard output by printf(fmt, x_1, x_2, ...).
EXAMPLE
> fprintf(files(1), "h=%d, i=%d\n", 2, 3);
; fprintf(files(1), "h=%d, i=%d\n", 2, 3);
h=2, i=3
> c = config("epsilon", 1e-6); c = config("display", 6);
> c = config("tilde", 1); c = config("outround", 0);
> c = config("fullzero", 0);
> fmt = "%f,%10f,%-10f,%10.4f,%.4f,%.f.\n";
> a = sqrt(3);
> fprintf(files(2), fmt,a,a,a,a,a,a);
; c = config("epsilon", 1e-6); c = config("display", 6);
; c = config("tilde", 1); c = config("outround", 0);
; c = config("fullzero", 0);
; fmt = "%f,%10f,%-10f,%10.4f,%.4f,%.f.\n";
; a = sqrt(3);
; fprintf(files(2), fmt,a,a,a,a,a,a);
1.732051, 1.732051,1.732051 , ~1.7320,~1.7320,~1.
> file = fopen("/tmp/foo", "w");
> mat A[4] = {sqrt(2), 3/7, "undefined", null()};
> fprintf(file, "%f%r",A,A);
> fclose(file);
> !cat /tmp/foo
; file = fopen("/tmp/foo", "w");
; mat A[4] = {sqrt(2), 3/7, "undefined", null()};
; fprintf(file, "%f%r",A,A);
; fclose(file);
; !cat /tmp/foo
mat [4] (4 elements, 4 nonzero):
[0] = 1.4142135623730950488
@@ -70,8 +70,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: fprintf,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: fprintf,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fprintf,v $
##
## Under source code control: 1996/03/12 22:50:41

View File

@@ -15,10 +15,10 @@ DESCRIPTION
associated with fd.
EXAMPLE
> fd = fopen("/tmp/newfile", "w")
> fputc(fd, "c")
> fd2 = fopen("/tmp/newfile", "r")
> fgetc(fd2)
; fd = fopen("/tmp/newfile", "w")
; fputc(fd, "c")
; fd2 = fopen("/tmp/newfile", "r")
; fgetc(fd2)
"c"
LIMITS
@@ -47,8 +47,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: fputc,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: fputc,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fputc,v $
##
## Under source code control: 1995/03/04 11:33:20

View File

@@ -15,10 +15,10 @@ DESCRIPTION
associated with fd.
EXAMPLE
> fd = fopen("/tmp/newfile", "w")
> fputs(fd, "chongo was here\n")
> fd2 = fopen("/tmp/newfile", "r")
> fgetline(fd2)
; fd = fopen("/tmp/newfile", "w")
; fputs(fd, "chongo was here\n")
; fd2 = fopen("/tmp/newfile", "r")
; fgetline(fd2)
"chongo was here"
LIMITS
@@ -47,8 +47,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: fputs,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: fputs,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fputs,v $
##
## Under source code control: 1995/03/04 11:33:20

View File

@@ -18,16 +18,16 @@ DESCRIPTION
null characters ('\0') are written to the file stream fs.
EXAMPLE
> f = fopen("/tmp/junk", "w")
> fputstr(f, "Alpha", "Beta")
> freopen(f, "r")
> fgetstr(f)
; f = fopen("/tmp/junk", "w")
; fputstr(f, "Alpha", "Beta")
; freopen(f, "r")
; fgetstr(f)
"Alpha"
> fgetstr(f)
; fgetstr(f)
"Beta"
> fgetstr(f)
; fgetstr(f)
>
> fputstr(f, "Gamma")
; fputstr(f, "Gamma")
Error 72
LIMITS
@@ -55,8 +55,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: fputstr,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: fputstr,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fputstr,v $
##
## Under source code control: 1996/04/30 03:05:18

View File

@@ -26,8 +26,8 @@ DESCRIPTION
as x in which m[[i]] = frac(x[[i]]).
EXAMPLE
> c = config("mode", "frac")
> print frac(3), frac(22/7), frac(27/7), frac(-3.125), frac(2.15 - 3.25i)
; c = config("mode", "frac")
; print frac(3), frac(22/7), frac(27/7), frac(-3.125), frac(2.15 - 3.25i)
0 1/7 6/7 -1/8 3/20-1i/4
LIMITS
@@ -57,8 +57,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.3 $
## @(#) $Id: frac,v 29.3 2005/10/18 10:48:29 chongo Exp $
## @(#) $Revision: 29.4 $
## @(#) $Id: frac,v 29.4 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/frac,v $
##
## Under source code control: 1995/12/18 03:30:59

View File

@@ -17,13 +17,13 @@ DESCRIPTION
free(.) frees the current "old value".
EXAMPLE
> a = 7
> mat M[3] = {1, list(2,3,4), list(5,6)}
> print memsize(a), memsize(M)
; a = 7
; mat M[3] = {1, list(2,3,4), list(5,6)}
; print memsize(a), memsize(M)
80 736
> free(a, M[1])
> print memsize(a), memsize(M)
; free(a, M[1])
; print memsize(a), memsize(M)
16 424
LIMITS
@@ -51,8 +51,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: free,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: free,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/free,v $
##
## Under source code control: 1997/09/06 20:03:35

View File

@@ -12,7 +12,7 @@ DESCRIPTION
freebernoulli().
EXAMPLE
> freebernoulli();
; freebernoulli();
LIMITS
none
@@ -39,8 +39,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.3 $
## @(#) $Id: freebernoulli,v 29.3 2004/07/26 05:54:00 chongo Exp $
## @(#) $Revision: 29.4 $
## @(#) $Id: freebernoulli,v 29.4 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/freebernoulli,v $
##
## Under source code control: 2000/07/13

View File

@@ -12,7 +12,7 @@ DESCRIPTION
freeeuler().
EXAMPLE
> freeeuler();
; freeeuler();
LIMITS
none
@@ -39,8 +39,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.1 $
## @(#) $Id: freeeuler,v 29.1 2000/12/14 10:31:45 chongo Exp $
## @(#) $Revision: 29.2 $
## @(#) $Id: freeeuler,v 29.2 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/freeeuler,v $
##
## Under source code control: 2000/12/14 01:33:00

View File

@@ -13,9 +13,9 @@ DESCRIPTION
The oldvalue (.) is not freed by this function.
EXAMPLE
> global a = 1, b = list(2,3,4), c = mat[3]
> static a = 2
> show globals
; global a = 1, b = list(2,3,4), c = mat[3]
; static a = 2
; show globals
Name Level Type
---- ----- -----
@@ -25,8 +25,8 @@ EXAMPLE
c 0 matrix
Number: 4
> freeglobals()
> show globals
; freeglobals()
; show globals
Name Level Type
---- ----- -----
@@ -62,8 +62,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: freeglobals,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: freeglobals,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/freeglobals,v $
##
## Under source code control: 1997/09/06 20:03:35

Some files were not shown because too many files have changed in this diff Show More