add new aversin and acoversin builtin functions.

Added new aversin(x, [,eps]) for inverse versed sine and acoversin(x, [,eps])
for inverse coversed sine.

Improved trig function help files to reference use of complex arguments
that while supported were not documented.

Removed old Makefile testing rules for make dbx and make gdb.

Improved "make run" to execute calccalc using shared libraries
from the local directory, and with reading of the startup scripts
disabled.

Changed "make prep" to perform various tests that are used to
help verify that calc is ready for a release.

Added Makefile testing rule testfuncsort to check for the sort
of the builtin function list.  Changed the order that builtin
functions are listed by "show builtin" and the help/builtin to
match the sorting of "LANG=C LC_ALL=C sort -d -u".
This commit is contained in:
Landon Curt Noll
2023-09-03 23:37:09 -07:00
parent 8edff80826
commit 86f1d9e029
30 changed files with 1421 additions and 177 deletions

View File

@@ -199,37 +199,38 @@ BLT_HELP_FILES= ${BLT_HELP_FILES_3} ${BLT_HELP_FILES_5} \
#
# to keep this list in nice sorted order.
#
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 calcpath catalan ceil cfappr cfsim char \
cmdbuf cmp comb conj cos cosh cot coth count coversin cp csc csch \
ctime d2dm d2dms d2g d2r delete den dereference det digit digits \
display dms2d dp epsilon errcount errmax errno error estr euler eval \
exp fact factor fclose fcnt feof ferror fflush fgetc fgetfield \
fgetfile 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 g2d g2gm g2gms g2r gcd gcdrem gd getenv gms2g h2hm h2hms hash \
head highbit hmean hms2h hnrmod hypot ilog ilog10 ilog2 im indices \
inputlevel insert int inverse iroot isalnum isalpha isassoc isatty \
isblk iscntrl isconfig isdefined isdigit iserror iseven isfile isgraph \
ishash isident isint islist islower ismat ismult isnull isnum isobj \
isobjtype isodd isprime isprint isptr ispunct isqrt isrand israndom \
isreal isrel issimple isspace issq isstr istype isupper isxdigit \
jacobi join lcm lcmfact lfactor ln log log2 logn lowbit ltol makelist \
matdim matfill matmax matmin matsum mattrace mattrans max 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 pound power prevcand prevprime printf prompt protect \
ptest push putenv quo quomod r2d r2g 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 sha1 sin sinh size sizeof sleep sort sqrt srand \
srandom ssq stoponerror str strcasecmp strcat strcmp strcpy strerror \
strlen strncasecmp strncmp strncpy strpos strprintf strscan strscanf \
strtolower strtoupper substr sum swap system systime tail tan tanh \
test time trunc usertime versin version xor
DETAIL_HELP= abs access acos acosh acot acoth acoversin acsc acsch \
address agd append appr arg argv arrow asec asech asin asinh assign \
atan atan2 atanh aversin avg base base2 bernoulli bit blk blkcpy \
blkfree blocks bround btrunc calc_tty calclevel calcpath catalan ceil \
cfappr cfsim char cmdbuf cmp comb conj cos cosh cot coth count \
coversin cp csc csch ctime d2dm d2dms d2g d2r delete den dereference \
det digit digits display dms2d dp epsilon errcount errmax errno error \
estr euler eval exp fact factor fclose fcnt feof ferror fflush fgetc \
fgetfield fgetfile 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 g2d g2gm g2gms g2r gcd gcdrem gd getenv gms2g h2hm \
h2hms hash head highbit hmean hms2h hnrmod hypot ilog ilog10 ilog2 im \
indices inputlevel insert int inverse iroot isalnum isalpha isassoc \
isatty isblk iscntrl isconfig isdefined isdigit iserror iseven isfile \
isgraph ishash isident isint islist islower ismat ismult isnull isnum \
isobj isobjtype isodd isprime isprint isptr ispunct isqrt isrand \
israndom isreal isrel issimple isspace issq isstr istype isupper \
isxdigit jacobi join lcm lcmfact lfactor ln log log2 logn lowbit ltol \
makelist matdim matfill matmax matmin matsum mattrace mattrans max \
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 pound power prevcand prevprime printf \
prompt protect ptest push putenv quo quomod r2d r2g 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 sha1 sin sinh size sizeof \
sleep sort sqrt srand srandom ssq stoponerror str strcasecmp strcat \
strcmp strcpy strerror strlen strncasecmp strncmp strncpy strpos \
strprintf strscan strscanf strtolower strtoupper substr sum swap \
system systime tail tan tanh test time trunc usertime versin version \
xor
# This list is of files that are clones of DETAIL_HELP files. They are
# built from DETAIL_HELP files.

View File

@@ -5,13 +5,13 @@ SYNOPSIS
acos(x [,eps])
TYPES
x real, -1 <= x <= 1
x number (real or complex)
eps 0 < real < 1, defaults to epsilon()
return real
DESCRIPTION
Returns the acos of x to a multiple of eps with error less in
Returns the inverse cosine of x to a multiple of eps with error less in
absolute value than .75 * eps.
v = acos(x) is the number in [0, pi] for which cos(v) = x.
@@ -20,14 +20,25 @@ EXAMPLE
; 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
; print acos(5), acos(5i)
2.29243166956117768776i 1.57079632679489661923-2.31243834127275262025i
; print acos(5+5i)
0.79039774680951249644-2.64919617780647114961i
LIMITS
0 < eps < 1
LINK LIBRARY
NUMBER *qacos(NUMBER *x, NUMBER *eps)
COMPLEX *c_acos(COMPLEX *c, NUMBER *epsilon)
SEE ALSO
asin, atan, asec, acsc, acot, epsilon
sin, cos, tan, cot, sec, csc
asin, atan, acot, asec, acsc
versin, coversin
aversin. acoversin
epsilon
## Copyright (C) 1999,2023 Landon Curt Noll
##

View File

@@ -5,29 +5,38 @@ SYNOPSIS
acot(x [,eps])
TYPES
x real
x number (real or complex)
eps 0 < real < 1, defaults to epsilon()
return real
DESCRIPTION
Returns the acot of x to a multiple of eps with error less in
Returns the inverse cotangent of x to a multiple of eps with error less in
absolute value than .75 * eps.
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)
0.46365 0.463647609 0.463647609000806 0.46364760900080611621
; print acot(5), acot(5i)
0.19739555984988075837 -0.20273255405408219099i
; print acos(5+5i)
0.79039774680951249644-2.64919617780647114961i
LIMITS
0 < eps < 1
LINK LIBRARY
NUMBER *qacot(NUMBER *x, NUMBER *eps)
COMPLEX *c_acot(COMPLEX *c, NUMBER *epsilon)
SEE ALSO
asin, acos, atan, asec, acsc, epsilon
sin, cos, tan, cot, sec, csc
asin, acos, atan, asec, acsc
versin, coversin
aversin. acoversin
epsilon
## Copyright (C) 1999,2021,2023 Landon Curt Noll
##

63
help/acoversin Normal file
View File

@@ -0,0 +1,63 @@
NAME
acoversin - inverse coversed trigonometric sine
SYNOPSIS
acoversin(x [,eps])
TYPES
x number (real or complex)
eps 0 < real < 1, defaults to epsilon()
return number
DESCRIPTION
Calculate the inverse coversed sine of x to a multiple of eps with error less in
absolute value than .75 * eps.
The coversed sine function is sometimes called covers, or acosiv, or acvs,
may be defined as:
acoversin(x) = asin(1 - x)
EXAMPLE
; print acoversin(.5, 1e-5), acoversin(.5, 1e-10), acoversin(.5, 1e-15), acoversin(.5, 1e-20)
0.5236 0.5235987756 0.523598775598299 0.52359877559829887308
; print acoversin(1), acoversin(-5), acoversin(2 + 3i)
0 1.40341337183925787843-2.49215996813383545614i -0.30760364953071124992-1.86416154415788242834i
LIMITS
0 < eps < 1
LINK LIBRARY
NUMBER *qacoversin(NUMBER *x, NUMBER *eps)
COMPLEX *c_acoversin(COMPLEX *x, NUMBER *eps)
SEE ALSO
sin, cos, tan, cot, sec, csc
asin, acos, atan, acot, asec, acsc
versin, coversin
aversin
epsilon
## Copyright (C) 2023 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.
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
##
## Under source code control: 2023/08/31 23:07:08
## File existed as early as: 2023
##
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/

View File

@@ -5,29 +5,38 @@ SYNOPSIS
acsc(x [,eps])
TYPES
x real, with absolute value >= 1
x number (real or complex)
eps 0 < real < 1, defaults to epsilon()
return real
DESCRIPTION
Returns the acsc of x to a multiple of eps with error less in
Returns the inverse cosecant of x to a multiple of eps with error less in
absolute value than .75 * eps.
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)
0.5236 0.5235987756 0.523598775598299 0.52359877559829887308
; print acsc(5), acsc(5i)
0.20135792079033079145 -0.19869011034924140648i
; print acos(5+5i)
0.79039774680951249644-2.64919617780647114961i
LIMITS
0 < eps < 1
LINK LIBRARY
NUMBER *qacsc(NUMBER *x, NUMBER *eps)
COMPLEX *c_acsc(COMPLEX *c, NUMBER *epsilon)
SEE ALSO
asin, acos, atan, asec, acot, epsilon
sin, cos, tan, cot, sec, csc
asin, acos, atan, acot, asec
versin, coversin
aversin. acoversin
epsilon
## Copyright (C) 1999,2021,2023 Landon Curt Noll
##

View File

@@ -5,29 +5,38 @@ SYNOPSIS
asec(x [,eps])
TYPES
x real, with absolute value >= 1
x number (real or complex)
eps 0 < real < 1, defaults to epsilon()
return real
DESCRIPTION
Returns the asec of x to a multiple of eps with error less in
Returns the inverse secant of x to a multiple of eps with error less in
absolute value than .75 * eps.
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)
1.0472 1.0471975512 1.047197551196598 1.04719755119659774615
; print asec(5), asec(5i)
1.36943840600456582778 1.57079632679489661923+0.19869011034924140647i
; print acos(5+5i)
0.79039774680951249644-2.64919617780647114961i
LIMITS
0 < eps < 1
LINK LIBRARY
NUMBER *qasec(NUMBER *x, NUMBER *eps)
COMPLEX *c_asec(COMPLEX *c, NUMBER *epsilon)
SEE ALSO
asin, acos, atan, acsc, acot, epsilon
sin, cos, tan, cot, sec, csc
asin, acos, atan, acot, acsc
versin, coversin
aversin. acoversin
epsilon
## Copyright (C) 1999,2021,2023 Landon Curt Noll
##

View File

@@ -5,13 +5,13 @@ SYNOPSIS
asin(x [,eps])
TYPES
x real, -1 <= x <= 1
x number (real or complex)
eps 0 < real < 1, defaults to epsilon()
return real
DESCRIPTION
Returns the asin of x to a multiple of eps with error less in
Returns the inverse sine of x to a multiple of eps with error less in
absolute value than .75 * eps.
v = asin(x) is the number in [-pi/2, pi/2] for which sin(v) = x.
@@ -20,14 +20,25 @@ EXAMPLE
; print asin(.5, 1e-5), asin(.5, 1e-10), asin(.5, 1e-15), asin(.5, 1e-20)
0.5236 0.5235987756 0.523598775598299 0.52359877559829887308
; print asin(5), asin(5i)
1.57079632679489661923-2.2924316695611776878i 2.31243834127275262025i
; print asin(5+5i)
0.78039857998538412279+2.64919617780647114961i
LIMITS
0 < eps < 1
LINK LIBRARY
NUMBER *qasin(NUMBER *q, NUMBER *epsilon)
COMPLEX *c_asin(COMPLEX *c, NUMBER *epsilon)
SEE ALSO
acos, atan, asec, acsc, acot, epsilon
sin, cos, tan, cot, sec, csc
acos, atan, acot, asec, acsc
versin, coversin
aversin. acoversin
epsilon
## Copyright (C) 1999,2021,2023 Landon Curt Noll
##

View File

@@ -5,29 +5,38 @@ SYNOPSIS
atan(x [,eps])
TYPES
x real
x number (real or complex)
eps 0 < real < 1, defaults to epsilon()
return real
DESCRIPTION
Returns the atan of x to a multiple of eps with error less in
Returns the inverse tangent of x to a multiple of eps with error less in
absolute value than .75 * eps.
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)
1.10715 1.1071487178 1.107148717794091 1.10714871779409050302
; print atan(5), atan(5i)
1.37340076694501586086 1.57079632679489661923+0.20273255405408219099i
; print acos(5+5i)
0.79039774680951249644-2.64919617780647114961i
LIMITS
0 < eps < 1
LINK LIBRARY
NUMBER *qatan(NUMBER *x, NUMBER *eps)
COMPLEX *c_atan(COMPLEX *c, NUMBER *epsilon)
SEE ALSO
asin, acos, asec, acsc, acot, epsilon
sin, cos, tan, cot, sec, csc
asin, acos, acot, asec, acsc
versin, coversin
aversin. acoversin
epsilon
## Copyright (C) 1999,2023 Landon Curt Noll
##

64
help/aversin Normal file
View File

@@ -0,0 +1,64 @@
NAME
aversin - inverse versed trigonometric sine
SYNOPSIS
aversin(x [,eps])
TYPES
x number (real or complex)
eps 0 < real < 1, defaults to epsilon()
return real
DESCRIPTION
Returns the inverse versed sine of x to a multiple of eps with error less in
absolute value than .75 * eps.
The inverse versed sine function is sometimes called avers, sometimes called aver,
may be defined as:
aversin(x) = acos(1 - x)
EXAMPLE
; print aversin(.5, 1e-5), aversin(.5, 1e-10), aversin(.5, 1e-15), aversin(.5, 1e-20)
1.0472 1.0471975512 1.047197551196598 1.04719755119659774615
; print aversin(0), aversin(-5), aversin(2 + 3i)
0 0.16738295495563874081+2.49215996813383545614i 1.87839997632560786916+1.86416154415788242831i
LIMITS
0 < eps < 1
LINK LIBRARY
NUMBER *qaversin_or_NULL(NUMBER *q, NUMBER *epsilon);
NUMBER *qaversin(NUMBER *q, NUMBER *epsilon);
COMPLEX *c_aversin(COMPLEX *c, NUMBER *epsilon);
SEE ALSO
sin, cos, tan, cot, sec, csc
asin, acos, atan, acot, asec, acsc
versin, coversin
acoversin
epsilon
## Copyright (C) 2023 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.
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
##
## Under source code control: 2023/09/03 00:26:24
## File existed as early as: 2023
##
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/

View File

@@ -1,5 +1,5 @@
NAME
cos - cosine
cos - trigonometric cosine
SYNOPSIS
cos(x [,eps])
@@ -33,8 +33,11 @@ LINK LIBRARY
COMPLEX *c_cos(COMPLEX *x, NUMBER *eps)
SEE ALSO
sin, tan, sec, csc, cot, epsilon
sin, tan, cot, sec, csc
asin, acos, atan, acot, asec, acsc
versin, coversin
aversin. acoversin
epsilon
## Copyright (C) 1999,2021,2023 Landon Curt Noll
##

View File

@@ -26,8 +26,11 @@ LINK LIBRARY
COMPLEX *c_acot(COMPLEX *c, NUMBER *eps);
SEE ALSO
sin, cos, tan, sec, csc, epsilon
sin, cos, tan, sec, csc
asin, acos, atan, acot, asec, acsc
versin, coversin
aversin. acoversin
epsilon
## Copyright (C) 1999,2021,2023 Landon Curt Noll
##

View File

@@ -1,5 +1,5 @@
NAME
coversin - coversed sine
coversin - coversed trigonometric sine
SYNOPSIS
coversin(x [,eps])
@@ -11,7 +11,7 @@ TYPES
return number
DESCRIPTION
Calculate the versed cosine of x to a multiple of eps with error less in
Calculate the coversed sine of x to a multiple of eps with error less in
absolute value than .75 * eps.
The coversed sine function is sometimes called covers, or cosiv, or cvs,
@@ -41,8 +41,11 @@ LINK LIBRARY
COMPLEX *c_coversin(COMPLEX *x, NUMBER *eps)
SEE ALSO
sin, cos, tan, sec, csc, cot, epsilon
sin, cos, tan, cot, sec, csc
asin, acos, atan, acot, asec, acsc
versin
aversin. acoversin
epsilon
## Copyright (C) 2023 Landon Curt Noll
##

View File

@@ -1,5 +1,5 @@
NAME
csc - trigonometric cosecant function
csc - trigonometric cosecant
SYNOPSIS
csc(x [,eps])
@@ -25,8 +25,11 @@ LINK LIBRARY
NUMBER *qcsc(NUMBER *x, NUMBER *eps)
SEE ALSO
sin, cos, tan, sec, cot, epsilon
sin, cos, tan, cot, sec
asin, acos, atan, acot, asec, acsc
versin, coversin
aversin. acoversin
epsilon
## Copyright (C) 1999,2023 Landon Curt Noll
##

View File

@@ -1,5 +1,5 @@
NAME
sec - trigonometric secant function
sec - trigonometric secant
SYNOPSIS
sec(x [,eps])
@@ -26,8 +26,11 @@ LINK LIBRARY
NUMBER *qsec(NUMBER *x, NUMBER *eps)
SEE ALSO
sin, cos, tan, csc, cot, epsilon
sin, cos, tan, cot, csc
asin, acos, atan, acot, asec, acsc
versin, coversin
aversin. acoversin
epsilon
## Copyright (C) 1999,2023 Landon Curt Noll
##

View File

@@ -33,8 +33,11 @@ LINK LIBRARY
COMPLEX *c_sin(COMPLEX *x, NUMBER *eps)
SEE ALSO
cos, tan, sec, csc, cot, epsilon
cos, tan, cot, sec, csc
asin, acos, atan, acot, asec, acsc
versin, coversin
aversin. acoversin
epsilon
## Copyright (C) 1999,2021,2023 Landon Curt Noll
##

View File

@@ -27,8 +27,11 @@ LINK LIBRARY
COMPLEX *c_atan(COMPLEX *c, NUMBER *eps);
SEE ALSO
sin, cos, sec, csc, cot, epsilon
sin, cos, cot, sec, csc
asin, acos, atan, acot, asec, acsc
versin, coversin
aversin. acoversin
epsilon
## Copyright (C) 1999,2023 Landon Curt Noll
##

View File

@@ -1,5 +1,5 @@
NAME
versin - versed sine
versin - versed trigonometric sine
SYNOPSIS
versin(x [,eps])
@@ -41,8 +41,11 @@ LINK LIBRARY
COMPLEX *c_versin(COMPLEX *x, NUMBER *eps)
SEE ALSO
sin, cos, tan, sec, csc, cot, epsilon
sin, cos, tan, cot, sec, csc
asin, acos, atan, acot, asec, acsc
coversin
aversin. acoversin
epsilon
## Copyright (C) 2023 Landon Curt Noll
##