mirror of
https://github.com/lcn2/calc.git
synced 2025-08-19 01:13:27 +03:00
convert ASCII TABs to ASCII SPACEs
Converted all ASCII tabs to ASCII spaces using a 8 character tab stop, for all files, except for all Makefiles (plus rpm.mk). The `git diff -w` reports no changes.
This commit is contained in:
18
help/abs
18
help/abs
@@ -11,11 +11,11 @@ TYPES
|
||||
|
||||
For non-object x and eps:
|
||||
|
||||
x number (real or complex)
|
||||
eps ignored if x is real, nonzero real for complex x,
|
||||
defaults to epsilon().
|
||||
x number (real or complex)
|
||||
eps ignored if x is real, nonzero real for complex x,
|
||||
defaults to epsilon().
|
||||
|
||||
return non-negative real
|
||||
return non-negative real
|
||||
|
||||
DESCRIPTION
|
||||
If x is real, returns the absolute value of x, i.e. x if x >= 0,
|
||||
@@ -52,7 +52,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -60,8 +60,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1994/03/19 01:40:22
|
||||
## File existed as early as: 1994
|
||||
## Under source code control: 1994/03/19 01:40:22
|
||||
## File existed as early as: 1994
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
24
help/access
24
help/access
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
access(name [, mode])
|
||||
|
||||
TYPES
|
||||
name string
|
||||
mode integer or string containing only 'r', 'w', 'x' characters
|
||||
name string
|
||||
mode integer or string containing only 'r', 'w', 'x' characters
|
||||
|
||||
return null value or error
|
||||
return null value or error
|
||||
|
||||
DESCRIPTION
|
||||
access(name) or access(name, 0) or access(name, "") returns the null
|
||||
@@ -25,18 +25,18 @@ EXAMPLE
|
||||
|
||||
; !rm -f junk
|
||||
; access("junk")
|
||||
System error 2
|
||||
System error 2
|
||||
; strerror(.)
|
||||
"No such file or directory"
|
||||
"No such file or directory"
|
||||
; f = fopen("junk", "w")
|
||||
; access("junk")
|
||||
; fputs(f, "Alpha")
|
||||
; fclose(f)
|
||||
; !chmod u-w junk
|
||||
; access("junk", "w")
|
||||
System error 13
|
||||
System error 13
|
||||
; strerror(.)
|
||||
"Permission denied"
|
||||
"Permission denied"
|
||||
|
||||
LIMITS
|
||||
There may be implementation-dependent limits inherited from the
|
||||
@@ -56,7 +56,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -64,8 +64,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1996/04/30 03:36:20
|
||||
## File existed as early as: 1996
|
||||
## Under source code control: 1996/04/30 03:36:20
|
||||
## File existed as early as: 1996
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
32
help/acos
32
help/acos
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
acos(x [,eps])
|
||||
|
||||
TYPES
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
|
||||
return real
|
||||
return real
|
||||
|
||||
DESCRIPTION
|
||||
Returns the inverse trigonometric cosine of x to a multiple of eps with error less in
|
||||
@@ -61,14 +61,14 @@ SEE ALSO
|
||||
EXTERNAL RESOURCES
|
||||
For general information on trigonometric functions, see:
|
||||
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
|
||||
## Copyright (C) 1999,2023 Landon Curt Noll
|
||||
##
|
||||
@@ -78,7 +78,7 @@ EXTERNAL RESOURCES
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -86,8 +86,8 @@ EXTERNAL RESOURCES
|
||||
## 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: 1994/03/19 01:40:23
|
||||
## File existed as early as: 1994
|
||||
## Under source code control: 1994/03/19 01:40:23
|
||||
## File existed as early as: 1994
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
18
help/acosh
18
help/acosh
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
acosh(x [,eps])
|
||||
|
||||
TYPES
|
||||
x real, x >= 1
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
x real, x >= 1
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
|
||||
return nonnegative real
|
||||
return nonnegative real
|
||||
|
||||
DESCRIPTION
|
||||
Returns the acosh of x to a multiple of eps with error less in
|
||||
@@ -17,7 +17,7 @@ DESCRIPTION
|
||||
acosh(x) is the nonnegative real number v for which cosh(v) = x.
|
||||
It is given by
|
||||
|
||||
acosh(x) = ln(x + sqrt(x^2 - 1))
|
||||
acosh(x) = ln(x + sqrt(x^2 - 1))
|
||||
|
||||
EXAMPLE
|
||||
; print acosh(2, 1e-5), acosh(2, 1e-10), acosh(2, 1e-15), acosh(2, 1e-20)
|
||||
@@ -42,7 +42,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -50,8 +50,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1994/03/19 01:40:24
|
||||
## File existed as early as: 1994
|
||||
## Under source code control: 1994/03/19 01:40:24
|
||||
## File existed as early as: 1994
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
32
help/acot
32
help/acot
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
acot(x [,eps])
|
||||
|
||||
TYPES
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
|
||||
return real
|
||||
return real
|
||||
|
||||
DESCRIPTION
|
||||
Returns the inverse trigonometric cotangent of x to a multiple of eps with error less in
|
||||
@@ -61,14 +61,14 @@ SEE ALSO
|
||||
EXTERNAL RESOURCES
|
||||
For general information on trigonometric functions, see:
|
||||
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
|
||||
## Copyright (C) 1999,2021,2023 Landon Curt Noll
|
||||
##
|
||||
@@ -78,7 +78,7 @@ EXTERNAL RESOURCES
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -86,8 +86,8 @@ EXTERNAL RESOURCES
|
||||
## 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: 1995/11/13 03:49:00
|
||||
## File existed as early as: 1995
|
||||
## Under source code control: 1995/11/13 03:49:00
|
||||
## File existed as early as: 1995
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
18
help/acoth
18
help/acoth
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
acoth(x [,eps])
|
||||
|
||||
TYPES
|
||||
x real, with abs(x) > 1
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
x real, with abs(x) > 1
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
|
||||
return real
|
||||
return real
|
||||
|
||||
DESCRIPTION
|
||||
Returns the acoth of x to a multiple of eps with error less in
|
||||
@@ -16,7 +16,7 @@ DESCRIPTION
|
||||
|
||||
acoth(x) is the real number v for which coth(v) = x.
|
||||
It is given by
|
||||
acoth(x) = ln((x + 1)/(x - 1))/2
|
||||
acoth(x) = ln((x + 1)/(x - 1))/2
|
||||
|
||||
EXAMPLE
|
||||
; print acoth(2, 1e-5), acoth(2, 1e-10), acoth(2, 1e-15), acoth(2, 1e-20)
|
||||
@@ -41,7 +41,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -49,8 +49,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1995/11/13 03:49:01
|
||||
## File existed as early as: 1995
|
||||
## Under source code control: 1995/11/13 03:49:01
|
||||
## File existed as early as: 1995
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
acovercos(x [,eps])
|
||||
|
||||
TYPES
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
|
||||
return number
|
||||
return number
|
||||
|
||||
DESCRIPTION
|
||||
Calculate the inverse coversed trigonometric cosine of x to a multiple of eps with error less in
|
||||
@@ -16,7 +16,7 @@ DESCRIPTION
|
||||
|
||||
This function is sometimes called acvc, or arccovercos, is equivalent to:
|
||||
|
||||
acovercos(x) = asin(x - 1)
|
||||
acovercos(x) = asin(x - 1)
|
||||
|
||||
EXAMPLE
|
||||
; print acovercos(0), acovercos(0.5), acovercos(1)
|
||||
@@ -60,14 +60,14 @@ SEE ALSO
|
||||
EXTERNAL RESOURCES
|
||||
For general information on trigonometric functions, see:
|
||||
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
|
||||
## Copyright (C) 2023 Landon Curt Noll
|
||||
##
|
||||
@@ -77,7 +77,7 @@ EXTERNAL RESOURCES
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -85,8 +85,8 @@ EXTERNAL RESOURCES
|
||||
## 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/05 23:30:08
|
||||
## File existed as early as: 2023
|
||||
## Under source code control: 2023/09/05 23:30: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/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
acoversin(x [,eps])
|
||||
|
||||
TYPES
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
|
||||
return number
|
||||
return number
|
||||
|
||||
DESCRIPTION
|
||||
Calculate the inverse coversed trigonometric sine of x to a multiple of eps with error less in
|
||||
@@ -16,7 +16,7 @@ DESCRIPTION
|
||||
|
||||
This function is sometimes called acovers, or acvs, or arccoversin, is equivalent to:
|
||||
|
||||
acoversin(x) = asin(1 - x)
|
||||
acoversin(x) = asin(1 - x)
|
||||
|
||||
EXAMPLE
|
||||
; print acoversin(0), acoversin(0.5), acoversin(1)
|
||||
@@ -60,14 +60,14 @@ SEE ALSO
|
||||
EXTERNAL RESOURCES
|
||||
For general information on trigonometric functions, see:
|
||||
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
|
||||
## Copyright (C) 2023 Landon Curt Noll
|
||||
##
|
||||
@@ -77,7 +77,7 @@ EXTERNAL RESOURCES
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -85,8 +85,8 @@ EXTERNAL RESOURCES
|
||||
## 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
|
||||
## 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/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
34
help/acrd
34
help/acrd
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
acrd(x [,eps])
|
||||
|
||||
TYPES
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
|
||||
return number
|
||||
return number
|
||||
|
||||
DESCRIPTION
|
||||
Calculate angle of unit circle chord of length x to a multiple of eps with error less in
|
||||
@@ -19,7 +19,7 @@ DESCRIPTION
|
||||
|
||||
This function is sometimes called chord, is equivalent to:
|
||||
|
||||
acrd(x) = 2 * asin(x / 2)
|
||||
acrd(x) = 2 * asin(x / 2)
|
||||
|
||||
EXAMPLE
|
||||
; print acrd(1/2), acrd(5/7), acrd(42/7)
|
||||
@@ -57,14 +57,14 @@ SEE ALSO
|
||||
EXTERNAL RESOURCES
|
||||
For general information on trigonometric functions, see:
|
||||
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
|
||||
## Copyright (C) 2023 Landon Curt Noll
|
||||
##
|
||||
@@ -74,7 +74,7 @@ EXTERNAL RESOURCES
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -82,8 +82,8 @@ EXTERNAL RESOURCES
|
||||
## 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/10/02 16:49:42
|
||||
## File existed as early as: 2023
|
||||
## Under source code control: 2023/10/02 16:49:42
|
||||
## 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/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
32
help/acsc
32
help/acsc
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
acsc(x [,eps])
|
||||
|
||||
TYPES
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
|
||||
return real
|
||||
return real
|
||||
|
||||
DESCRIPTION
|
||||
Returns the inverse trigonometric cosecant of x to a multiple of eps with error less in
|
||||
@@ -64,14 +64,14 @@ SEE ALSO
|
||||
EXTERNAL RESOURCES
|
||||
For general information on trigonometric functions, see:
|
||||
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
|
||||
## Copyright (C) 1999,2021,2023 Landon Curt Noll
|
||||
##
|
||||
@@ -81,7 +81,7 @@ EXTERNAL RESOURCES
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -89,8 +89,8 @@ EXTERNAL RESOURCES
|
||||
## 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: 1995/11/13 03:49:00
|
||||
## File existed as early as: 1995
|
||||
## Under source code control: 1995/11/13 03:49:00
|
||||
## File existed as early as: 1995
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
18
help/acsch
18
help/acsch
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
acsch(x [,eps])
|
||||
|
||||
TYPES
|
||||
x nonzero real
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
x nonzero real
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
|
||||
return real
|
||||
return real
|
||||
|
||||
DESCRIPTION
|
||||
Returns the acsch of x to a multiple of eps with error less in
|
||||
@@ -16,7 +16,7 @@ DESCRIPTION
|
||||
|
||||
acsch(x) is the real number v for which csch(v) = x. It is given by
|
||||
|
||||
acsch(x) = ln((1 + sqrt(1 + x^2))/x)
|
||||
acsch(x) = ln((1 + sqrt(1 + x^2))/x)
|
||||
|
||||
EXAMPLE
|
||||
; print acsch(2, 1e-5), acsch(2, 1e-10), acsch(2, 1e-15), acsch(2, 1e-20)
|
||||
@@ -41,7 +41,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -49,8 +49,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1995/11/13 03:49:01
|
||||
## File existed as early as: 1995
|
||||
## Under source code control: 1995/11/13 03:49:01
|
||||
## File existed as early as: 1995
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
42
help/address
42
help/address
@@ -5,9 +5,9 @@ SYNOPSIS
|
||||
&X
|
||||
|
||||
TYPES
|
||||
X expression specifying an octet, lvalue, string or number
|
||||
X expression specifying an octet, lvalue, string or number
|
||||
|
||||
return pointer
|
||||
return pointer
|
||||
|
||||
DESCRIPTION
|
||||
&X returns the address at which information for determining the current
|
||||
@@ -20,7 +20,7 @@ DESCRIPTION
|
||||
otherwise accessing, such a vacated address may be catastrophic.
|
||||
|
||||
An octet is normally expressed by B[i] where B is a block and
|
||||
0 <= i < sizeof(B). &B[i] then returns the address at which this
|
||||
0 <= i < sizeof(B). &B[i] then returns the address at which this
|
||||
octet is located until the block is freed or relocated. Freeing
|
||||
of an unnamed block B occurs when a new value is assigned to B or
|
||||
when B ceases to exist; a named block B is freed by blkfree(B).
|
||||
@@ -38,7 +38,7 @@ DESCRIPTION
|
||||
&X with that component or element depends only on the continued existence
|
||||
of the matrix or object. For example, after
|
||||
|
||||
; mat A[3]
|
||||
; mat A[3]
|
||||
|
||||
the addresses &A[0], &A[1], &A[2] locate the three elements
|
||||
of the matrix specified by A until another value is assigned to A, etc.
|
||||
@@ -60,15 +60,15 @@ DESCRIPTION
|
||||
results refer to octets in the same block or existing components of the
|
||||
same matrix or object. For example, immediately after
|
||||
|
||||
; mat A[10]
|
||||
; p = &A[5]
|
||||
; mat A[10]
|
||||
; p = &A[5]
|
||||
|
||||
it is permitted to use expressions like p + 4, p - 5, p++ .
|
||||
|
||||
Strings defined literally have fixed addresses, e.g., after
|
||||
|
||||
; p = &"abc"
|
||||
; A = "abc"
|
||||
; p = &"abc"
|
||||
; A = "abc"
|
||||
|
||||
the address &*A of the value of A will be equal to p.
|
||||
|
||||
@@ -78,7 +78,7 @@ DESCRIPTION
|
||||
be usable only while the variables retain these defined values.
|
||||
For example, after
|
||||
|
||||
; B = C = strcat("a", "bc");
|
||||
; B = C = strcat("a", "bc");
|
||||
|
||||
&*B and &*C will be different. If p is defined by p = &*B, p should
|
||||
not be used after a new value is assigned to B, or B ceases to exist,
|
||||
@@ -91,12 +91,12 @@ DESCRIPTION
|
||||
so long as the number remains associated with at least one function or
|
||||
lvalue. For example, after
|
||||
|
||||
; x = 27;
|
||||
; y = 3 * 9;
|
||||
; define f(a) = 27 + a;
|
||||
; x = 27;
|
||||
; y = 3 * 9;
|
||||
; define f(a) = 27 + a;
|
||||
|
||||
the three occurrences of 27 have the same address which may be displayed
|
||||
by any of &27, &*x, &*y and &f(0). If x and y are assigned
|
||||
by any of &27, &*x, &*y and &f(0). If x and y are assigned
|
||||
other values and f is redefined or undefined and the 27 has not been
|
||||
stored elsewhere (e.g. as the "old value" or in another function
|
||||
definition or as an element in an association), the address assigned at
|
||||
@@ -105,17 +105,17 @@ DESCRIPTION
|
||||
|
||||
When a function returns a number value, that number value is usually
|
||||
placed at a newly allocated address, even if an equal number is stored
|
||||
elsewhere. For example calls to f(a), as defined above, with the same
|
||||
elsewhere. For example calls to f(a), as defined above, with the same
|
||||
non-zero value for a will be assigned to different addresses as can be
|
||||
seen from printing &*A, &*B, &*C after
|
||||
|
||||
; A = f(2); B = f(2); C = f(2);
|
||||
; A = f(2); B = f(2); C = f(2);
|
||||
|
||||
(the case of f(0) is exceptional since 27 + 0 simply copies the 27
|
||||
rather than creating a new number value). Here it is clearly more
|
||||
efficient to use
|
||||
|
||||
; A = B = C = f(2);
|
||||
; A = B = C = f(2);
|
||||
|
||||
which, not only performs the addition in f() only once, but stores the
|
||||
number values for A, B and C at the same address.
|
||||
@@ -168,7 +168,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -176,8 +176,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1997/09/06 20:03:34
|
||||
## File existed as early as: 1997
|
||||
## Under source code control: 1997/09/06 20:03:34
|
||||
## File existed as early as: 1997
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
34
help/aexcsc
34
help/aexcsc
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
aexcsc(x [,eps])
|
||||
|
||||
TYPES
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
|
||||
return real
|
||||
return real
|
||||
|
||||
DESCRIPTION
|
||||
Returns the inverse exterior trigonometric cscant of x to a multiple of eps with error less in
|
||||
@@ -16,7 +16,7 @@ DESCRIPTION
|
||||
|
||||
This function is sometimes called arcexcsc, is equivalent to:
|
||||
|
||||
aexcsc(x) = acsc(x + 1)
|
||||
aexcsc(x) = acsc(x + 1)
|
||||
|
||||
EXAMPLE
|
||||
; print aexcsc(0), aexcsc(0.5), aexcsc(1)
|
||||
@@ -66,14 +66,14 @@ SEE ALSO
|
||||
EXTERNAL RESOURCES
|
||||
For general information on trigonometric functions, see:
|
||||
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
|
||||
## Copyright (C) 2023 Landon Curt Noll
|
||||
##
|
||||
@@ -83,7 +83,7 @@ EXTERNAL RESOURCES
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -91,8 +91,8 @@ EXTERNAL RESOURCES
|
||||
## 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/30 23:22:21
|
||||
## File existed as early as: 2023
|
||||
## Under source code control: 2023/09/30 23:22:21
|
||||
## 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/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
34
help/aexsec
34
help/aexsec
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
aexsec(x [,eps])
|
||||
|
||||
TYPES
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
|
||||
return real
|
||||
return real
|
||||
|
||||
DESCRIPTION
|
||||
Returns the inverse trigonometric secant of x to a multiple of eps with error less in
|
||||
@@ -16,7 +16,7 @@ DESCRIPTION
|
||||
|
||||
This function is sometimes called arcexsec, is equivalent to:
|
||||
|
||||
aexsec(x) = asec(x + 1)
|
||||
aexsec(x) = asec(x + 1)
|
||||
|
||||
EXAMPLE
|
||||
; print aexsec(0), aexsec(0.5), aexsec(1)
|
||||
@@ -63,14 +63,14 @@ SEE ALSO
|
||||
EXTERNAL RESOURCES
|
||||
For general information on trigonometric functions, see:
|
||||
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
|
||||
## Copyright (C) 2023 Landon Curt Noll
|
||||
##
|
||||
@@ -80,7 +80,7 @@ EXTERNAL RESOURCES
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -88,8 +88,8 @@ EXTERNAL RESOURCES
|
||||
## 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/10/01 00:20:20
|
||||
## File existed as early as: 2023
|
||||
## Under source code control: 2023/10/01 00:20:20
|
||||
## 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/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
24
help/agd
24
help/agd
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
agd(z [,eps])
|
||||
|
||||
TYPES
|
||||
z number (real or complex)
|
||||
eps nonzero real, defaults to epsilon()
|
||||
z number (real or complex)
|
||||
eps nonzero real, defaults to epsilon()
|
||||
|
||||
return number or infinite error value
|
||||
return number or infinite error value
|
||||
|
||||
DESCRIPTION
|
||||
Calculate the inverse Gudermannian of z to a multiple of eps with
|
||||
@@ -19,11 +19,11 @@ DESCRIPTION
|
||||
agd(z) is usually defined initially for real z with abs(z) < pi/2 by
|
||||
one of the formulae
|
||||
|
||||
agd(z) = ln(sec(z) + tan(z))
|
||||
agd(z) = ln(sec(z) + tan(z))
|
||||
|
||||
= 2 * atanh(tan(z/2))
|
||||
= 2 * atanh(tan(z/2))
|
||||
|
||||
= asinh(tan(z)),
|
||||
= asinh(tan(z)),
|
||||
|
||||
or as the integral from 0 to z of (1/cos(t))dt. For complex z, the
|
||||
principal branch, approximated by gd(z, eps), has cuts along the real
|
||||
@@ -31,7 +31,7 @@ DESCRIPTION
|
||||
|
||||
If z = x + i * y and abs(x) < pi/2, agd(z) is given by
|
||||
|
||||
agd(z) = atanh(sin(x)/cosh(y)) + i * atan(sinh(y)/cos(x)>
|
||||
agd(z) = atanh(sin(x)/cosh(y)) + i * atan(sinh(y)/cos(x)>
|
||||
|
||||
EXAMPLE
|
||||
; print agd(1, 1e-5), agd(1, 1e-10), agd(1, 1e-15)
|
||||
@@ -63,7 +63,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -71,8 +71,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1997/09/06 20:03:34
|
||||
## File existed as early as: 1997
|
||||
## Under source code control: 1997/09/06 20:03:34
|
||||
## File existed as early as: 1997
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
ahacovercos(x [,eps])
|
||||
|
||||
TYPES
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
|
||||
return number
|
||||
return number
|
||||
|
||||
DESCRIPTION
|
||||
Calculate the inverse half coversed trigonometric cosine of x to a multiple of eps with error less in
|
||||
@@ -16,7 +16,7 @@ DESCRIPTION
|
||||
|
||||
This function is sometimes called ahacvc, or archacovercos, or archacovercosine, is equivalent to:
|
||||
|
||||
ahacovercos(x) = asin(2*x - 1)
|
||||
ahacovercos(x) = asin(2*x - 1)
|
||||
|
||||
EXAMPLE
|
||||
; print ahacovercos(0), ahacovercos(0.5), ahacovercos(1)
|
||||
@@ -63,14 +63,14 @@ SEE ALSO
|
||||
EXTERNAL RESOURCES
|
||||
For general information on trigonometric functions, see:
|
||||
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
|
||||
## Copyright (C) 2023 Landon Curt Noll
|
||||
##
|
||||
@@ -80,7 +80,7 @@ EXTERNAL RESOURCES
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -88,8 +88,8 @@ EXTERNAL RESOURCES
|
||||
## 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/24 11:16:08
|
||||
## File existed as early as: 2023
|
||||
## Under source code control: 2023/09/24 11:16: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/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
ahacoversin(x [,eps])
|
||||
|
||||
TYPES
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
|
||||
return number
|
||||
return number
|
||||
|
||||
DESCRIPTION
|
||||
Calculate the inverse half coversed trigonometric sine of x to a multiple of eps with error less in
|
||||
@@ -16,7 +16,7 @@ DESCRIPTION
|
||||
|
||||
This function is sometimes called ahacovers, or ahacvs, or archacoversin, is equivalent to:
|
||||
|
||||
ahacoversin(x) = asin(1 - 2*x)
|
||||
ahacoversin(x) = asin(1 - 2*x)
|
||||
|
||||
EXAMPLE
|
||||
; print ahacoversin(0), ahacoversin(0.5), ahacoversin(1)
|
||||
@@ -63,14 +63,14 @@ SEE ALSO
|
||||
EXTERNAL RESOURCES
|
||||
For general information on trigonometric functions, see:
|
||||
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
|
||||
## Copyright (C) 2023 Landon Curt Noll
|
||||
##
|
||||
@@ -80,7 +80,7 @@ EXTERNAL RESOURCES
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -88,8 +88,8 @@ EXTERNAL RESOURCES
|
||||
## 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/24 11:17:28
|
||||
## File existed as early as: 2023
|
||||
## Under source code control: 2023/09/24 11:17:28
|
||||
## 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/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
ahavercos(x [,eps])
|
||||
|
||||
TYPES
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
|
||||
return real
|
||||
return real
|
||||
|
||||
DESCRIPTION
|
||||
Returns the inverse half versed trigonometric cosine of x to a multiple of eps with error less in
|
||||
@@ -16,7 +16,7 @@ DESCRIPTION
|
||||
|
||||
This function is sometimes called ahaverc, or archavercos, or archavercosine, is equivalent to:
|
||||
|
||||
ahavercos(x) = acos(2*x - 1)
|
||||
ahavercos(x) = acos(2*x - 1)
|
||||
|
||||
EXAMPLE
|
||||
; print ahavercos(0), ahavercos(0.5), ahavercos(1)
|
||||
@@ -64,14 +64,14 @@ SEE ALSO
|
||||
EXTERNAL RESOURCES
|
||||
For general information on trigonometric functions, see:
|
||||
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
|
||||
## Copyright (C) 2023 Landon Curt Noll
|
||||
##
|
||||
@@ -81,7 +81,7 @@ EXTERNAL RESOURCES
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -89,8 +89,8 @@ EXTERNAL RESOURCES
|
||||
## 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/24 11:18:04
|
||||
## File existed as early as: 2023
|
||||
## Under source code control: 2023/09/24 11:18:04
|
||||
## 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/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
ahaversin(x [,eps])
|
||||
|
||||
TYPES
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
|
||||
return real
|
||||
return real
|
||||
|
||||
DESCRIPTION
|
||||
Returns the inverse half versed trigonometric sine of x to a multiple of eps with error less in
|
||||
@@ -16,7 +16,7 @@ DESCRIPTION
|
||||
|
||||
This function is sometimes called ahavers, or archaversin, is equivalent to:
|
||||
|
||||
ahaversin(x) = acos(1 - 2*x)
|
||||
ahaversin(x) = acos(1 - 2*x)
|
||||
|
||||
EXAMPLE
|
||||
; print ahaversin(0), ahaversin(0.5), ahaversin(1)
|
||||
@@ -64,14 +64,14 @@ SEE ALSO
|
||||
EXTERNAL RESOURCES
|
||||
For general information on trigonometric functions, see:
|
||||
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
|
||||
## Copyright (C) 2023 Landon Curt Noll
|
||||
##
|
||||
@@ -81,7 +81,7 @@ EXTERNAL RESOURCES
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -89,8 +89,8 @@ EXTERNAL RESOURCES
|
||||
## 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/24 11:19:54
|
||||
## File existed as early as: 2023
|
||||
## Under source code control: 2023/09/24 11:19:54
|
||||
## 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/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
16
help/append
16
help/append
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
append(x, y_0, y_1, ...)
|
||||
|
||||
TYPES
|
||||
x lvalue whose value is a list
|
||||
y_0, ... any
|
||||
x lvalue whose value is a list
|
||||
y_0, ... any
|
||||
|
||||
return null value
|
||||
return null value
|
||||
|
||||
DESCRIPTION
|
||||
If after evaluation of y_0, y_1, ..., x is a list with contents
|
||||
@@ -68,7 +68,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -76,8 +76,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1994/03/19 03:13:17
|
||||
## File existed as early as: 1994
|
||||
## Under source code control: 1994/03/19 03:13:17
|
||||
## File existed as early as: 1994
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
102
help/appr
102
help/appr
@@ -5,11 +5,11 @@ SYNOPSIS
|
||||
appr(x [,y [,z]])
|
||||
|
||||
TYPES
|
||||
x real, complex, matrix, list
|
||||
y real
|
||||
z integer
|
||||
x real, complex, matrix, list
|
||||
y real
|
||||
z integer
|
||||
|
||||
return same type as x except that complex x may return a real number
|
||||
return same type as x except that complex x may return a real number
|
||||
|
||||
DESCRIPTION
|
||||
Return the approximate value of x as specified by a specific error
|
||||
@@ -24,77 +24,77 @@ DESCRIPTION
|
||||
In the following it is assumed y is nonzero and x is not a multiple of y.
|
||||
For real x:
|
||||
|
||||
appr(x,y,z) is either the nearest multiple of y greater
|
||||
than x or the nearest multiple of y less than x. Thus, if
|
||||
we write a = appr(x,y,z) and r = x - a, then a/y is an integer
|
||||
and abs(r) < abs(y). If r > 0, we say x has been "rounded down"
|
||||
to a; if r < 0, the rounding is "up". For particular x and y,
|
||||
whether the rounding is down or up is determined by z.
|
||||
appr(x,y,z) is either the nearest multiple of y greater
|
||||
than x or the nearest multiple of y less than x. Thus, if
|
||||
we write a = appr(x,y,z) and r = x - a, then a/y is an integer
|
||||
and abs(r) < abs(y). If r > 0, we say x has been "rounded down"
|
||||
to a; if r < 0, the rounding is "up". For particular x and y,
|
||||
whether the rounding is down or up is determined by z.
|
||||
|
||||
Only the 5 lowest bits of z are used, so we may assume z has been
|
||||
replaced by its value modulo 32. The type of rounding depends on
|
||||
z as follows:
|
||||
Only the 5 lowest bits of z are used, so we may assume z has been
|
||||
replaced by its value modulo 32. The type of rounding depends on
|
||||
z as follows:
|
||||
|
||||
z = 0 round down or up according as y is positive or negative,
|
||||
sgn(r) = sgn(y)
|
||||
z = 0 round down or up according as y is positive or negative,
|
||||
sgn(r) = sgn(y)
|
||||
|
||||
z = 1 round up or down according as y is positive or negative,
|
||||
sgn(r) = -sgn(y)
|
||||
z = 1 round up or down according as y is positive or negative,
|
||||
sgn(r) = -sgn(y)
|
||||
|
||||
z = 2 round towards zero, sgn(r) = sgn(x)
|
||||
z = 2 round towards zero, sgn(r) = sgn(x)
|
||||
|
||||
z = 3 round away from zero, sgn(r) = -sgn(x)
|
||||
z = 3 round away from zero, sgn(r) = -sgn(x)
|
||||
|
||||
z = 4 round down, r > 0
|
||||
z = 4 round down, r > 0
|
||||
|
||||
z = 5 round up, r < 0
|
||||
z = 5 round up, r < 0
|
||||
|
||||
z = 6 round towards or from zero according as y is positive or
|
||||
negative, sgn(r) = sgn(x/y)
|
||||
z = 6 round towards or from zero according as y is positive or
|
||||
negative, sgn(r) = sgn(x/y)
|
||||
|
||||
z = 7 round from or towards zero according as y is positive or
|
||||
negative, sgn(r) = -sgn(x/y)
|
||||
z = 7 round from or towards zero according as y is positive or
|
||||
negative, sgn(r) = -sgn(x/y)
|
||||
|
||||
z = 8 a/y is even
|
||||
z = 8 a/y is even
|
||||
|
||||
z = 9 a/y is odd
|
||||
z = 9 a/y is odd
|
||||
|
||||
z = 10 a/y is even or odd according as x/y is positive or negative
|
||||
z = 10 a/y is even or odd according as x/y is positive or negative
|
||||
|
||||
z = 11 a/y is odd or even according as x/y is positive or negative
|
||||
z = 11 a/y is odd or even according as x/y is positive or negative
|
||||
|
||||
z = 12 a/y is even or odd according as y is positive or negative
|
||||
z = 12 a/y is even or odd according as y is positive or negative
|
||||
|
||||
z = 13 a/y is odd or even according as y is positive or negative
|
||||
z = 13 a/y is odd or even according as y is positive or negative
|
||||
|
||||
z = 14 a/y is even or odd according as x is positive or negative
|
||||
z = 14 a/y is even or odd according as x is positive or negative
|
||||
|
||||
z = 15 a/y is odd or even according as x is positive or negative
|
||||
z = 15 a/y is odd or even according as x is positive or negative
|
||||
|
||||
z = 16 to 31 abs(r) <= abs(y)/2; if there is a unique multiple
|
||||
of y that is nearest x, appr(x,y,z) is that multiple of y
|
||||
and then abs(r) < abs(y)/2. If x is midway between
|
||||
successive multiples of y, then abs(r) = abs(y)/2 and
|
||||
the value of a is as given by appr(x, y, z-16).
|
||||
z = 16 to 31 abs(r) <= abs(y)/2; if there is a unique multiple
|
||||
of y that is nearest x, appr(x,y,z) is that multiple of y
|
||||
and then abs(r) < abs(y)/2. If x is midway between
|
||||
successive multiples of y, then abs(r) = abs(y)/2 and
|
||||
the value of a is as given by appr(x, y, z-16).
|
||||
|
||||
Matrix or List x:
|
||||
|
||||
appr(x,y,z) returns the matrix or list indexed in the same way as x,
|
||||
in which each element t has been replaced by appr(t,y,z).
|
||||
appr(x,y,z) returns the matrix or list indexed in the same way as x,
|
||||
in which each element t has been replaced by appr(t,y,z).
|
||||
|
||||
Complex x:
|
||||
|
||||
Returns appr(re(x), y, z) + appr(im(x), y, z) * 1i
|
||||
Returns appr(re(x), y, z) + appr(im(x), y, z) * 1i
|
||||
|
||||
PROPERTIES
|
||||
If appr(x,y,z) != x, then abs(x - appr(x,y,z)) < abs(y).
|
||||
If appr(x,y,z) != x, then abs(x - appr(x,y,z)) < abs(y).
|
||||
|
||||
If appr(x,y,z) != x and 16 <= z <= 31, abs(x - appr(x,y,z)) <= abs(y)/2.
|
||||
If appr(x,y,z) != x and 16 <= z <= 31, abs(x - appr(x,y,z)) <= abs(y)/2.
|
||||
|
||||
For z = 0, 1, 4, 5, 16, 17, 20 or 21, and any integer n,
|
||||
appr(x + n*y, y, z) = appr(x, y, z) + n * y.
|
||||
For z = 0, 1, 4, 5, 16, 17, 20 or 21, and any integer n,
|
||||
appr(x + n*y, y, z) = appr(x, y, z) + n * y.
|
||||
|
||||
If y is nonzero, appr(x,y,8)/y = an odd integer n only if x = n * y.
|
||||
If y is nonzero, appr(x,y,8)/y = an odd integer n only if x = n * y.
|
||||
|
||||
EXAMPLE
|
||||
; print appr(-5.44,0.1,0), appr(5.44,0.1,0), appr(5.7,1,0), appr(-5.7,1,0)
|
||||
@@ -159,7 +159,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -167,8 +167,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1994/09/25 17:18:21
|
||||
## File existed as early as: 1994
|
||||
## Under source code control: 1994/09/25 17:18:21
|
||||
## File existed as early as: 1994
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
16
help/archive
16
help/archive
@@ -2,11 +2,11 @@ Where to get the latest versions of calc
|
||||
|
||||
Official calc source is maintained on GitHub:
|
||||
|
||||
https://github.com/lcn2/calc
|
||||
https://github.com/lcn2/calc
|
||||
|
||||
Calc releases may be found as GitHub tagged releases:
|
||||
|
||||
https://github.com/lcn2/calc/releases?page=2
|
||||
https://github.com/lcn2/calc/releases?page=2
|
||||
|
||||
At the bottom of a given release is a "> Assets" that may
|
||||
be opened to reveal down-loadable files such as source
|
||||
@@ -14,7 +14,7 @@ Where to get the latest versions of calc
|
||||
|
||||
Landon Noll also maintains a calc home page at:
|
||||
|
||||
http://www.isthe.com/chongo/tech/comp/calc/
|
||||
http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
||||
Landon Curt Noll
|
||||
http://www.isthe.com/chongo/
|
||||
@@ -29,7 +29,7 @@ chongo <was here> /\../\
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -37,8 +37,8 @@ chongo <was here> /\../\
|
||||
## 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: 1996/06/13 02:51:48
|
||||
## File existed as early as: 1996
|
||||
## Under source code control: 1996/06/13 02:51:48
|
||||
## File existed as early as: 1996
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
16
help/arg
16
help/arg
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
arg(x [,eps])
|
||||
|
||||
TYPES
|
||||
x number
|
||||
eps nonzero real, defaults to epsilon()
|
||||
x number
|
||||
eps nonzero real, defaults to epsilon()
|
||||
|
||||
return real
|
||||
return real
|
||||
|
||||
DESCRIPTION
|
||||
Returns the argument of x to the nearest or next to nearest multiple of
|
||||
@@ -40,7 +40,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -48,8 +48,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1994/09/25 20:22:31
|
||||
## File existed as early as: 1994
|
||||
## Under source code control: 1994/09/25 20:22:31
|
||||
## File existed as early as: 1994
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
26
help/argv
26
help/argv
@@ -5,9 +5,9 @@ SYNOPSIS
|
||||
argv([n])
|
||||
|
||||
TYPES
|
||||
n nonnegative integer
|
||||
n nonnegative integer
|
||||
|
||||
return any
|
||||
return any
|
||||
|
||||
DESCRIPTION
|
||||
Without args, this builtin returns the number of calc command line
|
||||
@@ -22,16 +22,16 @@ DESCRIPTION
|
||||
assuming the calc is located in /usr/local/bin/calc, the first
|
||||
line of a calc script would be:
|
||||
|
||||
#!/usr/local/bin/calc -f
|
||||
...
|
||||
#!/usr/local/bin/calc -f
|
||||
...
|
||||
|
||||
then argv(0) will refer to the filename of the script.
|
||||
|
||||
As it is common to use -q in a calc script, and using that same
|
||||
/usr/local/bin/calc location:
|
||||
|
||||
#!/usr/local/bin/calc -q -f
|
||||
...
|
||||
#!/usr/local/bin/calc -q -f
|
||||
...
|
||||
|
||||
and again, argv(0) will refer to the filename of the script.
|
||||
|
||||
@@ -43,14 +43,14 @@ DESCRIPTION
|
||||
However, if calc is invoked with -s, all non-dashed options will
|
||||
be left as unevaluated strings. Thus:
|
||||
|
||||
calc -i 2+2
|
||||
calc -i 2+2
|
||||
|
||||
will cause calc to print 4 and enter interactive mode. In this case
|
||||
argv() will return 1.
|
||||
|
||||
On the other hand:
|
||||
|
||||
calc -i -s 2+2
|
||||
calc -i -s 2+2
|
||||
|
||||
will cause calc to interactive mode. The argv() builtin will return 2
|
||||
and argv(1) will return the string "2+2".
|
||||
@@ -84,7 +84,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -92,8 +92,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1999/11/23 19:45:05
|
||||
## File existed as early as: 1999
|
||||
## Under source code control: 1999/11/23 19:45:05
|
||||
## File existed as early as: 1999
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
24
help/arrow
24
help/arrow
@@ -1,14 +1,14 @@
|
||||
SYMBOL and NAME
|
||||
-> - arrow operator
|
||||
-> - arrow operator
|
||||
|
||||
SYNOPSIS
|
||||
p -> X
|
||||
|
||||
TYPES
|
||||
p pointer to an lvalue
|
||||
X identifier
|
||||
p pointer to an lvalue
|
||||
X identifier
|
||||
|
||||
return lvalue
|
||||
return lvalue
|
||||
|
||||
DESCRIPTION
|
||||
p->X returns the same as (*p).X. Thus the current value of *p is
|
||||
@@ -28,17 +28,17 @@ EXAMPLE
|
||||
; p = &A
|
||||
; p->one = 1; p->two = 2
|
||||
; A
|
||||
obj pair {1, 2}
|
||||
obj pair {1, 2}
|
||||
|
||||
; A->two = &B
|
||||
; p->one = 3; p->two = 4
|
||||
|
||||
; *p
|
||||
obj pair {3, 4}
|
||||
obj pair {3, 4}
|
||||
|
||||
; B = {5,6}
|
||||
; *p->two
|
||||
4
|
||||
4
|
||||
|
||||
LIMITS
|
||||
none
|
||||
@@ -57,7 +57,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -65,8 +65,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1997/09/06 20:03:34
|
||||
## File existed as early as: 1997
|
||||
## Under source code control: 1997/09/06 20:03:34
|
||||
## File existed as early as: 1997
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
32
help/asec
32
help/asec
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
asec(x [,eps])
|
||||
|
||||
TYPES
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
|
||||
return real
|
||||
return real
|
||||
|
||||
DESCRIPTION
|
||||
Returns the inverse trigonometric secant of x to a multiple of eps with error less in
|
||||
@@ -61,14 +61,14 @@ SEE ALSO
|
||||
EXTERNAL RESOURCES
|
||||
For general information on trigonometric functions, see:
|
||||
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
|
||||
## Copyright (C) 1999,2021,2023 Landon Curt Noll
|
||||
##
|
||||
@@ -78,7 +78,7 @@ EXTERNAL RESOURCES
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -86,8 +86,8 @@ EXTERNAL RESOURCES
|
||||
## 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: 1995/11/13 03:49:00
|
||||
## File existed as early as: 1995
|
||||
## Under source code control: 1995/11/13 03:49:00
|
||||
## File existed as early as: 1995
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
18
help/asech
18
help/asech
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
asech(x [,eps])
|
||||
|
||||
TYPES
|
||||
x real, 0 < x <= 1
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
x real, 0 < x <= 1
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
|
||||
return real
|
||||
return real
|
||||
|
||||
DESCRIPTION
|
||||
Returns the asech of x to a multiple of eps with error less in
|
||||
@@ -16,7 +16,7 @@ DESCRIPTION
|
||||
|
||||
asech(x) is the real number v for which sech(v) = x. It is given by
|
||||
|
||||
asech(x) = ln((1 + sqrt(1 - x^2))/x)
|
||||
asech(x) = ln((1 + sqrt(1 - x^2))/x)
|
||||
|
||||
EXAMPLE
|
||||
; print asech(.5,1e-5), asech(.5,1e-10), asech(.5,1e-15), asech(.5,1e-20)
|
||||
@@ -41,7 +41,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -49,8 +49,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1995/11/13 03:49:00
|
||||
## File existed as early as: 1995
|
||||
## Under source code control: 1995/11/13 03:49:00
|
||||
## File existed as early as: 1995
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
32
help/asin
32
help/asin
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
asin(x [,eps])
|
||||
|
||||
TYPES
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
|
||||
return real
|
||||
return real
|
||||
|
||||
DESCRIPTION
|
||||
Returns the inverse trigonometric sine of x to a multiple of eps with error less in
|
||||
@@ -61,14 +61,14 @@ SEE ALSO
|
||||
EXTERNAL RESOURCES
|
||||
For general information on trigonometric functions, see:
|
||||
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
|
||||
## Copyright (C) 1999,2021,2023 Landon Curt Noll
|
||||
##
|
||||
@@ -78,7 +78,7 @@ EXTERNAL RESOURCES
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -86,8 +86,8 @@ EXTERNAL RESOURCES
|
||||
## 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: 1994/03/19 01:40:24
|
||||
## File existed as early as: 1994
|
||||
## Under source code control: 1994/03/19 01:40:24
|
||||
## File existed as early as: 1994
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
18
help/asinh
18
help/asinh
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
asinh(x [,eps])
|
||||
|
||||
TYPES
|
||||
x real
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
x real
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
|
||||
return real
|
||||
return real
|
||||
|
||||
DESCRIPTION
|
||||
Returns the asinh of x to a multiple of eps with error less in
|
||||
@@ -16,7 +16,7 @@ DESCRIPTION
|
||||
|
||||
asinh(x) is the real number v for which sinh(v) = x. It is given by
|
||||
|
||||
asinh(x) = ln(x + sqrt(1 + x^2))
|
||||
asinh(x) = ln(x + sqrt(1 + x^2))
|
||||
|
||||
EXAMPLE
|
||||
; print asinh(2, 1e-5), asinh(2, 1e-10), asinh(2, 1e-15), asinh(2, 1e-20)
|
||||
@@ -41,7 +41,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -49,8 +49,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1994/03/19 01:40:25
|
||||
## File existed as early as: 1994
|
||||
## Under source code control: 1994/03/19 01:40:25
|
||||
## File existed as early as: 1994
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
38
help/assign
38
help/assign
@@ -6,14 +6,14 @@ SYNOPSIS
|
||||
a = {e_1, e_2, ...[ { ... } ] }
|
||||
|
||||
TYPES
|
||||
a lvalue, current value a structure in { } case
|
||||
a lvalue, current value a structure in { } case
|
||||
|
||||
b expression
|
||||
b expression
|
||||
|
||||
e_0, e_1, ... expressions, blanks, or initializer lists
|
||||
e_0, e_1, ... expressions, blanks, or initializer lists
|
||||
|
||||
|
||||
return lvalue (a)
|
||||
return lvalue (a)
|
||||
|
||||
DESCRIPTION
|
||||
Here an lvalue is either a simple variable specified by an identifier,
|
||||
@@ -22,7 +22,7 @@ DESCRIPTION
|
||||
|
||||
An initializer list is a comma-separated list enclosed in braces as in
|
||||
|
||||
{e_0, e_1, ... }
|
||||
{e_0, e_1, ... }
|
||||
|
||||
where each e_i is an expression, blank or initializer list.
|
||||
|
||||
@@ -44,7 +44,7 @@ DESCRIPTION
|
||||
In simple assignments, = associates from right to left so that, for
|
||||
example,
|
||||
|
||||
a = b = c
|
||||
a = b = c
|
||||
|
||||
has the effect of a = (b = c) and results in assigning the value of c
|
||||
to both a and b. The expression (a = b) = c is acceptable, but has the
|
||||
@@ -54,7 +54,7 @@ DESCRIPTION
|
||||
In initializations, = { ...} associates from left to right so that,
|
||||
for example,
|
||||
|
||||
a = {e_0, ... } = {v_0, ...}
|
||||
a = {e_0, ... } = {v_0, ...}
|
||||
|
||||
first assigns e_0, ... to the elements of a, and then assigns v_0, ...
|
||||
to the result.
|
||||
@@ -66,10 +66,10 @@ DESCRIPTION
|
||||
that of A[0] = A[1].
|
||||
|
||||
If, in execution of a = b, a is changed by the evaluation of b, the
|
||||
value of b may be stored in an unintended or inaccessible location. For
|
||||
value of b may be stored in an unintended or inaccessible location. For
|
||||
example,
|
||||
mat A[2]= {1,2};
|
||||
A[0] = (A = 3);
|
||||
mat A[2]= {1,2};
|
||||
A[0] = (A = 3);
|
||||
|
||||
results in the value 3 being stored not only as the new value for A
|
||||
but also at the now unnamed location earlier used for A[0].
|
||||
@@ -87,8 +87,8 @@ EXAMPLE
|
||||
; print A[1]
|
||||
|
||||
list (2 elements, 2 nonzero):
|
||||
[[0]] = 6
|
||||
[[1]] = 3
|
||||
[[0]] = 6
|
||||
[[1]] = 3
|
||||
|
||||
; print A[2]
|
||||
obj point {7, 5}
|
||||
@@ -104,8 +104,8 @@ EXAMPLE
|
||||
print A[1]
|
||||
|
||||
list (2 elements, 2 nonzero):
|
||||
[[0]] = 2
|
||||
[[1]] = 3
|
||||
[[0]] = 2
|
||||
[[1]] = 3
|
||||
|
||||
LIMITS
|
||||
none
|
||||
@@ -124,7 +124,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -132,8 +132,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1995/05/11 21:03:23
|
||||
## File existed as early as: 1995
|
||||
## Under source code control: 1995/05/11 21:03:23
|
||||
## File existed as early as: 1995
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
22
help/assoc
22
help/assoc
@@ -5,7 +5,7 @@ SYNOPSIS
|
||||
assoc()
|
||||
|
||||
TYPES
|
||||
return association
|
||||
return association
|
||||
|
||||
DESCRIPTION
|
||||
This function returns an empty association array.
|
||||
@@ -13,10 +13,10 @@ DESCRIPTION
|
||||
After A = assoc(), elements can be added to the association by
|
||||
assignments of the forms
|
||||
|
||||
A[a_1] = v_1
|
||||
A[a_1, a_2] = v_2
|
||||
A[a_1, a_2, a_3] = v_3
|
||||
A[a_1, a_2, a_3, a_4] = v_4
|
||||
A[a_1] = v_1
|
||||
A[a_1, a_2] = v_2
|
||||
A[a_1, a_2, a_3] = v_3
|
||||
A[a_1, a_2, a_3, a_4] = v_4
|
||||
|
||||
There are no restrictions on the values of the "indices" a_i or
|
||||
the "values" v_i.
|
||||
@@ -52,7 +52,7 @@ DESCRIPTION
|
||||
a sequential scan through the elements difficult.
|
||||
|
||||
The search and rsearch functions can search for an element in an
|
||||
association which has the specified value. They return the index
|
||||
association which has the specified value. They return the index
|
||||
of the found element, or a NULL value if the value was not found.
|
||||
|
||||
Associations can be copied by an assignment, and can be compared
|
||||
@@ -90,7 +90,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -98,8 +98,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1994/09/25 20:22:31
|
||||
## File existed as early as: 1994
|
||||
## Under source code control: 1994/09/25 20:22:31
|
||||
## File existed as early as: 1994
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
32
help/atan
32
help/atan
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
atan(x [,eps])
|
||||
|
||||
TYPES
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
|
||||
return real
|
||||
return real
|
||||
|
||||
DESCRIPTION
|
||||
Returns the inverse trigonometric tangent of x to a multiple of eps with error less in
|
||||
@@ -61,14 +61,14 @@ SEE ALSO
|
||||
EXTERNAL RESOURCES
|
||||
For general information on trigonometric functions, see:
|
||||
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
|
||||
## Copyright (C) 1999,2023 Landon Curt Noll
|
||||
##
|
||||
@@ -78,7 +78,7 @@ EXTERNAL RESOURCES
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -86,8 +86,8 @@ EXTERNAL RESOURCES
|
||||
## 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: 1994/03/19 01:40:25
|
||||
## File existed as early as: 1994
|
||||
## Under source code control: 1994/03/19 01:40:25
|
||||
## File existed as early as: 1994
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
18
help/atan2
18
help/atan2
@@ -5,11 +5,11 @@ SYNOPSIS
|
||||
atan2(y, x, [,eps])
|
||||
|
||||
TYPES
|
||||
y real
|
||||
x real
|
||||
eps nonzero real, defaults to epsilon()
|
||||
y real
|
||||
x real
|
||||
eps nonzero real, defaults to epsilon()
|
||||
|
||||
return real
|
||||
return real
|
||||
|
||||
DESCRIPTION
|
||||
If x and y are not both zero, atan2(y, x, eps) returns, as a multiple of
|
||||
@@ -44,7 +44,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -52,8 +52,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1994/03/19 01:40:26
|
||||
## File existed as early as: 1994
|
||||
## Under source code control: 1994/03/19 01:40:26
|
||||
## File existed as early as: 1994
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
18
help/atanh
18
help/atanh
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
atanh(x [,eps])
|
||||
|
||||
TYPES
|
||||
x real
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
x real
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
|
||||
return real
|
||||
return real
|
||||
|
||||
DESCRIPTION
|
||||
Returns the atanh of x to a multiple of eps with error less in
|
||||
@@ -16,7 +16,7 @@ DESCRIPTION
|
||||
|
||||
atanh(x) is the real number v for which tanh(v) = x. It is given by
|
||||
|
||||
atanh(x) = ln((1 + x)/(1 - x))/2
|
||||
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)
|
||||
@@ -41,7 +41,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -49,8 +49,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1994/03/19 01:40:27
|
||||
## File existed as early as: 1994
|
||||
## Under source code control: 1994/03/19 01:40:27
|
||||
## File existed as early as: 1994
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
34
help/avercos
34
help/avercos
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
avercos(x [,eps])
|
||||
|
||||
TYPES
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
|
||||
return real
|
||||
return real
|
||||
|
||||
DESCRIPTION
|
||||
Returns the inverse versed trigonometric cosine of x to a multiple of eps with error less in
|
||||
@@ -16,7 +16,7 @@ DESCRIPTION
|
||||
|
||||
This function is sometimes called averc, or arcvercos, is equivalent to:
|
||||
|
||||
avercos(x) = acos(x - 1)
|
||||
avercos(x) = acos(x - 1)
|
||||
|
||||
EXAMPLE
|
||||
; print avercos(0), avercos(0.5), avercos(1)
|
||||
@@ -61,14 +61,14 @@ SEE ALSO
|
||||
EXTERNAL RESOURCES
|
||||
For general information on trigonometric functions, see:
|
||||
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
|
||||
## Copyright (C) 2023 Landon Curt Noll
|
||||
##
|
||||
@@ -78,7 +78,7 @@ EXTERNAL RESOURCES
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -86,8 +86,8 @@ EXTERNAL RESOURCES
|
||||
## 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/05 23:40:24
|
||||
## File existed as early as: 2023
|
||||
## Under source code control: 2023/09/05 23:40: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/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
34
help/aversin
34
help/aversin
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
aversin(x [,eps])
|
||||
|
||||
TYPES
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
|
||||
return real
|
||||
return real
|
||||
|
||||
DESCRIPTION
|
||||
Returns the inverse versed trigonometric sine of x to a multiple of eps with error less in
|
||||
@@ -16,7 +16,7 @@ DESCRIPTION
|
||||
|
||||
This function is sometimes called avers, or arcversin, is equivalent to:
|
||||
|
||||
aversin(x) = acos(1 - x)
|
||||
aversin(x) = acos(1 - x)
|
||||
|
||||
EXAMPLE
|
||||
; print aversin(0), aversin(0.5), aversin(1)
|
||||
@@ -61,14 +61,14 @@ SEE ALSO
|
||||
EXTERNAL RESOURCES
|
||||
For general information on trigonometric functions, see:
|
||||
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
|
||||
## Copyright (C) 2023 Landon Curt Noll
|
||||
##
|
||||
@@ -78,7 +78,7 @@ EXTERNAL RESOURCES
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -86,8 +86,8 @@ EXTERNAL RESOURCES
|
||||
## 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
|
||||
## 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/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
24
help/avg
24
help/avg
@@ -5,16 +5,16 @@ SYNOPSIS
|
||||
avg(x_1, x_2, ...)
|
||||
|
||||
TYPES
|
||||
x_1, ... arithmetic or list
|
||||
x_1, ... arithmetic or list
|
||||
|
||||
return as determined by types of items averaged
|
||||
return as determined by types of items averaged
|
||||
|
||||
DESCRIPTION
|
||||
If there are n non-list arguments x_1, x_2, ..., x_n,
|
||||
for which the required additions and division by n are defined,
|
||||
avg(x_1, x_2, ..., x_n) returns the value of:
|
||||
|
||||
(x_1 + x_2 + ... + x_n)/n.
|
||||
(x_1 + x_2 + ... + x_n)/n.
|
||||
|
||||
If the x_i are real, the result will be a real number; if the
|
||||
x_i are real or complex numbers, the result will be a real or complex
|
||||
@@ -35,10 +35,10 @@ EXAMPLE
|
||||
; avg(x,y)
|
||||
|
||||
mat [2,2] (4 elements, 4 nonzero):
|
||||
[0,0] = 1
|
||||
[0,1] = 2
|
||||
[1,0] = 3.5
|
||||
[1,1] = 6
|
||||
[0,0] = 1
|
||||
[0,1] = 2
|
||||
[1,0] = 3.5
|
||||
[1,1] = 6
|
||||
|
||||
LIMITS
|
||||
The number of arguments is not to exceed 1024.
|
||||
@@ -57,7 +57,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -65,8 +65,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1994/09/25 20:22:31
|
||||
## File existed as early as: 1994
|
||||
## Under source code control: 1994/09/25 20:22:31
|
||||
## File existed as early as: 1994
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
64
help/base
64
help/base
@@ -5,9 +5,9 @@ SYNOPSIS
|
||||
base([mode])
|
||||
|
||||
TYPES
|
||||
mode real
|
||||
mode real
|
||||
|
||||
return real
|
||||
return real
|
||||
|
||||
DESCRIPTION
|
||||
The base function allows one to specify how numbers should be
|
||||
@@ -18,34 +18,34 @@ DESCRIPTION
|
||||
|
||||
The following convention is used to declare modes:
|
||||
|
||||
base equivalent
|
||||
config("mode")'s
|
||||
base equivalent
|
||||
config("mode")'s
|
||||
|
||||
2 "binary" base 2 fractions
|
||||
"bin"
|
||||
2 "binary" base 2 fractions
|
||||
"bin"
|
||||
|
||||
8 "octal" base 8 fractions
|
||||
"oct"
|
||||
8 "octal" base 8 fractions
|
||||
"oct"
|
||||
|
||||
10 "real" base 10 floating point
|
||||
"float"
|
||||
"default"
|
||||
10 "real" base 10 floating point
|
||||
"float"
|
||||
"default"
|
||||
|
||||
-10 "integer" base 10 integers
|
||||
"int"
|
||||
-10 "integer" base 10 integers
|
||||
"int"
|
||||
|
||||
16 "hexadecimal" base 16 fractions
|
||||
"hex"
|
||||
16 "hexadecimal" base 16 fractions
|
||||
"hex"
|
||||
|
||||
1/3 "fraction" base 10 fractions
|
||||
"frac"
|
||||
1/3 "fraction" base 10 fractions
|
||||
"frac"
|
||||
|
||||
1e20 "scientific" base 10 scientific notation
|
||||
"sci"
|
||||
"exp"
|
||||
1e20 "scientific" base 10 scientific notation
|
||||
"sci"
|
||||
"exp"
|
||||
|
||||
1000 "engineering" base 10 notation with exponent
|
||||
"eng" multiple of 3
|
||||
1000 "engineering" base 10 notation with exponent
|
||||
"eng" multiple of 3
|
||||
|
||||
For convenience, any non-integer value is assumed to mean base 10
|
||||
fractions and any integer >= 2^64 is assumed to mean base 10
|
||||
@@ -53,21 +53,21 @@ DESCRIPTION
|
||||
|
||||
These base() calls have the same meaning as config("mode", "fraction"):
|
||||
|
||||
base(1/3) base(0.1415) base(16/37)
|
||||
base(1/3) base(0.1415) base(16/37)
|
||||
|
||||
These base() calls have the same meaning as config("mode", "scientific"):
|
||||
|
||||
base(1e20) base(2^64) base(2^8191-1)
|
||||
base(1e20) base(2^64) base(2^8191-1)
|
||||
|
||||
However the base() function will only return one of the base values
|
||||
listed in the table above.
|
||||
|
||||
EXAMPLE
|
||||
; base()
|
||||
10
|
||||
10
|
||||
|
||||
; base(8)
|
||||
012
|
||||
012
|
||||
|
||||
; print 10
|
||||
012
|
||||
@@ -79,7 +79,7 @@ LINK LIBRARY
|
||||
int math_setmode(int newmode)
|
||||
|
||||
NOTE: newmode must be one of MODE_DEFAULT, MODE_FRAC, MODE_INT,
|
||||
MODE_REAL, MODE_EXP, MODE_ENG, MODE_HEX, MODE_OCTAL, MODE_BINARY
|
||||
MODE_REAL, MODE_EXP, MODE_ENG, MODE_HEX, MODE_OCTAL, MODE_BINARY
|
||||
|
||||
SEE ALSO
|
||||
base2, config, str
|
||||
@@ -92,7 +92,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -100,8 +100,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1994/09/30 00:09:39
|
||||
## File existed as early as: 1994
|
||||
## Under source code control: 1994/09/30 00:09:39
|
||||
## File existed as early as: 1994
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
74
help/base2
74
help/base2
@@ -5,9 +5,9 @@ SYNOPSIS
|
||||
base2([mode])
|
||||
|
||||
TYPES
|
||||
mode real
|
||||
mode real
|
||||
|
||||
return real
|
||||
return real
|
||||
|
||||
DESCRIPTION
|
||||
By default, calc will output values according to the default base
|
||||
@@ -19,41 +19,41 @@ DESCRIPTION
|
||||
to base2(). In double base output mode, the second time a value is
|
||||
displayed, it is displayed within comments:
|
||||
|
||||
21701 /* 0x54c5 */
|
||||
21701 /* 0x54c5 */
|
||||
|
||||
The arguments for base2() are identical to base() with the addition
|
||||
of the 0 value:
|
||||
|
||||
base2 equivalent
|
||||
config("mode2")'s
|
||||
base2 equivalent
|
||||
config("mode2")'s
|
||||
|
||||
2 "binary" base 2 fractions
|
||||
"bin"
|
||||
2 "binary" base 2 fractions
|
||||
"bin"
|
||||
|
||||
8 "octal" base 8 fractions
|
||||
"oct"
|
||||
8 "octal" base 8 fractions
|
||||
"oct"
|
||||
|
||||
10 "real" base 10 floating point
|
||||
"float"
|
||||
"default"
|
||||
10 "real" base 10 floating point
|
||||
"float"
|
||||
"default"
|
||||
|
||||
-10 "integer" base 10 integers
|
||||
"int"
|
||||
-10 "integer" base 10 integers
|
||||
"int"
|
||||
|
||||
16 "hexadecimal" base 16 fractions
|
||||
"hex"
|
||||
16 "hexadecimal" base 16 fractions
|
||||
"hex"
|
||||
|
||||
1/3 "fraction" base 10 fractions
|
||||
"frac"
|
||||
1/3 "fraction" base 10 fractions
|
||||
"frac"
|
||||
|
||||
1e20 "scientific" base 10 scientific notation
|
||||
"sci"
|
||||
"exp"
|
||||
1e20 "scientific" base 10 scientific notation
|
||||
"sci"
|
||||
"exp"
|
||||
|
||||
1000 "engineering" base 10 notation with exponent
|
||||
"eng" multiple of 3
|
||||
1000 "engineering" base 10 notation with exponent
|
||||
"eng" multiple of 3
|
||||
|
||||
0 "off" disable double base output
|
||||
0 "off" disable double base output
|
||||
|
||||
For convenience, any non-integer non-zero value is assumed to mean
|
||||
base 10 fractions and any integer >= 2^64 is assumed to mean base 10
|
||||
@@ -61,27 +61,27 @@ DESCRIPTION
|
||||
|
||||
These base2() calls have the same meaning as config("mode2", "fraction"):
|
||||
|
||||
base2(1/3) base2(0.1415) base2(16/37)
|
||||
base2(1/3) base2(0.1415) base2(16/37)
|
||||
|
||||
These base2() calls have the same meaning as config("mode2", "scientific"):
|
||||
|
||||
base2(1e20) base2(2^64) base2(2^8191-1)
|
||||
base2(1e20) base2(2^64) base2(2^8191-1)
|
||||
|
||||
However the base2() function will only return one of the base values
|
||||
listed in the table above.
|
||||
|
||||
EXAMPLE
|
||||
; base2()
|
||||
0
|
||||
0
|
||||
; base2(8)
|
||||
0 /* 0 */
|
||||
0 /* 0 */
|
||||
; print 10
|
||||
10 /* 012 */
|
||||
; base2(16),
|
||||
; 131072
|
||||
131072 /* 0x20000 */
|
||||
131072 /* 0x20000 */
|
||||
; 2345
|
||||
2345 /* 0x929 */
|
||||
2345 /* 0x929 */
|
||||
|
||||
LIMITS
|
||||
none
|
||||
@@ -90,8 +90,8 @@ LINK LIBRARY
|
||||
int math_setmode2(int newmode)
|
||||
|
||||
NOTE: newmode must be one of MODE_DEFAULT, MODE_FRAC, MODE_INT,
|
||||
MODE_REAL, MODE_EXP, MODE_ENG, MODE_HEX, MODE_OCTAL, MODE_BINARY,
|
||||
MODE2_OFF
|
||||
MODE_REAL, MODE_EXP, MODE_ENG, MODE_HEX, MODE_OCTAL, MODE_BINARY,
|
||||
MODE2_OFF
|
||||
|
||||
SEE ALSO
|
||||
base, config, str
|
||||
@@ -104,7 +104,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -112,8 +112,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 2002/12/29 00:21:07
|
||||
## File existed as early as: 2002
|
||||
## Under source code control: 2002/12/29 00:21:07
|
||||
## File existed as early as: 2002
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
@@ -5,15 +5,15 @@ SYNOPSIS
|
||||
bernoulli(n)
|
||||
|
||||
TYPES
|
||||
n integer, n < 2^31 if even
|
||||
n integer, n < 2^31 if even
|
||||
|
||||
return rational
|
||||
return rational
|
||||
|
||||
DESCRIPTION
|
||||
Returns the Bernoulli number with index n, i.e. the coefficient B_n in
|
||||
the expansion
|
||||
|
||||
t/(exp(t) - 1) = Sum B_n * t^n/n!
|
||||
t/(exp(t) - 1) = Sum B_n * t^n/n!
|
||||
|
||||
bernoulli(n) is zero both for n < 0 and for n odd and > 2.
|
||||
When bernoulli(n) is computed for positive even n, the values for
|
||||
@@ -49,7 +49,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -57,7 +57,7 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 2000/07/13 01:33:00
|
||||
## File existed as early as: 2000
|
||||
## Under source code control: 2000/07/13 01:33:00
|
||||
## File existed as early as: 2000
|
||||
##
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
24
help/bit
24
help/bit
@@ -5,17 +5,17 @@ SYNOPSIS
|
||||
bit(x, y)
|
||||
|
||||
TYPES
|
||||
x real
|
||||
y int
|
||||
x real
|
||||
y int
|
||||
|
||||
return int
|
||||
return int
|
||||
|
||||
DESCRIPTION
|
||||
Determine if the binary bit y is set in x. If:
|
||||
Determine if the binary bit y is set in x. If:
|
||||
|
||||
x
|
||||
int(---) mod 2 == 1
|
||||
2^y
|
||||
x
|
||||
int(---) mod 2 == 1
|
||||
2^y
|
||||
|
||||
return 1, otherwise return 0.
|
||||
|
||||
@@ -50,7 +50,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -58,8 +58,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1994/10/21 02:21:30
|
||||
## File existed as early as: 1994
|
||||
## Under source code control: 1994/10/21 02:21:30
|
||||
## File existed as early as: 1994
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
96
help/blk
96
help/blk
@@ -6,11 +6,11 @@ SYNOPSIS
|
||||
blk(val [, len, chunk]);
|
||||
|
||||
TYPES
|
||||
len null or integer
|
||||
chunk null or integer
|
||||
val non-null string, block, or named block
|
||||
len null or integer
|
||||
chunk null or integer
|
||||
val non-null string, block, or named block
|
||||
|
||||
return block or named block
|
||||
return block or named block
|
||||
|
||||
DESCRIPTION
|
||||
With only integer arguments, blk(len, chunk) attempts to
|
||||
@@ -26,23 +26,23 @@ 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, size(B) is increased to i + 1. For example:
|
||||
some i >= len is referenced, size(B) is increased to i + 1. For example:
|
||||
|
||||
B[i] = x
|
||||
B[i] = x
|
||||
|
||||
has an effect like that of two operations on a file stream fs:
|
||||
|
||||
fseek(fs, pos);
|
||||
fputc(fs, x).
|
||||
fseek(fs, pos);
|
||||
fputc(fs, x).
|
||||
|
||||
Similarly:
|
||||
|
||||
x = B[i]
|
||||
x = B[i]
|
||||
|
||||
is like:
|
||||
|
||||
fseek(fs, pos);
|
||||
x = fgetc(fs).
|
||||
fseek(fs, pos);
|
||||
x = fgetc(fs).
|
||||
|
||||
The value of chunk is stored as the "chunksize" for B.
|
||||
|
||||
@@ -51,7 +51,7 @@ DESCRIPTION
|
||||
value. Also size(B) is analogous to the length of a file stream in that
|
||||
if size(B) < sizeof(B):
|
||||
|
||||
B[size(B)] = x
|
||||
B[size(B)] = x
|
||||
|
||||
will append one octet to B and increment size(B).
|
||||
|
||||
@@ -70,14 +70,14 @@ DESCRIPTION
|
||||
If a block value B created by B = blk(len, chunk) is assigned to
|
||||
another variable by C = B, a new block of the same structure as B
|
||||
is created to become the value of C, and the octets in B are copied
|
||||
to this new block. A block with possibly different length or
|
||||
to this new block. A block with possibly different length or
|
||||
chunksize is created by C = blk(B, newlen, newchunk), only the first
|
||||
min(len, newlen) octets being copied from B; later octets are
|
||||
assigned zero value. If omitted, newlen and newchunk default to
|
||||
the current datalen and chunk-size for B. The current datalen,
|
||||
chunksize and number of allocated octets for B may be changed by:
|
||||
|
||||
B = blk(B, newlen, newchunk).
|
||||
B = blk(B, newlen, newchunk).
|
||||
|
||||
No data is lost if newlen is greater than or equal to the old
|
||||
size(B).
|
||||
@@ -99,38 +99,38 @@ DESCRIPTION
|
||||
is that in assignments, a named block is not copied. Thus, if a
|
||||
block A has been created by:
|
||||
|
||||
A = blk("foo")
|
||||
A = blk("foo")
|
||||
any subsequent:
|
||||
B = A
|
||||
B = A
|
||||
or:
|
||||
B = blk("foo")
|
||||
B = blk("foo")
|
||||
|
||||
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 block. Its length or chunksize may be changed by
|
||||
instructions like:
|
||||
|
||||
blk(A, len, chunk);
|
||||
blk(A, len, chunk);
|
||||
|
||||
A = blk(A, len, chunk);
|
||||
A = blk(A, len, chunk);
|
||||
|
||||
null(blk(A, len, chunk)).
|
||||
null(blk(A, len, chunk)).
|
||||
|
||||
These have the same effect on A; when working interactively, the
|
||||
last two avoid printing of the new value for A.
|
||||
|
||||
Named blocks are assigned index numbers 0, 1, 2, ..., in the order
|
||||
of their creation. The block with index id is returned by blocks(id).
|
||||
of their creation. The block with index id is returned by blocks(id).
|
||||
With no argument, blocks() returns the number of current unfreed
|
||||
named blocks.
|
||||
|
||||
The memory allocated to a named block is freed by the blkfree()
|
||||
function with argument the named block, its name, or its id number.
|
||||
The block remains in existence but with a null data pointer,
|
||||
its length and size being reduced to zero. A new block of memory
|
||||
its length and size being reduced to zero. A new block of memory
|
||||
may be allocated to it, with possibly new length and chunksize by:
|
||||
|
||||
blk(val [, len, chunk])
|
||||
blk(val [, len, chunk])
|
||||
|
||||
where val is either the named block or its name.
|
||||
|
||||
@@ -141,7 +141,7 @@ DESCRIPTION
|
||||
|
||||
The identifying numbers and names of the current named blocks are
|
||||
displayed by:
|
||||
show blocks
|
||||
show blocks
|
||||
|
||||
If A and B are named blocks, A == B will be true only if they refer
|
||||
to the same block of memory. Thus, blocks with the same data and
|
||||
@@ -158,13 +158,13 @@ EXAMPLE
|
||||
|
||||
; B[7] = 0xff
|
||||
; B
|
||||
chunksize = 10, maxsize = 20, datalen = 15
|
||||
00000000000000ff00000000000000
|
||||
chunksize = 10, maxsize = 20, datalen = 15
|
||||
00000000000000ff00000000000000
|
||||
|
||||
; B[18] = 127
|
||||
; B
|
||||
chunksize = 10, maxsize = 20, datalen = 18
|
||||
00000000000000ff0000000000000000007f
|
||||
chunksize = 10, maxsize = 20, datalen = 18
|
||||
00000000000000ff0000000000000000007f
|
||||
|
||||
; B[20] = 2
|
||||
Index out of bounds for block
|
||||
@@ -174,38 +174,38 @@ EXAMPLE
|
||||
|
||||
; B = blk(B, 100, 20)
|
||||
; B
|
||||
chunksize = 20, maxsize = 120, datalen = 100
|
||||
00000000000000ff0000000000000000007f000000000000000000000000...
|
||||
chunksize = 20, maxsize = 120, datalen = 100
|
||||
00000000000000ff0000000000000000007f000000000000000000000000...
|
||||
|
||||
; C = blk(B, 10} = {1,2,3}
|
||||
; C
|
||||
chunksize = 20, maxsize = 20, datalen = 10
|
||||
01020300000000ff0000
|
||||
chunksize = 20, maxsize = 20, datalen = 10
|
||||
01020300000000ff0000
|
||||
|
||||
; A1 = blk("alpha")
|
||||
; A1
|
||||
block 0: alpha
|
||||
chunksize = 256, maxsize = 256, datalen = 0
|
||||
block 0: alpha
|
||||
chunksize = 256, maxsize = 256, datalen = 0
|
||||
|
||||
; A1[7] = 0xff
|
||||
; A2 = A1
|
||||
; A2[17] = 127
|
||||
; A1
|
||||
block 0: alpha
|
||||
chunksize = 256, maxsize = 256, datalen = 18
|
||||
00000000000000ff0000000000000000007f
|
||||
block 0: alpha
|
||||
chunksize = 256, maxsize = 256, datalen = 18
|
||||
00000000000000ff0000000000000000007f
|
||||
|
||||
; A1 = blk(A1, 1000)
|
||||
; A1
|
||||
block 0: alpha
|
||||
chunksize = 256, maxsize = 1024, datalen = 1000
|
||||
00000000000000ff0000000000000000007f000000000000000000000000...
|
||||
block 0: alpha
|
||||
chunksize = 256, maxsize = 1024, datalen = 1000
|
||||
00000000000000ff0000000000000000007f000000000000000000000000...
|
||||
|
||||
; A1 = blk(A1, , 16)
|
||||
; A1
|
||||
block 0: alpha
|
||||
chunksize = 16, maxsize = 1008, datalen = 1000
|
||||
00000000000000ff0000000000000000007f000000000000000000000000...
|
||||
block 0: alpha
|
||||
chunksize = 16, maxsize = 1008, datalen = 1000
|
||||
00000000000000ff0000000000000000007f000000000000000000000000...
|
||||
|
||||
LIMITS
|
||||
0 <= len < 2^31
|
||||
@@ -241,7 +241,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -249,8 +249,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1997/04/05 13:07:13
|
||||
## File existed as early as: 1997
|
||||
## Under source code control: 1997/04/05 13:07:13
|
||||
## File existed as early as: 1997
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
154
help/blkcpy
154
help/blkcpy
@@ -6,20 +6,20 @@ SYNOPSIS
|
||||
copy(src, dest [, [ssi [, num [, dsi]]])
|
||||
|
||||
TYPES
|
||||
src block, file, string, matrix, or list
|
||||
dest block, file, matrix or list - compatible with src
|
||||
src block, file, string, matrix, or list
|
||||
dest block, file, matrix or list - compatible with src
|
||||
|
||||
ssi nonnegative integer, defaults to zero
|
||||
num nonnegative integer, defaults to maximum possible
|
||||
dsi nonnegative integer, defaults to datalen for a block, filepos
|
||||
for a file, zero for other structures
|
||||
ssi nonnegative integer, defaults to zero
|
||||
num nonnegative integer, defaults to maximum possible
|
||||
dsi nonnegative integer, defaults to datalen for a block, filepos
|
||||
for a file, zero for other structures
|
||||
|
||||
return null if successful, error value otherwise
|
||||
return null if successful, error value otherwise
|
||||
|
||||
DESCRIPTION
|
||||
A call to:
|
||||
|
||||
blkcpy(dst, src, num, dsi, ssi)
|
||||
blkcpy(dst, src, num, dsi, ssi)
|
||||
|
||||
attempts to copy 'num' consecutive items (octets or values) starting
|
||||
from the source item 'src' with index 'ssi'. By default, 'num'
|
||||
@@ -27,7 +27,7 @@ DESCRIPTION
|
||||
|
||||
A call to:
|
||||
|
||||
copy(src, dst, ssi, num, dsi)
|
||||
copy(src, dst, ssi, num, dsi)
|
||||
|
||||
does the same thing, but with a different arg order.
|
||||
|
||||
@@ -40,30 +40,30 @@ DESCRIPTION
|
||||
|
||||
The following pairs of source-type, destination-type are permitted:
|
||||
|
||||
block to
|
||||
int
|
||||
block
|
||||
matrix
|
||||
file
|
||||
block to
|
||||
int
|
||||
block
|
||||
matrix
|
||||
file
|
||||
|
||||
matrix to
|
||||
block
|
||||
matrix
|
||||
list
|
||||
matrix to
|
||||
block
|
||||
matrix
|
||||
list
|
||||
|
||||
string to
|
||||
block
|
||||
file
|
||||
string to
|
||||
block
|
||||
file
|
||||
|
||||
list to
|
||||
list
|
||||
matrix
|
||||
list to
|
||||
list
|
||||
matrix
|
||||
|
||||
file to
|
||||
block
|
||||
file to
|
||||
block
|
||||
|
||||
int to
|
||||
block
|
||||
int to
|
||||
block
|
||||
|
||||
In the above table, int refers to integer values. However if a
|
||||
rational value is supplied, only the numerator is copied.
|
||||
@@ -79,18 +79,18 @@ DESCRIPTION
|
||||
sufficient memory allocated for the copying. For example, to copy
|
||||
a matrix M of size 100 to a newly created list, one may use:
|
||||
|
||||
; L = makelist(100);
|
||||
; copy(M, L);
|
||||
; L = makelist(100);
|
||||
; copy(M, L);
|
||||
or:
|
||||
; L = makelist(100);
|
||||
; blkcpy(L, M);
|
||||
; L = makelist(100);
|
||||
; blkcpy(L, M);
|
||||
|
||||
For copying from a block B (named or unnamed), the total number of octets
|
||||
available for copying is taken to the datalen for that block,
|
||||
so that num can be at most size(B) - ssi.
|
||||
|
||||
For copying to a block B (named or unnamed), reallocation will be
|
||||
required if dsi + num > sizeof(B). (This will not be permitted if
|
||||
required if dsi + num > sizeof(B). (This will not be permitted if
|
||||
protect(B) has bit 4 set.)
|
||||
|
||||
For copying from a file stream fs, num can be at most size(fs) - ssi.
|
||||
@@ -111,74 +111,74 @@ EXAMPLE
|
||||
; B = blk()
|
||||
; blkcpy(B,A)
|
||||
; B
|
||||
chunksize = 256, maxsize = 256, datalen = 4
|
||||
01020304
|
||||
chunksize = 256, maxsize = 256, datalen = 4
|
||||
01020304
|
||||
; blkcpy(B,A)
|
||||
; B
|
||||
chunksize = 256, maxsize = 256, datalen = 8
|
||||
0102030401020304
|
||||
chunksize = 256, maxsize = 256, datalen = 8
|
||||
0102030401020304
|
||||
; blkcpy(B, A, 2, 10)
|
||||
; B
|
||||
chunksize = 256, maxsize = 256, datalen = 12
|
||||
010203040102030400000102
|
||||
chunksize = 256, maxsize = 256, datalen = 12
|
||||
010203040102030400000102
|
||||
; blkcpy(B,32767)
|
||||
; B
|
||||
chunksize = 256, maxsize = 256, datalen = 16
|
||||
010203040102030400000102ff7f0000
|
||||
chunksize = 256, maxsize = 256, datalen = 16
|
||||
010203040102030400000102ff7f0000
|
||||
; 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
|
||||
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
|
||||
mat [2,2] (4 elements, 4 nonzero):
|
||||
[0,0] = 1
|
||||
[0,1] = 2
|
||||
[1,0] = 1
|
||||
[1,1] = 2
|
||||
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
|
||||
chunksize = 256, maxsize = 256, datalen = 4
|
||||
01020304
|
||||
chunksize = 256, maxsize = 256, datalen = 4
|
||||
01020304
|
||||
; copy(A,B)
|
||||
; B
|
||||
chunksize = 256, maxsize = 256, datalen = 8
|
||||
0102030401020304
|
||||
chunksize = 256, maxsize = 256, datalen = 8
|
||||
0102030401020304
|
||||
; copy(A,B,1,2)
|
||||
; B
|
||||
chunksize = 256, maxsize = 256, datalen = 10
|
||||
01020304010203040203
|
||||
chunksize = 256, maxsize = 256, datalen = 10
|
||||
01020304010203040203
|
||||
; 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
|
||||
mat [2,2] (4 elements, 4 nonzero):
|
||||
[0,0] = 1
|
||||
[0,1] = 2
|
||||
[1,0] = 3
|
||||
[1,1] = 4
|
||||
|
||||
; copy(A,M,2)
|
||||
; M
|
||||
mat [2,2] (4 elements, 4 nonzero):
|
||||
[0,0] = 3
|
||||
[0,1] = 4
|
||||
[1,0] = 3
|
||||
[1,1] = 4
|
||||
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
|
||||
mat [2,2] (4 elements, 4 nonzero):
|
||||
[0,0] = 3
|
||||
[0,1] = 4
|
||||
[1,0] = 1
|
||||
[1,1] = 2
|
||||
mat [2,2] (4 elements, 4 nonzero):
|
||||
[0,0] = 3
|
||||
[0,1] = 4
|
||||
[1,0] = 1
|
||||
[1,1] = 2
|
||||
|
||||
LIMITS
|
||||
none
|
||||
@@ -197,7 +197,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -205,8 +205,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1997/04/05 14:08:50
|
||||
## File existed as early as: 1997
|
||||
## Under source code control: 1997/04/05 14:08:50
|
||||
## File existed as early as: 1997
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
38
help/blkfree
38
help/blkfree
@@ -5,14 +5,14 @@ SYNOPSIS
|
||||
blkfree(val)
|
||||
|
||||
TYPES
|
||||
val named block, string, or integer
|
||||
val named block, string, or integer
|
||||
|
||||
return null value
|
||||
return null value
|
||||
|
||||
DESCRIPTION
|
||||
If val is a named block, or the name of a named block, or the
|
||||
identifying index for a named block, blkfree(val) frees the
|
||||
memory block allocated to this named block. The block remains
|
||||
memory block allocated to this named block. The block remains
|
||||
in existence with the same name, identifying index, and chunksize,
|
||||
but its size and maxsize becomes zero and the pointer for the start
|
||||
of its data block null.
|
||||
@@ -26,27 +26,27 @@ EXAMPLE
|
||||
; B1 = blk("foo")
|
||||
; B2 = blk("Second block")
|
||||
show blocks
|
||||
id name
|
||||
id name
|
||||
---- -----
|
||||
0 foo
|
||||
1 Second block
|
||||
0 foo
|
||||
1 Second block
|
||||
|
||||
; blkfree(B1)
|
||||
; show blocks
|
||||
id name
|
||||
id name
|
||||
---- -----
|
||||
1 Second block
|
||||
1 Second block
|
||||
|
||||
; B1
|
||||
block 0: foo
|
||||
chunksize = 256, maxsize = 0, datalen = 0
|
||||
NULL
|
||||
block 0: foo
|
||||
chunksize = 256, maxsize = 0, datalen = 0
|
||||
NULL
|
||||
|
||||
; blk(B1); B[7] = 5
|
||||
; B1
|
||||
block 0: foo
|
||||
chunksize = 256, maxsize = 256, datalen = 8
|
||||
0000000000000005
|
||||
block 0: foo
|
||||
chunksize = 256, maxsize = 256, datalen = 8
|
||||
0000000000000005
|
||||
|
||||
LIMITS
|
||||
none
|
||||
@@ -65,7 +65,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -73,8 +73,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1997/04/05 13:07:13
|
||||
## File existed as early as: 1997
|
||||
## Under source code control: 1997/04/05 13:07:13
|
||||
## File existed as early as: 1997
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
26
help/blocks
26
help/blocks
@@ -5,9 +5,9 @@ SYNOPSIS
|
||||
blocks([id])
|
||||
|
||||
TYPES
|
||||
id non-negative integer
|
||||
id non-negative integer
|
||||
|
||||
return named block or null value
|
||||
return named block or null value
|
||||
|
||||
DESCRIPTION
|
||||
With no argument blocks() returns the number of blocks that have
|
||||
@@ -22,15 +22,15 @@ EXAMPLE
|
||||
; A = blk("alpha")
|
||||
; B = blk("beta") = {1,2,3}
|
||||
; blocks()
|
||||
2
|
||||
2
|
||||
; blocks(1)
|
||||
block 1: beta
|
||||
chunksize = 256, maxsize = 256, datalen = 3
|
||||
010203
|
||||
block 1: beta
|
||||
chunksize = 256, maxsize = 256, datalen = 3
|
||||
010203
|
||||
; blocks(2)
|
||||
Error E_BLOCKS_2
|
||||
Error E_BLOCKS_2
|
||||
; strerror()
|
||||
"Non-allocated index number for blocks"
|
||||
"Non-allocated index number for blocks"
|
||||
|
||||
LIMITS
|
||||
none
|
||||
@@ -49,7 +49,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -57,8 +57,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1997/04/05 13:07:13
|
||||
## File existed as early as: 1997
|
||||
## Under source code control: 1997/04/05 13:07:13
|
||||
## File existed as early as: 1997
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
80
help/bround
80
help/bround
@@ -12,16 +12,16 @@ TYPES
|
||||
Otherwise, if x is an object of type tt, or if x is not an object or
|
||||
number but y is an object of type tt, and the function tt_bround has
|
||||
to be defined; the types for x, plcs, rnd, and the returned value,
|
||||
if any, are as required for specified in tt_bround. For the object
|
||||
if any, are as required for specified in tt_bround. For the object
|
||||
case, plcs and rnd default to the null value.
|
||||
|
||||
For other cases:
|
||||
|
||||
x number (real or complex)
|
||||
plcs integer, defaults to zero
|
||||
rnd integer, defaults to config("round")
|
||||
x number (real or complex)
|
||||
plcs integer, defaults to zero
|
||||
rnd integer, defaults to config("round")
|
||||
|
||||
return number
|
||||
return number
|
||||
|
||||
DESCRIPTION
|
||||
For real x, bround(x, plcs, rnd) returns x rounded to either
|
||||
@@ -31,39 +31,39 @@ DESCRIPTION
|
||||
If the number of binary places is n and eps = 10^-n, the
|
||||
result is the same as for appr(x, eps, rnd). This will be
|
||||
exactly x if x is a multiple of eps; otherwise rounding occurs
|
||||
to one of the nearest multiples of eps on either side of x. Which
|
||||
to one of the nearest multiples of eps on either side of x. Which
|
||||
of these multiples is returned is determined by z = rnd & 31, i.e.
|
||||
the five low order bits of rnd, as follows:
|
||||
|
||||
z = 0 or 4: round down, i.e. towards minus infinity
|
||||
z = 1 or 5: round up, i.e. towards plus infinity
|
||||
z = 2 or 6: round towards zero
|
||||
z = 3 or 7: round away from zero
|
||||
z = 8 or 12: round to the nearest even multiple of eps
|
||||
z = 9 or 13: round to the nearest odd multiple of eps
|
||||
z = 10 or 14: round to nearest even or odd multiple of eps
|
||||
according as x > or < 0
|
||||
z = 11 or 15: round to nearest odd or even multiple of eps
|
||||
according as x > or < 0
|
||||
z = 16 to 31: round to the nearest multiple of eps when
|
||||
this is uniquely determined. Otherwise
|
||||
rounding is as if z is replaced by z - 16
|
||||
z = 0 or 4: round down, i.e. towards minus infinity
|
||||
z = 1 or 5: round up, i.e. towards plus infinity
|
||||
z = 2 or 6: round towards zero
|
||||
z = 3 or 7: round away from zero
|
||||
z = 8 or 12: round to the nearest even multiple of eps
|
||||
z = 9 or 13: round to the nearest odd multiple of eps
|
||||
z = 10 or 14: round to nearest even or odd multiple of eps
|
||||
according as x > or < 0
|
||||
z = 11 or 15: round to nearest odd or even multiple of eps
|
||||
according as x > or < 0
|
||||
z = 16 to 31: round to the nearest multiple of eps when
|
||||
this is uniquely determined. Otherwise
|
||||
rounding is as if z is replaced by z - 16
|
||||
|
||||
For complex x:
|
||||
|
||||
The real and imaginary parts are rounded as for real x; if the
|
||||
imaginary part rounds to zero, the result is real.
|
||||
The real and imaginary parts are rounded as for real x; if the
|
||||
imaginary part rounds to zero, the result is real.
|
||||
|
||||
For matrix or list x:
|
||||
|
||||
The returned values has element bround(x[[i]], plcs, rnd) in
|
||||
the same position as x[[i]] in x.
|
||||
The returned values has element bround(x[[i]], plcs, rnd) in
|
||||
the same position as x[[i]] in x.
|
||||
|
||||
For object x or plcs:
|
||||
|
||||
When bround(x, plcs, rnd) is called, x is passed by address so may be
|
||||
changed by assignments; plcs and rnd are copied to temporary
|
||||
variables, so their values are not changed by the call.
|
||||
When bround(x, plcs, rnd) is called, x is passed by address so may be
|
||||
changed by assignments; plcs and rnd are copied to temporary
|
||||
variables, so their values are not changed by the call.
|
||||
|
||||
EXAMPLE
|
||||
; a = 7/32, b = -7/32
|
||||
@@ -100,18 +100,18 @@ EXAMPLE
|
||||
; print round(A,2,24)
|
||||
|
||||
list(7 elements, 7 nonzero):
|
||||
[[0]] = 0.12
|
||||
[[1]] = 0.25
|
||||
[[3]] = 0.38
|
||||
[[4]] = 0.5
|
||||
[[5]] = 0.62
|
||||
[[6]] = 0.75
|
||||
[[7]] = 0.88
|
||||
[[0]] = 0.12
|
||||
[[1]] = 0.25
|
||||
[[3]] = 0.38
|
||||
[[4]] = 0.5
|
||||
[[5]] = 0.62
|
||||
[[6]] = 0.75
|
||||
[[7]] = 0.88
|
||||
|
||||
LIMITS
|
||||
For non-object case:
|
||||
0 <= abs(plcs) < 2^31
|
||||
0 <= abs(rnd) < 2^31
|
||||
0 <= abs(plcs) < 2^31
|
||||
0 <= abs(rnd) < 2^31
|
||||
|
||||
LINK LIBRARY
|
||||
void broundvalue(VALUE *x, VALUE *plcs, VALUE *rnd, VALUE *result)
|
||||
@@ -130,7 +130,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -138,8 +138,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1994/09/30 00:22:35
|
||||
## File existed as early as: 1994
|
||||
## Under source code control: 1994/09/30 00:22:35
|
||||
## File existed as early as: 1994
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
16
help/btrunc
16
help/btrunc
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
btrunc(x [,plcs])
|
||||
|
||||
TYPES
|
||||
x real
|
||||
plcs integer, defaults to zero
|
||||
x real
|
||||
plcs integer, defaults to zero
|
||||
|
||||
return real
|
||||
return real
|
||||
|
||||
DESCRIPTION
|
||||
Truncate x to plcs binary places, rounding if necessary towards zero,
|
||||
@@ -51,7 +51,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -59,8 +59,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1994/09/30 00:44:27
|
||||
## File existed as early as: 1994
|
||||
## Under source code control: 1994/09/30 00:44:27
|
||||
## File existed as early as: 1994
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
334
help/builtin.end
334
help/builtin.end
@@ -1,203 +1,203 @@
|
||||
|
||||
The config function sets or reads the value of a configuration
|
||||
parameter. The first argument is a string which names the parameter
|
||||
to be set or read. If only one argument is given, then the current
|
||||
value of the named parameter is returned. If two arguments are given,
|
||||
then the named parameter is set to the value of the second argument,
|
||||
and the old value of the parameter is returned. Therefore you can
|
||||
change a parameter and restore its old value later. The possible
|
||||
parameters are explained in the next section.
|
||||
The config function sets or reads the value of a configuration
|
||||
parameter. The first argument is a string which names the parameter
|
||||
to be set or read. If only one argument is given, then the current
|
||||
value of the named parameter is returned. If two arguments are given,
|
||||
then the named parameter is set to the value of the second argument,
|
||||
and the old value of the parameter is returned. Therefore you can
|
||||
change a parameter and restore its old value later. The possible
|
||||
parameters are explained in the next section.
|
||||
|
||||
The scale function multiplies or divides a number by a power of 2.
|
||||
This is used for fractional calculations, unlike the << and >>
|
||||
operators, which are only defined for integers. For example,
|
||||
scale(6, -3) is 3/4.
|
||||
The scale function multiplies or divides a number by a power of 2.
|
||||
This is used for fractional calculations, unlike the << and >>
|
||||
operators, which are only defined for integers. For example,
|
||||
scale(6, -3) is 3/4.
|
||||
|
||||
The quomod function is used to obtain both the quotient and remainder
|
||||
of a division in one operation. The first two arguments a and b are
|
||||
the numbers to be divided. The last two arguments c and d are two
|
||||
variables which will be assigned the quotient and remainder. For
|
||||
nonnegative arguments, the results are equivalent to computing a//b
|
||||
and a%b. If a is negative and the remainder is nonzero, then the
|
||||
quotient will be one less than a//b. This makes the following three
|
||||
properties always hold: The quotient c is always an integer. The
|
||||
remainder d is always 0 <= d < b. The equation a = b * c + d always
|
||||
holds. This function returns 0 if there is no remainder, and 1 if
|
||||
there is a remainder. For examples, quomod(10, 3, x, y) sets x to 3,
|
||||
y to 1, and returns the value 1, and quomod(-4, 3.14159, x, y) sets x
|
||||
to -2, y to 2.28318, and returns the value 1.
|
||||
The quomod function is used to obtain both the quotient and remainder
|
||||
of a division in one operation. The first two arguments a and b are
|
||||
the numbers to be divided. The last two arguments c and d are two
|
||||
variables which will be assigned the quotient and remainder. For
|
||||
nonnegative arguments, the results are equivalent to computing a//b
|
||||
and a%b. If a is negative and the remainder is nonzero, then the
|
||||
quotient will be one less than a//b. This makes the following three
|
||||
properties always hold: The quotient c is always an integer. The
|
||||
remainder d is always 0 <= d < b. The equation a = b * c + d always
|
||||
holds. This function returns 0 if there is no remainder, and 1 if
|
||||
there is a remainder. For examples, quomod(10, 3, x, y) sets x to 3,
|
||||
y to 1, and returns the value 1, and quomod(-4, 3.14159, x, y) sets x
|
||||
to -2, y to 2.28318, and returns the value 1.
|
||||
|
||||
The eval function accepts a string argument and evaluates the
|
||||
expression represented by the string and returns its value.
|
||||
The expression can include function calls and variable references.
|
||||
For example, eval("fact(3) + 7") returns 13. When combined with
|
||||
the prompt function, this allows the calculator to read values from
|
||||
the user. For example, x=eval(prompt("Number: ")) sets x to the
|
||||
value input by the user.
|
||||
The eval function accepts a string argument and evaluates the
|
||||
expression represented by the string and returns its value.
|
||||
The expression can include function calls and variable references.
|
||||
For example, eval("fact(3) + 7") returns 13. When combined with
|
||||
the prompt function, this allows the calculator to read values from
|
||||
the user. For example, x=eval(prompt("Number: ")) sets x to the
|
||||
value input by the user.
|
||||
|
||||
The digit and bit functions return individual digits of a number,
|
||||
either in base 10 or in base 2, where the lowest digit of a number
|
||||
is at digit position 0. For example, digit(5678, 3) is 5, and
|
||||
bit(0b1000100, 2) is 1. Negative digit positions indicate places
|
||||
to the right of the decimal or binary point, so that for example,
|
||||
digit(3.456, -1) is 4.
|
||||
The digit and bit functions return individual digits of a number,
|
||||
either in base 10 or in base 2, where the lowest digit of a number
|
||||
is at digit position 0. For example, digit(5678, 3) is 5, and
|
||||
bit(0b1000100, 2) is 1. Negative digit positions indicate places
|
||||
to the right of the decimal or binary point, so that for example,
|
||||
digit(3.456, -1) is 4.
|
||||
|
||||
The ptest builtin is a primality testing function. The
|
||||
1st argument is the suspected prime to be tested. The
|
||||
absolute value of the 2nd argument is an iteration count.
|
||||
The ptest builtin is a primality testing function. The
|
||||
1st argument is the suspected prime to be tested. The
|
||||
absolute value of the 2nd argument is an iteration count.
|
||||
|
||||
If ptest is called with only 2 args, the 3rd argument is
|
||||
assumed to be 0. If ptest is called with only 1 arg, the
|
||||
2nd argument is assumed to be 1. Thus, the following
|
||||
calls are equivalent:
|
||||
If ptest is called with only 2 args, the 3rd argument is
|
||||
assumed to be 0. If ptest is called with only 1 arg, the
|
||||
2nd argument is assumed to be 1. Thus, the following
|
||||
calls are equivalent:
|
||||
|
||||
ptest(a)
|
||||
ptest(a,1)
|
||||
ptest(a,1,0)
|
||||
ptest(a)
|
||||
ptest(a,1)
|
||||
ptest(a,1,0)
|
||||
|
||||
Normally ptest performs a some checks to determine if the
|
||||
value is divisible by some trivial prime. If the 2nd
|
||||
argument is < 0, then the trivial check is omitted.
|
||||
Normally ptest performs a some checks to determine if the
|
||||
value is divisible by some trivial prime. If the 2nd
|
||||
argument is < 0, then the trivial check is omitted.
|
||||
|
||||
For example, ptest(a,10) performs the same work as:
|
||||
For example, ptest(a,10) performs the same work as:
|
||||
|
||||
ptest(a,-3) (7 tests without trivial check)
|
||||
ptest(a,-7,3) (3 more tests without the trivial check)
|
||||
ptest(a,-3) (7 tests without trivial check)
|
||||
ptest(a,-7,3) (3 more tests without the trivial check)
|
||||
|
||||
The ptest function returns 0 if the number is definitely not
|
||||
prime, and 1 is the number is probably prime. The chance
|
||||
of a number which is probably prime being actually composite
|
||||
is less than 1/4 raised to the power of the iteration count.
|
||||
For example, for a random number p, ptest(p, 10) incorrectly
|
||||
returns 1 less than once in every million numbers, and you
|
||||
will probably never find a number where ptest(p, 20) gives
|
||||
the wrong answer.
|
||||
The ptest function returns 0 if the number is definitely not
|
||||
prime, and 1 is the number is probably prime. The chance
|
||||
of a number which is probably prime being actually composite
|
||||
is less than 1/4 raised to the power of the iteration count.
|
||||
For example, for a random number p, ptest(p, 10) incorrectly
|
||||
returns 1 less than once in every million numbers, and you
|
||||
will probably never find a number where ptest(p, 20) gives
|
||||
the wrong answer.
|
||||
|
||||
The first 3 args of nextcand and prevcand functions are the same
|
||||
arguments as ptest. But unlike ptest, nextcand and prevcand return
|
||||
the next and previous values for which ptest is true.
|
||||
The first 3 args of nextcand and prevcand functions are the same
|
||||
arguments as ptest. But unlike ptest, nextcand and prevcand return
|
||||
the next and previous values for which ptest is true.
|
||||
|
||||
For example, nextcand(2^1000) returns 2^1000+297 because
|
||||
2^1000+297 is the smallest value x > 2^1000 for which
|
||||
ptest(x,1) is true. And for example, prevcand(2^31-1,10,5)
|
||||
returns 2147483629 (2^31-19) because 2^31-19 is the largest
|
||||
value y < 2^31-1 for which ptest(y,10,5) is true.
|
||||
For example, nextcand(2^1000) returns 2^1000+297 because
|
||||
2^1000+297 is the smallest value x > 2^1000 for which
|
||||
ptest(x,1) is true. And for example, prevcand(2^31-1,10,5)
|
||||
returns 2147483629 (2^31-19) because 2^31-19 is the largest
|
||||
value y < 2^31-1 for which ptest(y,10,5) is true.
|
||||
|
||||
The nextcand and prevcand functions also have a 5 argument form:
|
||||
The nextcand and prevcand functions also have a 5 argument form:
|
||||
|
||||
nextcand(num, count, skip, modval, modulus)
|
||||
prevcand(num, count, skip, modval, modulus)
|
||||
nextcand(num, count, skip, modval, modulus)
|
||||
prevcand(num, count, skip, modval, modulus)
|
||||
|
||||
return the smallest (or largest) value ans > num (or < num) that
|
||||
is also == modval % modulus for which ptest(ans,count,skip) is true.
|
||||
return the smallest (or largest) value ans > num (or < num) that
|
||||
is also == modval % modulus for which ptest(ans,count,skip) is true.
|
||||
|
||||
The builtins nextprime(x) and prevprime(x) return the
|
||||
next and previous primes with respect to x respectively.
|
||||
As of this release, x must be < 2^32. With one argument, they
|
||||
will return an error if x is out of range. With two arguments,
|
||||
they will not generate an error but instead will return y.
|
||||
The builtins nextprime(x) and prevprime(x) return the
|
||||
next and previous primes with respect to x respectively.
|
||||
As of this release, x must be < 2^32. With one argument, they
|
||||
will return an error if x is out of range. With two arguments,
|
||||
they will not generate an error but instead will return y.
|
||||
|
||||
The builtin function pix(x) returns the number of primes <= x.
|
||||
As of this release, x must be < 2^32. With one argument, pix(x)
|
||||
will return an error if x is out of range. With two arguments,
|
||||
pix(x,y) will not generate an error but instead will return y.
|
||||
The builtin function pix(x) returns the number of primes <= x.
|
||||
As of this release, x must be < 2^32. With one argument, pix(x)
|
||||
will return an error if x is out of range. With two arguments,
|
||||
pix(x,y) will not generate an error but instead will return y.
|
||||
|
||||
The builtin function factor may be used to search for the
|
||||
smallest factor of a given number. The call factor(x,y)
|
||||
will attempt to find the smallest factor of x < min(x,y).
|
||||
As of this release, y must be < 2^32. If y is omitted, y
|
||||
is assumed to be 2^32-1.
|
||||
The builtin function factor may be used to search for the
|
||||
smallest factor of a given number. The call factor(x,y)
|
||||
will attempt to find the smallest factor of x < min(x,y).
|
||||
As of this release, y must be < 2^32. If y is omitted, y
|
||||
is assumed to be 2^32-1.
|
||||
|
||||
If x < 0, factor(x,y) will return -1. If no factor <
|
||||
min(x,y) is found, factor(x,y) will return 1. In all other
|
||||
cases, factor(x,y) will return the smallest prime factor
|
||||
of x. Note except for the case when abs(x) == 1, factor(x,y)
|
||||
will not return x.
|
||||
If x < 0, factor(x,y) will return -1. If no factor <
|
||||
min(x,y) is found, factor(x,y) will return 1. In all other
|
||||
cases, factor(x,y) will return the smallest prime factor
|
||||
of x. Note except for the case when abs(x) == 1, factor(x,y)
|
||||
will not return x.
|
||||
|
||||
If factor is called with y that is too large, or if x or y
|
||||
is not an integer, calc will report an error. If a 3rd argument
|
||||
is given, factor will return that value instead. For example,
|
||||
factor(1/2,b,c) will return c instead of issuing an error.
|
||||
If factor is called with y that is too large, or if x or y
|
||||
is not an integer, calc will report an error. If a 3rd argument
|
||||
is given, factor will return that value instead. For example,
|
||||
factor(1/2,b,c) will return c instead of issuing an error.
|
||||
|
||||
The builtin lfactor(x,y) searches a number of primes instead
|
||||
of below a limit. As of this release, y must be <= 203280221
|
||||
(y <= pix(2^32-1)). In all other cases, lfactor is operates
|
||||
in the same way as factor.
|
||||
The builtin lfactor(x,y) searches a number of primes instead
|
||||
of below a limit. As of this release, y must be <= 203280221
|
||||
(y <= pix(2^32-1)). In all other cases, lfactor is operates
|
||||
in the same way as factor.
|
||||
|
||||
If lfactor is called with y that is too large, or if x or y
|
||||
is not an integer, calc will report an error. If a 3rd argument
|
||||
is given, lfactor will return that value instead. For example,
|
||||
lfactor(1/2,b,c) will return c instead of issuing an error.
|
||||
If lfactor is called with y that is too large, or if x or y
|
||||
is not an integer, calc will report an error. If a 3rd argument
|
||||
is given, lfactor will return that value instead. For example,
|
||||
lfactor(1/2,b,c) will return c instead of issuing an error.
|
||||
|
||||
The lfactor function is slower than factor. If possible factor
|
||||
should be used instead of lfactor.
|
||||
The lfactor function is slower than factor. If possible factor
|
||||
should be used instead of lfactor.
|
||||
|
||||
The builtin isprime(x) will attempt to determine if x is prime.
|
||||
As of this release, x must be < 2^32. With one argument, isprime(x)
|
||||
will return an error if x is out of range. With two arguments,
|
||||
isprime(x,y) will not generate an error but instead will return y.
|
||||
The builtin isprime(x) will attempt to determine if x is prime.
|
||||
As of this release, x must be < 2^32. With one argument, isprime(x)
|
||||
will return an error if x is out of range. With two arguments,
|
||||
isprime(x,y) will not generate an error but instead will return y.
|
||||
|
||||
The functions rcin, rcmul, rcout, rcpow, and rcsq are used to
|
||||
perform modular arithmetic calculations for large odd numbers
|
||||
faster than the usual methods. To do this, you first use the
|
||||
rcin function to convert all input values into numbers which are
|
||||
in a format called REDC format. Then you use rcmul, rcsq, and
|
||||
rcpow to multiply such numbers together to produce results also
|
||||
in REDC format. Finally, you use rcout to convert a number in
|
||||
REDC format back to a normal number. The addition, subtraction,
|
||||
negation, and equality comparison between REDC numbers are done
|
||||
using the normal modular methods. For example, to calculate the
|
||||
value 13 * 17 + 1 (mod 11), you could use:
|
||||
The functions rcin, rcmul, rcout, rcpow, and rcsq are used to
|
||||
perform modular arithmetic calculations for large odd numbers
|
||||
faster than the usual methods. To do this, you first use the
|
||||
rcin function to convert all input values into numbers which are
|
||||
in a format called REDC format. Then you use rcmul, rcsq, and
|
||||
rcpow to multiply such numbers together to produce results also
|
||||
in REDC format. Finally, you use rcout to convert a number in
|
||||
REDC format back to a normal number. The addition, subtraction,
|
||||
negation, and equality comparison between REDC numbers are done
|
||||
using the normal modular methods. For example, to calculate the
|
||||
value 13 * 17 + 1 (mod 11), you could use:
|
||||
|
||||
p = 11;
|
||||
t1 = rcin(13, p);
|
||||
t2 = rcin(17, p);
|
||||
t3 = rcin(1, p);
|
||||
t4 = rcmul(t1, t2, p);
|
||||
t5 = (t4 + t3) % p;
|
||||
answer = rcout(t5, p);
|
||||
p = 11;
|
||||
t1 = rcin(13, p);
|
||||
t2 = rcin(17, p);
|
||||
t3 = rcin(1, p);
|
||||
t4 = rcmul(t1, t2, p);
|
||||
t5 = (t4 + t3) % p;
|
||||
answer = rcout(t5, p);
|
||||
|
||||
The swap function exchanges the values of two variables without
|
||||
performing copies. For example, after:
|
||||
The swap function exchanges the values of two variables without
|
||||
performing copies. For example, after:
|
||||
|
||||
x = 17;
|
||||
y = 19;
|
||||
swap(x, y);
|
||||
x = 17;
|
||||
y = 19;
|
||||
swap(x, y);
|
||||
|
||||
then x is 19 and y is 17. This function should not be used to
|
||||
swap a value which is contained within another one. If this is
|
||||
done, then some memory will be lost. For example, the following
|
||||
should not be done:
|
||||
then x is 19 and y is 17. This function should not be used to
|
||||
swap a value which is contained within another one. If this is
|
||||
done, then some memory will be lost. For example, the following
|
||||
should not be done:
|
||||
|
||||
mat x[5];
|
||||
swap(x, x[0]);
|
||||
mat x[5];
|
||||
swap(x, x[0]);
|
||||
|
||||
The hash function returns a relatively small non-negative integer
|
||||
for one or more input values. The hash values should not be used
|
||||
across runs of the calculator, since the algorithms used to generate
|
||||
the hash value may change with different versions of the calculator.
|
||||
The hash function returns a relatively small non-negative integer
|
||||
for one or more input values. The hash values should not be used
|
||||
across runs of the calculator, since the algorithms used to generate
|
||||
the hash value may change with different versions of the calculator.
|
||||
|
||||
The base function allows one to specify how numbers should be
|
||||
printed. The base function provides a numeric shorthand to the
|
||||
config("mode") interface. With no args, base() will return the
|
||||
current mode. With 1 arg, base(val) will set the mode according to
|
||||
the arg and return the previous mode.
|
||||
The base function allows one to specify how numbers should be
|
||||
printed. The base function provides a numeric shorthand to the
|
||||
config("mode") interface. With no args, base() will return the
|
||||
current mode. With 1 arg, base(val) will set the mode according to
|
||||
the arg and return the previous mode.
|
||||
|
||||
The following convention is used to declare modes:
|
||||
The following convention is used to declare modes:
|
||||
|
||||
base config
|
||||
value string
|
||||
base config
|
||||
value string
|
||||
|
||||
2 "binary" binary fractions
|
||||
8 "octal" octal fractions
|
||||
10 "real" decimal floating point
|
||||
16 "hex" hexadecimal fractions
|
||||
-10 "int" decimal integer
|
||||
1/3 "frac" decimal fractions
|
||||
1e20 "exp" decimal exponential
|
||||
2 "binary" binary fractions
|
||||
8 "octal" octal fractions
|
||||
10 "real" decimal floating point
|
||||
16 "hex" hexadecimal fractions
|
||||
-10 "int" decimal integer
|
||||
1/3 "frac" decimal fractions
|
||||
1e20 "exp" decimal exponential
|
||||
|
||||
For convenience, any non-integer value is assumed to mean "frac",
|
||||
and any integer >= 2^64 is assumed to mean "exp".
|
||||
For convenience, any non-integer value is assumed to mean "frac",
|
||||
and any integer >= 2^64 is assumed to mean "exp".
|
||||
|
||||
## Copyright (C) 1999-2017,2021 Landon Curt Noll
|
||||
##
|
||||
@@ -207,7 +207,7 @@
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -215,8 +215,8 @@
|
||||
## 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: 1995/07/10 01:17:53
|
||||
## File existed as early as: 1995
|
||||
## Under source code control: 1995/07/10 01:17:53
|
||||
## File existed as early as: 1995
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
@@ -1,11 +1,11 @@
|
||||
Builtin functions
|
||||
|
||||
There is a large number of built-in functions. Many of the
|
||||
functions work on several types of arguments, whereas some only
|
||||
work for the correct types (e.g., numbers or strings). In the
|
||||
following description, this is indicated by whether or not the
|
||||
description refers to values or numbers. This display is generated
|
||||
by the 'show builtin' command.
|
||||
There is a large number of built-in functions. Many of the
|
||||
functions work on several types of arguments, whereas some only
|
||||
work for the correct types (e.g., numbers or strings). In the
|
||||
following description, this is indicated by whether or not the
|
||||
description refers to values or numbers. This display is generated
|
||||
by the 'show builtin' command.
|
||||
|
||||
## Copyright (C) 1999 Landon Curt Noll
|
||||
##
|
||||
@@ -15,7 +15,7 @@ Builtin functions
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -23,8 +23,8 @@ Builtin functions
|
||||
## 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: 1995/07/10 01:17:53
|
||||
## File existed as early as: 1995
|
||||
## Under source code control: 1995/07/10 01:17:53
|
||||
## File existed as early as: 1995
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
@@ -5,7 +5,7 @@ SYNOPSIS
|
||||
calc_tty()
|
||||
|
||||
TYPES
|
||||
return none if appears to be successful, error-value otherwise
|
||||
return none if appears to be successful, error-value otherwise
|
||||
|
||||
DESCRIPTION
|
||||
This may enable a return to normal operation if abnormal activity
|
||||
@@ -13,9 +13,9 @@ DESCRIPTION
|
||||
may occur when activity is resumed by an fg command after a ctrl-Z
|
||||
interrupt, or by any of the three commands:
|
||||
|
||||
; !stty echo
|
||||
; !stty -cbreak
|
||||
; !stty echo -cbreak
|
||||
; !stty echo
|
||||
; !stty -cbreak
|
||||
; !stty echo -cbreak
|
||||
|
||||
EXAMPLE
|
||||
; calc_tty();
|
||||
@@ -34,7 +34,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -42,7 +42,7 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 2000/12/14 01:33:00
|
||||
## File existed as early as: 2000
|
||||
## Under source code control: 2000/12/14 01:33:00
|
||||
## File existed as early as: 2000
|
||||
##
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
@@ -5,12 +5,12 @@ SYNOPSIS
|
||||
calclevel()
|
||||
|
||||
TYPES
|
||||
return nonnegative integer
|
||||
return nonnegative integer
|
||||
|
||||
DESCRIPTION
|
||||
This function returns the calculation level at which it is called.
|
||||
When a command is being read from a terminal or from a file,
|
||||
calc is at calculation level zero. The level is increased
|
||||
calc is at calculation level zero. The level is increased
|
||||
by 1 each time calculation starts of a user-defined function
|
||||
or of eval(S) for some expression S which evaluates to a string. It
|
||||
decreases to zero if an error occurs or a quit or abort statement
|
||||
@@ -45,7 +45,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -53,8 +53,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1999/10/31 06:01:21
|
||||
## File existed as early as: 1999
|
||||
## Under source code control: 1999/10/31 06:01:21
|
||||
## File existed as early as: 1999
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
@@ -5,7 +5,7 @@ SYNOPSIS
|
||||
calcpath()
|
||||
|
||||
TYPES
|
||||
return string
|
||||
return string
|
||||
|
||||
DESCRIPTION
|
||||
This function returns the current value of the CALCPATH search path.
|
||||
@@ -40,7 +40,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -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.
|
||||
##
|
||||
## Under source code control: 2006/05/07 23:56:04
|
||||
## File existed as early as: 2006
|
||||
## 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/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
34
help/cas
34
help/cas
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
cas(x [,eps])
|
||||
|
||||
TYPES
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
|
||||
return number
|
||||
return number
|
||||
|
||||
DESCRIPTION
|
||||
Calculate the trigonometric cosine plus sine of x to a multiple of eps with error less in
|
||||
@@ -16,7 +16,7 @@ DESCRIPTION
|
||||
|
||||
This function is sometimes called cosine and sine, is equivalent to:
|
||||
|
||||
cas(x) = cos(x) + sin(x)
|
||||
cas(x) = cos(x) + sin(x)
|
||||
|
||||
EXAMPLE
|
||||
; print cas(1/2), cas(5/7), cas(42/7)
|
||||
@@ -54,14 +54,14 @@ SEE ALSO
|
||||
EXTERNAL RESOURCES
|
||||
For general information on trigonometric functions, see:
|
||||
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
|
||||
## Copyright (C) 2023 Landon Curt Noll
|
||||
##
|
||||
@@ -71,7 +71,7 @@ EXTERNAL RESOURCES
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -79,8 +79,8 @@ EXTERNAL RESOURCES
|
||||
## 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/10/02 23:11:18
|
||||
## File existed as early as: 2023
|
||||
## Under source code control: 2023/10/02 23:11:18
|
||||
## 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/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
14
help/catalan
14
help/catalan
@@ -5,14 +5,14 @@ SYNOPSIS
|
||||
catalan(n)
|
||||
|
||||
TYPES
|
||||
n integer
|
||||
n integer
|
||||
|
||||
return integer
|
||||
return integer
|
||||
|
||||
DESCRIPTION
|
||||
If n >= 0, this returns the Catalan number for index n:
|
||||
|
||||
catalan(n) = comb(2*n,n)/(n + 1)
|
||||
catalan(n) = comb(2*n,n)/(n + 1)
|
||||
|
||||
Zero is returned for negative n.
|
||||
|
||||
@@ -45,7 +45,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -53,7 +53,7 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 2000/12/14 01:33:00
|
||||
## File existed as early as: 2000
|
||||
## Under source code control: 2000/12/14 01:33:00
|
||||
## File existed as early as: 2000
|
||||
##
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
14
help/ceil
14
help/ceil
@@ -5,9 +5,9 @@ SYNOPSIS
|
||||
ceil(x)
|
||||
|
||||
TYPES
|
||||
x real, complex, list, matrix
|
||||
x real, complex, list, matrix
|
||||
|
||||
return real or complex, list, matrix
|
||||
return real or complex, list, matrix
|
||||
|
||||
DESCRIPTION
|
||||
For real x, ceil(x) is the least integer not less than x.
|
||||
@@ -40,7 +40,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -48,8 +48,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1994/09/30 01:12:01
|
||||
## File existed as early as: 1994
|
||||
## Under source code control: 1994/09/30 01:12:01
|
||||
## File existed as early as: 1994
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
40
help/cfappr
40
help/cfappr
@@ -5,12 +5,12 @@ SYNOPSIS
|
||||
cfappr(x [,eps [,rnd]]) or cfappr(x, n [,rnd])
|
||||
|
||||
TYPES
|
||||
x real
|
||||
eps real with abs(eps) < 1, defaults to epsilon()
|
||||
n real with n >= 1
|
||||
rnd integer, defaults to config("cfappr")
|
||||
x real
|
||||
eps real with abs(eps) < 1, defaults to epsilon()
|
||||
n real with n >= 1
|
||||
rnd integer, defaults to config("cfappr")
|
||||
|
||||
return real
|
||||
return real
|
||||
|
||||
DESCRIPTION
|
||||
If x is an integer or eps is zero, either form returns x.
|
||||
@@ -21,23 +21,23 @@ DESCRIPTION
|
||||
|
||||
If n >= 1 and den(x) > n, cfappr(x, n) returns the nearest above,
|
||||
nearest below, or nearest, approximation to x with denominator less
|
||||
than or equal to n. If den(x) <= n, cfappr(x,n) returns x.
|
||||
than or equal to n. If den(x) <= n, cfappr(x,n) returns x.
|
||||
|
||||
In either case when the result v is not x, how v relates to x is
|
||||
determined by bits 0, 1, 2 and 4 of the argument rnd in the same way as
|
||||
these bits are used in the functions round() and appr(). In the
|
||||
following y is either eps or n.
|
||||
|
||||
rnd sign of remainder x - v
|
||||
rnd sign of remainder x - v
|
||||
|
||||
0 sgn(y)
|
||||
1 -sgn(y
|
||||
2 sgn(x), "rounding to zero"
|
||||
3 -sgn(x), "rounding from zero"
|
||||
4 +, "rounding down"
|
||||
5 -, "rounding up"
|
||||
6 sgn(x/y)
|
||||
7 -sgn(x/y)
|
||||
0 sgn(y)
|
||||
1 -sgn(y
|
||||
2 sgn(x), "rounding to zero"
|
||||
3 -sgn(x), "rounding from zero"
|
||||
4 +, "rounding down"
|
||||
5 -, "rounding up"
|
||||
6 sgn(x/y)
|
||||
7 -sgn(x/y)
|
||||
|
||||
If bit 4 of rnd is set, the other bits are irrelevant for the eps case;
|
||||
thus for 16 <= rnd < 24, cfappr(x, eps, rnd) is the smallest-denominator
|
||||
@@ -96,7 +96,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -104,8 +104,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1994/09/30 01:23:59
|
||||
## File existed as early as: 1994
|
||||
## Under source code control: 1994/09/30 01:23:59
|
||||
## File existed as early as: 1994
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
44
help/cfsim
44
help/cfsim
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
cfsim(x [,rnd])
|
||||
|
||||
TYPES
|
||||
x real
|
||||
rnd integer, defaults to config("cfsim")
|
||||
x real
|
||||
rnd integer, defaults to config("cfsim")
|
||||
|
||||
return real
|
||||
return real
|
||||
|
||||
DESCRIPTION
|
||||
If x is not an integer, cfsim(x, rnd) returns either the nearest
|
||||
@@ -20,23 +20,23 @@ DESCRIPTION
|
||||
For 0 <= rnd < 4, the sign of the remainder x - cfsim(x, rnd) is
|
||||
as follows:
|
||||
|
||||
rnd sign of x - cfsim(x, rnd)
|
||||
rnd sign of x - cfsim(x, rnd)
|
||||
|
||||
0 +, as if rounding down
|
||||
1 -. as if rounding up
|
||||
2 sgn(x), as if rounding to zero
|
||||
3 -sgn(x), as if rounding from zero
|
||||
0 +, as if rounding down
|
||||
1 -. as if rounding up
|
||||
2 sgn(x), as if rounding to zero
|
||||
3 -sgn(x), as if rounding from zero
|
||||
|
||||
This corresponds to the use of rnd for functions like round(x, n, rnd).
|
||||
|
||||
If bit 3 or 4 of rnd is set, the lower order bits are ignored; bit 3
|
||||
is ignored if bit 4 is set. Thus, for rnd > 3, it sufficient to
|
||||
is ignored if bit 4 is set. Thus, for rnd > 3, it sufficient to
|
||||
consider the two cases rnd = 8 and rnd = 16.
|
||||
|
||||
If den(x) > 2, cfsim(x, 8) returns the value of the penultimate simple
|
||||
continued-fraction approximate to x, i.e. if:
|
||||
|
||||
x = a_0 + 1/(a_1 + 1/(a_2 + ... + 1/a_n) ...)),
|
||||
x = a_0 + 1/(a_1 + 1/(a_2 + ... + 1/a_n) ...)),
|
||||
|
||||
where a_0 is an integer, a_1, ..., a_n are positive integers,
|
||||
and a_n >= 2, the value returned is that of the continued fraction
|
||||
@@ -53,10 +53,10 @@ DESCRIPTION
|
||||
|
||||
In summary, for cfsim(x, rnd) when rnd = 8 or 16, the results are:
|
||||
|
||||
rnd integer x half-integer x den(x) > 2
|
||||
rnd integer x half-integer x den(x) > 2
|
||||
|
||||
8 0 x - sgn(x)/2 approximate
|
||||
16 x - sgn(x) x + sgn(x)/2 nearest
|
||||
8 0 x - sgn(x)/2 approximate
|
||||
16 x - sgn(x) x + sgn(x)/2 nearest
|
||||
|
||||
From either cfsim(x, 0) and cfsim(x, 1), the other is easily
|
||||
determined: if one of them has value w, the other has value
|
||||
@@ -72,7 +72,7 @@ DESCRIPTION
|
||||
Iteration of cfsim(x,8) until an integer is obtained gives a sequence of
|
||||
"good" approximations to x with decreasing denominators and
|
||||
correspondingly decreasing accuracy; each denominator is less than half
|
||||
the preceding denominator. (Unlike the "forward" sequence of
|
||||
the preceding denominator. (Unlike the "forward" sequence of
|
||||
continued-fraction approximates these are not necessarily alternately
|
||||
greater than and less than x.)
|
||||
|
||||
@@ -80,19 +80,19 @@ DESCRIPTION
|
||||
|
||||
For rnd = 0 or 1 and any x, or rnd = 8 or 16 and x with den(x) > 2:
|
||||
|
||||
cfsim(n + x, rnd) = n + cfsim(x, rnd).
|
||||
cfsim(n + x, rnd) = n + cfsim(x, rnd).
|
||||
|
||||
This equation also holds for the other values of rnd if n + x and x
|
||||
have the same sign.
|
||||
|
||||
For rnd = 2, 3, 8 or 16, and any x:
|
||||
|
||||
cfsim(-x, rnd) = -cfsim(x, rnd).
|
||||
cfsim(-x, rnd) = -cfsim(x, rnd).
|
||||
|
||||
If rnd = 8 or 16, except for integer x or 1/x for rnd = 8, and
|
||||
zero x for rnd = 16:
|
||||
|
||||
cfsim(1/x, rnd) = 1/cfsim(x, rnd).
|
||||
cfsim(1/x, rnd) = 1/cfsim(x, rnd).
|
||||
|
||||
EXAMPLE
|
||||
; c = config("mode", "frac");
|
||||
@@ -121,7 +121,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -129,8 +129,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1994/09/30 01:29:45
|
||||
## File existed as early as: 1994
|
||||
## Under source code control: 1994/09/30 01:29:45
|
||||
## File existed as early as: 1994
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
14
help/char
14
help/char
@@ -5,9 +5,9 @@ SYNOPSIS
|
||||
char(j)
|
||||
|
||||
TYPES
|
||||
j integer, 0 <= j < 256
|
||||
j integer, 0 <= j < 256
|
||||
|
||||
return string
|
||||
return string
|
||||
|
||||
DESCRIPTION
|
||||
For j > 0, returns a string of length 1 with a character that has
|
||||
@@ -34,7 +34,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -42,8 +42,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1994/09/30 01:45:45
|
||||
## File existed as early as: 1994
|
||||
## Under source code control: 1994/09/30 01:45:45
|
||||
## File existed as early as: 1994
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
36
help/cis
36
help/cis
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
cis(x [,eps])
|
||||
|
||||
TYPES
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
|
||||
return number
|
||||
return number
|
||||
|
||||
DESCRIPTION
|
||||
Calculate the Euler's formula value of x to a multiple of eps with error less in
|
||||
@@ -16,8 +16,8 @@ DESCRIPTION
|
||||
|
||||
This function is sometimes called cosine and sine, is equivalent to:
|
||||
|
||||
cis(x) = cos(x) + 1i*sin(x)
|
||||
cis(x) = exp(1i * x)
|
||||
cis(x) = cos(x) + 1i*sin(x)
|
||||
cis(x) = exp(1i * x)
|
||||
|
||||
EXAMPLE
|
||||
; print cis(1/2), cis(5/7)
|
||||
@@ -60,14 +60,14 @@ SEE ALSO
|
||||
EXTERNAL RESOURCES
|
||||
For general information on trigonometric functions, see:
|
||||
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
|
||||
## Copyright (C) 2023 Landon Curt Noll
|
||||
##
|
||||
@@ -77,7 +77,7 @@ EXTERNAL RESOURCES
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -85,8 +85,8 @@ EXTERNAL RESOURCES
|
||||
## 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/10/02 23:11:18
|
||||
## File existed as early as: 2023
|
||||
## Under source code control: 2023/10/02 23:11:18
|
||||
## 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/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
12
help/cmdbuf
12
help/cmdbuf
@@ -5,7 +5,7 @@ SYNOPSIS
|
||||
cmdbuf()
|
||||
|
||||
TYPES
|
||||
return str
|
||||
return str
|
||||
|
||||
DESCRIPTION
|
||||
This function returns the command string that was formed by calc based
|
||||
@@ -37,7 +37,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -45,8 +45,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1995/07/09 04:05:58
|
||||
## File existed as early as: 1995
|
||||
## Under source code control: 1995/07/09 04:05:58
|
||||
## File existed as early as: 1995
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
96
help/cmp
96
help/cmp
@@ -12,79 +12,79 @@ TYPES
|
||||
|
||||
For non-object x and y:
|
||||
|
||||
x any
|
||||
y any
|
||||
x any
|
||||
y any
|
||||
|
||||
return if x and y are both real: -1, 0, or 1
|
||||
if x and y are both numbers but not both real:
|
||||
-1, 0, 1, -1+1i, 1i, 1+1i, -1-1i, -1i, or 1-1i
|
||||
if x and y are both strings: -1, 0, or 1
|
||||
all other cases: the null value
|
||||
return if x and y are both real: -1, 0, or 1
|
||||
if x and y are both numbers but not both real:
|
||||
-1, 0, 1, -1+1i, 1i, 1+1i, -1-1i, -1i, or 1-1i
|
||||
if x and y are both strings: -1, 0, or 1
|
||||
all other cases: the null value
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
x and y both real: cmp(x, y) = sgn(x - y), i.e. -1, 0, or 1
|
||||
according as x < y, x == y, or x > y
|
||||
according as x < y, x == y, or x > y
|
||||
|
||||
x and y both numbers, at least one being complex:
|
||||
cmp(x,y) = sgn(re(x) - re(y)) + sgn(im(x) - im(y)) * 1i
|
||||
cmp(x,y) = sgn(re(x) - re(y)) + sgn(im(x) - im(y)) * 1i
|
||||
|
||||
x and y both strings: successive characters are compared until either
|
||||
different characters are encountered or at least one string is
|
||||
completed. If the comparison ends because of different characters,
|
||||
cmp(x,y) = 1 or -1 according as the greater character is in x or y.
|
||||
If all characters compared in both strings are equal, then
|
||||
cmp(x,y) = -1, 0 or 1 according as the length of x is less than,
|
||||
equal to, or greater than the length of y. (This comparison
|
||||
is performed via the strcmp() libc function.)
|
||||
different characters are encountered or at least one string is
|
||||
completed. If the comparison ends because of different characters,
|
||||
cmp(x,y) = 1 or -1 according as the greater character is in x or y.
|
||||
If all characters compared in both strings are equal, then
|
||||
cmp(x,y) = -1, 0 or 1 according as the length of x is less than,
|
||||
equal to, or greater than the length of y. (This comparison
|
||||
is performed via the strcmp() libc function.)
|
||||
|
||||
objects: comparisons of objects are usually intended for some total or
|
||||
partial ordering and appropriate definitions of cmp(a,b) may
|
||||
make use of comparison of numerical or string components.
|
||||
definitions using comparison of numbers or strings are usually
|
||||
appropriate. For example, after
|
||||
partial ordering and appropriate definitions of cmp(a,b) may
|
||||
make use of comparison of numerical or string components.
|
||||
definitions using comparison of numbers or strings are usually
|
||||
appropriate. For example, after
|
||||
|
||||
obj point {x,y};
|
||||
obj point {x,y};
|
||||
|
||||
if points with real components are to be partially ordered by their
|
||||
Euclidean distance from the origin, an appropriate point_rel
|
||||
function may be that given by
|
||||
if points with real components are to be partially ordered by their
|
||||
Euclidean distance from the origin, an appropriate point_rel
|
||||
function may be that given by
|
||||
|
||||
define point_rel(a,b) = sgn(a.x^2 + a.y^2 - b.x^2 - b.y^2);
|
||||
define point_rel(a,b) = sgn(a.x^2 + a.y^2 - b.x^2 - b.y^2);
|
||||
|
||||
A total "lexicographic" ordering is that given by:
|
||||
A total "lexicographic" ordering is that given by:
|
||||
|
||||
define point_rel(a,b) {
|
||||
if (a.y != b.y)
|
||||
return sgn(a.y - b.y);
|
||||
return (a.x - b.x);
|
||||
}
|
||||
define point_rel(a,b) {
|
||||
if (a.y != b.y)
|
||||
return sgn(a.y - b.y);
|
||||
return (a.x - b.x);
|
||||
}
|
||||
|
||||
A comparison function that compares points analogously to
|
||||
cmp(a,b) for real and complex numbers is that given by
|
||||
A comparison function that compares points analogously to
|
||||
cmp(a,b) for real and complex numbers is that given by
|
||||
|
||||
define point_rel(P1, P2) {
|
||||
return obj point = {sgn(P1.x-P2.x), sgn(P1.y-P2.y)};
|
||||
}
|
||||
define point_rel(P1, P2) {
|
||||
return obj point = {sgn(P1.x-P2.x), sgn(P1.y-P2.y)};
|
||||
}
|
||||
|
||||
The range of this function is the set of nine points with zero
|
||||
or unit components.
|
||||
The range of this function is the set of nine points with zero
|
||||
or unit components.
|
||||
|
||||
|
||||
Some properties of cmp(a,b) for real or complex a and b are:
|
||||
|
||||
cmp(a + c, b + c) = cmp(a, b)
|
||||
cmp(a + c, b + c) = cmp(a, b)
|
||||
|
||||
cmp(a, b) == 0 if and only if a == b
|
||||
cmp(a, b) == 0 if and only if a == b
|
||||
|
||||
cmp(b, a) = -cmp(a, b)
|
||||
cmp(b, a) = -cmp(a, b)
|
||||
|
||||
if c is real or pure imaginary, cmp(c * a, c * b) = c * cmp(a,b)
|
||||
if c is real or pure imaginary, cmp(c * a, c * b) = c * cmp(a,b)
|
||||
|
||||
Then a function that defines "b is between a and c" in an often useful
|
||||
sense is
|
||||
|
||||
define between(a,b,c) = (cmp(a,b) == cmp(b,c)).
|
||||
define between(a,b,c) = (cmp(a,b) == cmp(b,c)).
|
||||
|
||||
For example, in this sense, 3 + 4i is between 1 + 5i and 4 + 2i.
|
||||
|
||||
@@ -122,7 +122,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -130,8 +130,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1994/10/20 02:52:30
|
||||
## File existed as early as: 1994
|
||||
## Under source code control: 1994/10/20 02:52:30
|
||||
## File existed as early as: 1994
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
22
help/comb
22
help/comb
@@ -5,17 +5,17 @@ SYNOPSIS
|
||||
comb(x, y)
|
||||
|
||||
TYPES
|
||||
x integer
|
||||
y integer
|
||||
x integer
|
||||
y integer
|
||||
|
||||
return integer
|
||||
return integer
|
||||
|
||||
DESCRIPTION
|
||||
Return the combinatorial number C(x,y) which is defined as:
|
||||
|
||||
x!
|
||||
---------
|
||||
y!*(x-y)!
|
||||
x!
|
||||
---------
|
||||
y!*(x-y)!
|
||||
|
||||
This function computes the number of combinations in which y things
|
||||
may be chosen from x items ignoring the order in which they are chosen.
|
||||
@@ -46,7 +46,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -54,8 +54,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1994/10/20 04:03:02
|
||||
## File existed as early as: 1994
|
||||
## Under source code control: 1994/10/20 04:03:02
|
||||
## File existed as early as: 1994
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
420
help/command
420
help/command
@@ -3,7 +3,7 @@ Command sequence
|
||||
This is a sequence of any the following command formats, where
|
||||
each command is terminated by a semicolon or newline. Long command
|
||||
lines can be extended by using a back-slash followed by a newline
|
||||
character. When this is done, the prompt shows a double angle
|
||||
character. When this is done, the prompt shows a double angle
|
||||
bracket to indicate that the line is still in progress. Certain
|
||||
cases will automatically prompt for more input in a similar manner,
|
||||
even without the back-slash. The most common case for this is when
|
||||
@@ -19,26 +19,26 @@ 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.
|
||||
This first form defines a full function which can consist
|
||||
of declarations followed by many statements which implement
|
||||
the function.
|
||||
|
||||
The second form defines a simple function which calculates
|
||||
the specified expression value from the specified parameters.
|
||||
The expression cannot be a statement. However, the comma
|
||||
and question mark operators can be useful. Examples of
|
||||
simple functions are:
|
||||
The second form defines a simple function which calculates
|
||||
the specified expression value from the specified parameters.
|
||||
The expression cannot be a statement. However, the comma
|
||||
and question mark operators can be useful. Examples of
|
||||
simple functions are:
|
||||
|
||||
define sumcubes(a, b) = a^3 + b^3
|
||||
define pimod(a) = a % pi()
|
||||
define printnum(a, n, p)
|
||||
{
|
||||
if (p == 0) {
|
||||
print a: "^": n, "=", a^n;
|
||||
} else {
|
||||
print a: "^": n, "mod", p, "=", pmod(a,n,p);
|
||||
}
|
||||
}
|
||||
define sumcubes(a, b) = a^3 + b^3
|
||||
define pimod(a) = a % pi()
|
||||
define printnum(a, n, p)
|
||||
{
|
||||
if (p == 0) {
|
||||
print a: "^": n, "=", a^n;
|
||||
} else {
|
||||
print a: "^": n, "mod", p, "=", pmod(a,n,p);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
read calc commands
|
||||
@@ -48,70 +48,70 @@ Command sequence
|
||||
read filename
|
||||
read -once filename
|
||||
|
||||
This reads definitions from the specified calc resource filename.
|
||||
This reads definitions from the specified calc resource filename.
|
||||
|
||||
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.
|
||||
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":
|
||||
The following is equivalent to read lucas.cal or read "lucas.cal":
|
||||
|
||||
global var = "lucas.cal";
|
||||
read $var;
|
||||
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.
|
||||
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 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
|
||||
searched for. The contents of the filename are command
|
||||
sequences which can consist of expressions to evaluate or
|
||||
functions to define, just like at the top level command level.
|
||||
The ".cal" extension is defaulted for input files, so that
|
||||
if "filename" is not found, then "filename.cal" is then
|
||||
searched for. The contents of the filename are command
|
||||
sequences which can consist of expressions to evaluate or
|
||||
functions to define, just like at the top level command level.
|
||||
|
||||
When -once is given, the read command acts like the regular
|
||||
read expect that it will ignore filename if is has been
|
||||
previously read.
|
||||
When -once is given, the read command acts like the regular
|
||||
read expect that it will ignore filename if is has been
|
||||
previously read.
|
||||
|
||||
The read -once form is particularly useful in a resource
|
||||
file that needs to read a 2nd resource file. By using the
|
||||
READ -once command, one will not reread that 2nd resource
|
||||
file, nor will once risk entering into a infinite READ loop
|
||||
(where that 2nd resource file directly or indirectly does
|
||||
a READ of the first resource file).
|
||||
The read -once form is particularly useful in a resource
|
||||
file that needs to read a 2nd resource file. By using the
|
||||
READ -once command, one will not reread that 2nd resource
|
||||
file, nor will once risk entering into a infinite READ loop
|
||||
(where that 2nd resource file directly or indirectly does
|
||||
a READ of the first resource file).
|
||||
|
||||
If the -m mode disallows opening of files for reading,
|
||||
this command will be disabled.
|
||||
If the -m mode disallows opening of files for reading,
|
||||
this command will be disabled.
|
||||
|
||||
To read a calc resource file without printing various
|
||||
messages about defined functions, the "resource_debug"
|
||||
config should be set to zero. For example:
|
||||
To read a calc resource file without printing various
|
||||
messages about defined functions, the "resource_debug"
|
||||
config should be set to zero. For example:
|
||||
|
||||
read lucas;
|
||||
read lucas;
|
||||
|
||||
will, by default, print messages such as:
|
||||
will, by default, print messages such as:
|
||||
|
||||
lucas(h,n) defined
|
||||
gen_u2(h,n,v1) defined
|
||||
gen_u0(h,n,v1) defined
|
||||
rodseth_xhn(x,h,n) defined
|
||||
gen_v1(h,n) defined
|
||||
ldebug(funct,str) defined
|
||||
legacy_gen_v1(h,n) defined
|
||||
lucas(h,n) defined
|
||||
gen_u2(h,n,v1) defined
|
||||
gen_u0(h,n,v1) defined
|
||||
rodseth_xhn(x,h,n) defined
|
||||
gen_v1(h,n) defined
|
||||
ldebug(funct,str) defined
|
||||
legacy_gen_v1(h,n) defined
|
||||
|
||||
When "resource_debug" is zero, such messages are silenced.
|
||||
|
||||
config("resource_debug", 0),;
|
||||
read lucas;
|
||||
config("resource_debug", 0),;
|
||||
read lucas;
|
||||
|
||||
To silence such messages on the calc command line, try:
|
||||
To silence such messages on the calc command line, try:
|
||||
|
||||
calc -p -D :0 'read -once lucas; lucas(1, 23209);'
|
||||
calc -p -D :0 'read -once lucas; lucas(1, 23209);'
|
||||
|
||||
|
||||
write calc commands
|
||||
@@ -119,29 +119,29 @@ Command sequence
|
||||
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.
|
||||
For speed reasons, values are written as hex fractions.
|
||||
This command currently only saves simple types, so that
|
||||
matrices, lists, and objects are not saved. Function
|
||||
definitions are also not saved.
|
||||
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.
|
||||
For speed reasons, values are written as hex fractions.
|
||||
This command currently only saves simple types, so that
|
||||
matrices, lists, and objects are not saved. Function
|
||||
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.
|
||||
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":
|
||||
The following is equivalent to write dump.out or
|
||||
write "dump.out":
|
||||
|
||||
global var = "dump.out";
|
||||
write $var;
|
||||
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.
|
||||
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.
|
||||
If the -m mode disallows opening of files for writing,
|
||||
this command will be disabled.
|
||||
|
||||
|
||||
quit or exit
|
||||
@@ -151,35 +151,35 @@ Command sequence
|
||||
exit
|
||||
exit string
|
||||
|
||||
The action of these commands depends on where they are used.
|
||||
At the interactive level, they will cause calc to exit.
|
||||
This is the normal way to leave the calculator. In any
|
||||
other use, they will stop the current calculation as if
|
||||
an error had occurred.
|
||||
The action of these commands depends on where they are used.
|
||||
At the interactive level, they will cause calc to exit.
|
||||
This is the normal way to leave the calculator. In any
|
||||
other use, they will stop the current calculation as if
|
||||
an error had occurred.
|
||||
|
||||
If a string is given, then the string is printed as the reason
|
||||
for quitting, otherwise a general quit message is printed.
|
||||
The routine name and line number which executed the quit is
|
||||
also printed in either case.
|
||||
If a string is given, then the string is printed as the reason
|
||||
for quitting, otherwise a general quit message is printed.
|
||||
The routine name and line number which executed the quit is
|
||||
also printed in either case.
|
||||
|
||||
Exit is an alias for quit.
|
||||
Exit is an alias for quit.
|
||||
|
||||
Quit is useful when a routine detects invalid arguments,
|
||||
in order to stop a calculation cleanly. For example,
|
||||
for a square root routine, an error can be given if the
|
||||
supplied parameter was a negative number, as in:
|
||||
Quit is useful when a routine detects invalid arguments,
|
||||
in order to stop a calculation cleanly. For example,
|
||||
for a square root routine, an error can be given if the
|
||||
supplied parameter was a negative number, as in:
|
||||
|
||||
define mysqrt(n)
|
||||
{
|
||||
if (! isnum(n))
|
||||
quit "non-numeric argument";
|
||||
if (n < 0)
|
||||
quit "Negative argument";
|
||||
return sqrt(n);
|
||||
}
|
||||
define mysqrt(n)
|
||||
{
|
||||
if (! isnum(n))
|
||||
quit "non-numeric argument";
|
||||
if (n < 0)
|
||||
quit "Negative argument";
|
||||
return sqrt(n);
|
||||
}
|
||||
|
||||
See 'more information about abort and quit' below for
|
||||
more information.
|
||||
See 'more information about abort and quit' below for
|
||||
more information.
|
||||
|
||||
|
||||
abort
|
||||
@@ -187,12 +187,12 @@ 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.
|
||||
This command behaves like QUIT except that it will attempt
|
||||
to return to the interactive level if permitted, otherwise
|
||||
calc exit.
|
||||
|
||||
See 'more information about abort and quit' below for
|
||||
more information.
|
||||
See 'more information about abort and quit' below for
|
||||
more information.
|
||||
|
||||
|
||||
change current directory
|
||||
@@ -200,45 +200,45 @@ Command sequence
|
||||
cd
|
||||
cd dir
|
||||
|
||||
Change the current directory to 'dir'. If 'dir' is omitted,
|
||||
change the current directory to the home directory, if $HOME
|
||||
is set in the environment.
|
||||
Change the current directory to 'dir'. If 'dir' is omitted,
|
||||
change the current directory to the home directory, if $HOME
|
||||
is set in the environment.
|
||||
|
||||
|
||||
show information
|
||||
----------------
|
||||
show item
|
||||
|
||||
This command displays some information where 'item' is
|
||||
one of the following:
|
||||
This command displays some information where 'item' is
|
||||
one of the following:
|
||||
|
||||
blocks unfreed named blocks
|
||||
builtin built in functions
|
||||
config config parameters and values
|
||||
constants cache of numeric constants
|
||||
custom custom functions if calc -C was used
|
||||
errors new error-values created
|
||||
files open files, file position and sizes
|
||||
function user-defined functions
|
||||
globaltypes global variables
|
||||
objfunctions possible object functions
|
||||
objtypes defined objects
|
||||
opcodes internal opcodes for function `func'
|
||||
sizes size in octets of calc value types
|
||||
realglobals numeric global variables
|
||||
statics un-scoped static variables
|
||||
numbers calc number cache
|
||||
redcdata REDC data defined
|
||||
strings calc string cache
|
||||
literals calc literal cache
|
||||
blocks unfreed named blocks
|
||||
builtin built in functions
|
||||
config config parameters and values
|
||||
constants cache of numeric constants
|
||||
custom custom functions if calc -C was used
|
||||
errors new error-values created
|
||||
files open files, file position and sizes
|
||||
function user-defined functions
|
||||
globaltypes global variables
|
||||
objfunctions possible object functions
|
||||
objtypes defined objects
|
||||
opcodes internal opcodes for function `func'
|
||||
sizes size in octets of calc value types
|
||||
realglobals numeric global variables
|
||||
statics un-scoped static variables
|
||||
numbers calc number cache
|
||||
redcdata REDC data defined
|
||||
strings calc string cache
|
||||
literals calc literal cache
|
||||
|
||||
Only the first 4 characters of item are examined, so:
|
||||
Only the first 4 characters of item are examined, so:
|
||||
|
||||
show globals
|
||||
show global
|
||||
show glob
|
||||
show globals
|
||||
show global
|
||||
show glob
|
||||
|
||||
do the same thing.
|
||||
do the same thing.
|
||||
|
||||
|
||||
calc help
|
||||
@@ -246,20 +246,20 @@ Command sequence
|
||||
help $var
|
||||
help name
|
||||
|
||||
This displays a help related to 'name' or general
|
||||
help of none is given.
|
||||
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.
|
||||
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":
|
||||
The following is equivalent to help command or help "command":
|
||||
|
||||
global var = "command";
|
||||
help $var;
|
||||
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.
|
||||
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.
|
||||
|
||||
|
||||
=-=
|
||||
@@ -269,28 +269,28 @@ Command sequence
|
||||
|
||||
Consider the following calc file called myfile.cal:
|
||||
|
||||
print "start of myfile.cal";
|
||||
define q() {quit "quit from q()"; print "end of q()"}
|
||||
define a() {abort "abort from a()"}
|
||||
x = 3;
|
||||
{print "start #1"; if (x > 1) q()} print "after #1";
|
||||
{print "start #2"; if (x > 1) a()} print "after #2";
|
||||
{print "start #3"; if (x > 1) quit "quit from 3rd statement"}
|
||||
print "end of myfile.cal";
|
||||
print "start of myfile.cal";
|
||||
define q() {quit "quit from q()"; print "end of q()"}
|
||||
define a() {abort "abort from a()"}
|
||||
x = 3;
|
||||
{print "start #1"; if (x > 1) q()} print "after #1";
|
||||
{print "start #2"; if (x > 1) a()} print "after #2";
|
||||
{print "start #3"; if (x > 1) quit "quit from 3rd statement"}
|
||||
print "end of myfile.cal";
|
||||
|
||||
The command:
|
||||
|
||||
calc read myfile
|
||||
calc read myfile
|
||||
|
||||
will produce:
|
||||
|
||||
q() defined
|
||||
a() defined
|
||||
start statement #1
|
||||
quit from q()
|
||||
after statement #1
|
||||
start statement #2
|
||||
abort from a()
|
||||
q() defined
|
||||
a() defined
|
||||
start statement #1
|
||||
quit from q()
|
||||
after statement #1
|
||||
start statement #2
|
||||
abort from a()
|
||||
|
||||
The QUIT within the q() function prevented the ``end of q()''
|
||||
statement from being evaluated. This QUIT command caused
|
||||
@@ -303,38 +303,38 @@ Command sequence
|
||||
|
||||
The command:
|
||||
|
||||
calc -i read myfile
|
||||
calc -i read myfile
|
||||
|
||||
will produce:
|
||||
|
||||
q() defined
|
||||
a() defined
|
||||
start statement #1
|
||||
quit from q()
|
||||
after statement #1
|
||||
start statement #2
|
||||
abort from a()
|
||||
; <==== calc interactive prompt
|
||||
q() defined
|
||||
a() defined
|
||||
start statement #1
|
||||
quit from q()
|
||||
after statement #1
|
||||
start statement #2
|
||||
abort from a()
|
||||
; <==== calc interactive prompt
|
||||
|
||||
because the '-i' calc causes ABORT to drop into an
|
||||
interactive prompt. However typing a QUIT or ABORT
|
||||
interactive prompt. However typing a QUIT or ABORT
|
||||
at the interactive prompt level will always calc to exit,
|
||||
even when calc is invoked with '-i'.
|
||||
|
||||
Also observe that both of these commands:
|
||||
|
||||
cat myfile.cal | calc
|
||||
cat myfile.cal | calc -i
|
||||
cat myfile.cal | calc
|
||||
cat myfile.cal | calc -i
|
||||
|
||||
will produce:
|
||||
|
||||
q() defined
|
||||
a() defined
|
||||
start statement #1
|
||||
quit from q()
|
||||
after statement #1
|
||||
start statement #2
|
||||
abort from a()
|
||||
q() defined
|
||||
a() defined
|
||||
start statement #1
|
||||
quit from q()
|
||||
after statement #1
|
||||
start statement #2
|
||||
abort from a()
|
||||
|
||||
The ABORT inside function a() halts the processing of statements
|
||||
from the input source (standard input). Because standard input
|
||||
@@ -344,23 +344,23 @@ Command sequence
|
||||
If one were to type in the contents of myfile.cal interactively,
|
||||
calc will produce:
|
||||
|
||||
; print "start of myfile.cal";
|
||||
start of myfile.cal
|
||||
; define q() {quit "quit from q()"; print "end of q()"}
|
||||
q() defined
|
||||
; define a() {abort "abort from a()"}
|
||||
a() defined
|
||||
; x = 3;
|
||||
; {print "start #1"; if (x > 1) q()} print "after #1";
|
||||
start statement #1
|
||||
quit from q()
|
||||
after statement #1
|
||||
; {print "start #2"; if (x > 1) a()} print "after #2";
|
||||
start statement #2
|
||||
abort from a()
|
||||
; {print "start #3"; if (x > 1) quit "quit from 3rd statement"}
|
||||
start #3
|
||||
quit from 3rd statement
|
||||
; print "start of myfile.cal";
|
||||
start of myfile.cal
|
||||
; define q() {quit "quit from q()"; print "end of q()"}
|
||||
q() defined
|
||||
; define a() {abort "abort from a()"}
|
||||
a() defined
|
||||
; x = 3;
|
||||
; {print "start #1"; if (x > 1) q()} print "after #1";
|
||||
start statement #1
|
||||
quit from q()
|
||||
after statement #1
|
||||
; {print "start #2"; if (x > 1) a()} print "after #2";
|
||||
start statement #2
|
||||
abort from a()
|
||||
; {print "start #3"; if (x > 1) quit "quit from 3rd statement"}
|
||||
start #3
|
||||
quit from 3rd statement
|
||||
|
||||
The ABORT from within the a() function returned control to
|
||||
the interactive level.
|
||||
@@ -372,8 +372,8 @@ Command sequence
|
||||
|
||||
Also see the help topic:
|
||||
|
||||
statement flow control and declaration statements
|
||||
usage how to invoke the calc command and calc -options
|
||||
statement flow control and declaration statements
|
||||
usage how to invoke the calc command and calc -options
|
||||
|
||||
## Copyright (C) 1999-2006,2018,2021 Landon Curt Noll
|
||||
##
|
||||
@@ -383,7 +383,7 @@ Command sequence
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -391,8 +391,8 @@ Command sequence
|
||||
## 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: 1991/07/21 04:37:17
|
||||
## File existed as early as: 1991
|
||||
## Under source code control: 1991/07/21 04:37:17
|
||||
## File existed as early as: 1991
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
648
help/config
648
help/config
File diff suppressed because it is too large
Load Diff
14
help/conj
14
help/conj
@@ -9,9 +9,9 @@ TYPES
|
||||
|
||||
For non-object x:
|
||||
|
||||
x real, complex, or matrix
|
||||
x real, complex, or matrix
|
||||
|
||||
return real, complex, or matrix
|
||||
return real, complex, or matrix
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
@@ -48,7 +48,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -56,8 +56,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1995/10/03 10:40:01
|
||||
## File existed as early as: 1995
|
||||
## Under source code control: 1995/10/03 10:40:01
|
||||
## File existed as early as: 1995
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
32
help/cos
32
help/cos
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
cos(x [,eps])
|
||||
|
||||
TYPES
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
|
||||
return number
|
||||
return number
|
||||
|
||||
DESCRIPTION
|
||||
Calculate the trigonometric cosine of x to a multiple of eps with error less in
|
||||
@@ -50,14 +50,14 @@ SEE ALSO
|
||||
EXTERNAL RESOURCES
|
||||
For general information on trigonometric functions, see:
|
||||
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
|
||||
## Copyright (C) 1999,2021,2023 Landon Curt Noll
|
||||
##
|
||||
@@ -67,7 +67,7 @@ EXTERNAL RESOURCES
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -75,8 +75,8 @@ EXTERNAL RESOURCES
|
||||
## 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: 1994/03/19 01:40:27
|
||||
## File existed as early as: 1994
|
||||
## Under source code control: 1994/03/19 01:40:27
|
||||
## File existed as early as: 1994
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
16
help/cosh
16
help/cosh
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
cosh(x [,eps])
|
||||
|
||||
TYPES
|
||||
x real
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
x real
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
|
||||
return real
|
||||
return real
|
||||
|
||||
DESCRIPTION
|
||||
Calculate the cosh of x to the nearest or next to nearest multiple of
|
||||
@@ -39,7 +39,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -47,8 +47,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1994/03/19 01:40:28
|
||||
## File existed as early as: 1994
|
||||
## Under source code control: 1994/03/19 01:40:28
|
||||
## File existed as early as: 1994
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
34
help/cot
34
help/cot
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
cot(x [,eps])
|
||||
|
||||
TYPES
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
|
||||
return real
|
||||
return real
|
||||
|
||||
DESCRIPTION
|
||||
Calculate the trigonometric cotangent of x to a multiple of eps, with error less
|
||||
@@ -16,7 +16,7 @@ DESCRIPTION
|
||||
|
||||
This function is equivalent to:
|
||||
|
||||
cot(x) = cos(x) / sin(x)
|
||||
cot(x) = cos(x) / sin(x)
|
||||
|
||||
EXAMPLE
|
||||
; print cot(1/2), cot(5/7), cot(42/7)
|
||||
@@ -56,14 +56,14 @@ SEE ALSO
|
||||
EXTERNAL RESOURCES
|
||||
For general information on trigonometric functions, see:
|
||||
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
|
||||
## Copyright (C) 1999,2021,2023 Landon Curt Noll
|
||||
##
|
||||
@@ -73,7 +73,7 @@ EXTERNAL RESOURCES
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -81,8 +81,8 @@ EXTERNAL RESOURCES
|
||||
## 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: 1995/11/13 03:49:00
|
||||
## File existed as early as: 1995
|
||||
## Under source code control: 1995/11/13 03:49:00
|
||||
## File existed as early as: 1995
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
16
help/coth
16
help/coth
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
coth(x [,eps])
|
||||
|
||||
TYPES
|
||||
x nonzero real
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
x nonzero real
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
|
||||
return real
|
||||
return real
|
||||
|
||||
DESCRIPTION
|
||||
Calculate the coth of x to a multiple of eps with error less in
|
||||
@@ -39,7 +39,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -47,8 +47,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1995/11/13 03:49:00
|
||||
## File existed as early as: 1995
|
||||
## Under source code control: 1995/11/13 03:49:00
|
||||
## File existed as early as: 1995
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
18
help/count
18
help/count
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
count(x, y)
|
||||
|
||||
TYPES
|
||||
x list or matrix
|
||||
y string
|
||||
x list or matrix
|
||||
y string
|
||||
|
||||
return integer
|
||||
return integer
|
||||
|
||||
DESCRIPTION
|
||||
For count(x, y), y is to be the name of a user-defined function;
|
||||
@@ -19,7 +19,7 @@ EXAMPLE
|
||||
; define f(a) = (a < 5)
|
||||
; A = list(1,2,7,6,4,8)
|
||||
; count(A, "f")
|
||||
3
|
||||
3
|
||||
|
||||
LIMITS
|
||||
none
|
||||
@@ -38,7 +38,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -46,8 +46,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1995/07/10 02:09:31
|
||||
## File existed as early as: 1995
|
||||
## Under source code control: 1995/07/10 02:09:31
|
||||
## File existed as early as: 1995
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
covercos(x [,eps])
|
||||
|
||||
TYPES
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
|
||||
return number
|
||||
return number
|
||||
|
||||
DESCRIPTION
|
||||
Calculate the coversed trigonometric cosine of x to a multiple of eps with error less in
|
||||
@@ -16,7 +16,7 @@ DESCRIPTION
|
||||
|
||||
This function is sometimes called cvc, or covercosine, is equivalent to:
|
||||
|
||||
covercos(x) = 1 + sin(x)
|
||||
covercos(x) = 1 + sin(x)
|
||||
|
||||
EXAMPLE
|
||||
; print covercos(1/2), covercos(5/7), covercos(42/7)
|
||||
@@ -54,14 +54,14 @@ SEE ALSO
|
||||
EXTERNAL RESOURCES
|
||||
For general information on trigonometric functions, see:
|
||||
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
|
||||
## Copyright (C) 2023 Landon Curt Noll
|
||||
##
|
||||
@@ -71,7 +71,7 @@ EXTERNAL RESOURCES
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -79,8 +79,8 @@ EXTERNAL RESOURCES
|
||||
## 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/05 23:31:08
|
||||
## File existed as early as: 2023
|
||||
## Under source code control: 2023/09/05 23:31: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/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
coversin(x [,eps])
|
||||
|
||||
TYPES
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
|
||||
return number
|
||||
return number
|
||||
|
||||
DESCRIPTION
|
||||
Calculate the coversed trigonometric sine of x to a multiple of eps with error less in
|
||||
@@ -16,7 +16,7 @@ DESCRIPTION
|
||||
|
||||
This function is sometimes called covers, or cvs, is equivalent to:
|
||||
|
||||
coversin(x) = 1 - sin(x)
|
||||
coversin(x) = 1 - sin(x)
|
||||
|
||||
EXAMPLE
|
||||
; print coversin(1/2), coversin(5/7), coversin(42/7)
|
||||
@@ -54,14 +54,14 @@ SEE ALSO
|
||||
EXTERNAL RESOURCES
|
||||
For general information on trigonometric functions, see:
|
||||
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
|
||||
## Copyright (C) 2023 Landon Curt Noll
|
||||
##
|
||||
@@ -71,7 +71,7 @@ EXTERNAL RESOURCES
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -79,8 +79,8 @@ EXTERNAL RESOURCES
|
||||
## 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
|
||||
## 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/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
16
help/cp
16
help/cp
@@ -5,16 +5,16 @@ SYNOPSIS
|
||||
cp(x, y)
|
||||
|
||||
TYPES
|
||||
x, y 1-dimensional matrices with 3 elements
|
||||
x, y 1-dimensional matrices with 3 elements
|
||||
|
||||
return 1-dimensional matrix with 3 elements
|
||||
return 1-dimensional matrix with 3 elements
|
||||
|
||||
DESCRIPTION
|
||||
Calculate the product of two 3 1-dimensional matrices.
|
||||
If x has elements (x0, x1, x2), and y has elements (y0, y1, y2),
|
||||
cp(x,y) returns the matrix of type [0:2] with elements:
|
||||
|
||||
{x1 * y2 - x2 * y1, x3 * y1 - x1 * y3, x1 * y2 - x2 * y1}
|
||||
{x1 * y2 - x2 * y1, x3 * y1 - x1 * y3, x1 * y2 - x2 * y1}
|
||||
|
||||
EXAMPLE
|
||||
; mat x[3] = {2,3,4}
|
||||
@@ -44,7 +44,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -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.
|
||||
##
|
||||
## Under source code control: 1995/10/05 04:52:26
|
||||
## File existed as early as: 1995
|
||||
## Under source code control: 1995/10/05 04:52:26
|
||||
## File existed as early as: 1995
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
34
help/crd
34
help/crd
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
crd(x [,eps])
|
||||
|
||||
TYPES
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
|
||||
return number
|
||||
return number
|
||||
|
||||
DESCRIPTION
|
||||
Calculate length of unit circle chord with angle x to a multiple of eps with error less in
|
||||
@@ -19,7 +19,7 @@ DESCRIPTION
|
||||
|
||||
This function is sometimes called chord, is equivalent to:
|
||||
|
||||
crd(x) = 2 * sin(x / 2)
|
||||
crd(x) = 2 * sin(x / 2)
|
||||
|
||||
EXAMPLE
|
||||
; print crd(1/2), crd(5/7), crd(42/7)
|
||||
@@ -57,14 +57,14 @@ SEE ALSO
|
||||
EXTERNAL RESOURCES
|
||||
For general information on trigonometric functions, see:
|
||||
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
|
||||
## Copyright (C) 2023 Landon Curt Noll
|
||||
##
|
||||
@@ -74,7 +74,7 @@ EXTERNAL RESOURCES
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -82,8 +82,8 @@ EXTERNAL RESOURCES
|
||||
## 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/10/02 16:49:42
|
||||
## File existed as early as: 2023
|
||||
## Under source code control: 2023/10/02 16:49:42
|
||||
## 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/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
54
help/credit
54
help/credit
@@ -15,7 +15,7 @@ Credits
|
||||
hist.c which is used to do the command line editing.
|
||||
|
||||
Thanks to Ernest W. Bowen for supplying many improvements in
|
||||
accuracy and generality for some numeric functions. Much of
|
||||
accuracy and generality for some numeric functions. Much of
|
||||
this was in terms of actual code which I gratefully accepted.
|
||||
Ernest also supplied the original text for many of the help files.
|
||||
|
||||
@@ -26,17 +26,17 @@ Credits
|
||||
|
||||
Most of this source and binary has one of the following copyrights:
|
||||
|
||||
Copyright (C) year David I. Bell
|
||||
Copyright (C) year David I. Bell and Landon Curt Noll
|
||||
Copyright (C) year David I. Bell and Ernest Bowen
|
||||
Copyright (C) year David I. Bell, Landon Curt Noll and Ernest Bowen
|
||||
Copyright (C) year Landon Curt Noll
|
||||
Copyright (C) year Ernest Bowen and Landon Curt Noll
|
||||
Copyright (C) year Ernest Bowen
|
||||
Copyright (C) year Petteri Kettunen and Landon Curt Noll
|
||||
Copyright (C) year Christoph Zurnieden
|
||||
Copyright (C) year Landon Curt Noll and Thomas Jones-Low
|
||||
Copyright (C) year Klaus Alexander Seistrup and Landon Curt Noll
|
||||
Copyright (C) year David I. Bell
|
||||
Copyright (C) year David I. Bell and Landon Curt Noll
|
||||
Copyright (C) year David I. Bell and Ernest Bowen
|
||||
Copyright (C) year David I. Bell, Landon Curt Noll and Ernest Bowen
|
||||
Copyright (C) year Landon Curt Noll
|
||||
Copyright (C) year Ernest Bowen and Landon Curt Noll
|
||||
Copyright (C) year Ernest Bowen
|
||||
Copyright (C) year Petteri Kettunen and Landon Curt Noll
|
||||
Copyright (C) year Christoph Zurnieden
|
||||
Copyright (C) year Landon Curt Noll and Thomas Jones-Low
|
||||
Copyright (C) year Klaus Alexander Seistrup and Landon Curt Noll
|
||||
|
||||
A few files in calc are covered under "The Unlicense". For more
|
||||
information on this license, see:
|
||||
@@ -50,8 +50,8 @@ Copying / Calc GNU Lesser General Public License
|
||||
Lesser General Public License. You are welcome to change it and/or
|
||||
distribute copies of it under certain conditions. The calc commands:
|
||||
|
||||
help copying
|
||||
help copying-lgpl
|
||||
help copying
|
||||
help copying-lgpl
|
||||
|
||||
should display the contents of the COPYING and COPYING-LGPL files.
|
||||
Those files contain information about the calc's GNU Lesser General
|
||||
@@ -62,17 +62,17 @@ Copying / Calc GNU Lesser General Public License
|
||||
Lesser General Public License. If you do not have these
|
||||
files, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
51 Franklin Street
|
||||
Fifth Floor
|
||||
Boston, MA 02110-1301
|
||||
USA
|
||||
Free Software Foundation, Inc.
|
||||
51 Franklin Street
|
||||
Fifth Floor
|
||||
Boston, MA 02110-1301
|
||||
USA
|
||||
|
||||
See also:
|
||||
|
||||
help copyright
|
||||
help copying
|
||||
help copying-lgpl
|
||||
help copyright
|
||||
help copying
|
||||
help copying-lgpl
|
||||
|
||||
## Copyright (C) 1999,2023 Landon Curt Noll
|
||||
##
|
||||
@@ -82,7 +82,7 @@ See also:
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -90,8 +90,8 @@ See also:
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1991/07/23 05:47:24
|
||||
## File existed as early as: 1991
|
||||
## Under source code control: 1991/07/23 05:47:24
|
||||
## File existed as early as: 1991
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
34
help/csc
34
help/csc
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
csc(x [,eps])
|
||||
|
||||
TYPES
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
|
||||
return real
|
||||
return real
|
||||
|
||||
DESCRIPTION
|
||||
Calculate the trigonometric cosecant of x to a multiple of eps, with error less
|
||||
@@ -16,7 +16,7 @@ DESCRIPTION
|
||||
|
||||
This function is equivalent to:
|
||||
|
||||
csc(x) = 1 / sin(x)
|
||||
csc(x) = 1 / sin(x)
|
||||
|
||||
EXAMPLE
|
||||
; print csc(1/2), csc(5/7), csc(42/7)
|
||||
@@ -56,14 +56,14 @@ SEE ALSO
|
||||
EXTERNAL RESOURCES
|
||||
For general information on trigonometric functions, see:
|
||||
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
https://en.wikipedia.org/wiki/Trigonometric_functions#Unit-circle_definitions
|
||||
https://en.wikipedia.org/wiki/Versine
|
||||
https://en.wikipedia.org/wiki/Exsecant
|
||||
https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
|
||||
https://en.wikipedia.org/wiki/Chord_(geometry)
|
||||
https://en.wikipedia.org/wiki/Secant_line
|
||||
https://en.wikipedia.org/wiki/Hartley_transform#cas
|
||||
https://en.wikipedia.org/wiki/Cis_(mathematics)
|
||||
|
||||
## Copyright (C) 1999,2023 Landon Curt Noll
|
||||
##
|
||||
@@ -73,7 +73,7 @@ EXTERNAL RESOURCES
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -81,8 +81,8 @@ EXTERNAL RESOURCES
|
||||
## 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: 1995/11/13 03:49:00
|
||||
## File existed as early as: 1995
|
||||
## Under source code control: 1995/11/13 03:49:00
|
||||
## File existed as early as: 1995
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
16
help/csch
16
help/csch
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
csch(x [,eps])
|
||||
|
||||
TYPES
|
||||
x nonzero real
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
x nonzero real
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
|
||||
return real
|
||||
return real
|
||||
|
||||
DESCRIPTION
|
||||
Calculate the csch of x to a multiple of epsilon, with error less in
|
||||
@@ -39,7 +39,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -47,8 +47,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1995/11/13 03:49:00
|
||||
## File existed as early as: 1995
|
||||
## Under source code control: 1995/11/13 03:49:00
|
||||
## File existed as early as: 1995
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
14
help/ctime
14
help/ctime
@@ -5,13 +5,13 @@ SYNOPSIS
|
||||
ctime()
|
||||
|
||||
TYPES
|
||||
return string
|
||||
return string
|
||||
|
||||
DESCRIPTION
|
||||
The ctime() builtin returns the string formed by the
|
||||
characters returned by the C library function, ctime(): E.g.
|
||||
|
||||
"Mon Oct 28 00:47:00 1996\n"
|
||||
"Mon Oct 28 00:47:00 1996\n"
|
||||
|
||||
EXAMPLE
|
||||
; ## NOTE: Your output will likely vary:
|
||||
@@ -37,7 +37,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -45,8 +45,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1996/04/30 03:05:18
|
||||
## File existed as early as: 1996
|
||||
## Under source code control: 1996/04/30 03:05:18
|
||||
## File existed as early as: 1996
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
42
help/custom
42
help/custom
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
custom([custname [, arg ...]])
|
||||
|
||||
TYPES
|
||||
custname string
|
||||
arg any
|
||||
custname string
|
||||
arg any
|
||||
|
||||
return any
|
||||
return any
|
||||
|
||||
DESCRIPTION
|
||||
This function will invoke the custom function interface. Custom
|
||||
@@ -19,16 +19,16 @@ DESCRIPTION
|
||||
|
||||
In order to use the custom interface, two things must happen:
|
||||
|
||||
1) Calc must be built to allow custom functions. By default,
|
||||
the master Makefile is shipped with ALLOW_CUSTOM= -DCUSTOM
|
||||
which causes custom functions to be compiled in.
|
||||
1) Calc must be built to allow custom functions. By default,
|
||||
the master Makefile is shipped with ALLOW_CUSTOM= -DCUSTOM
|
||||
which causes custom functions to be compiled in.
|
||||
|
||||
2) Calc must be invoked with an argument of -C as in:
|
||||
2) Calc must be invoked with an argument of -C as in:
|
||||
|
||||
calc -C
|
||||
calc -C
|
||||
|
||||
In other words, explicit action must be taken in order to
|
||||
enable the use of custom functions. By default (no -C arg)
|
||||
enable the use of custom functions. By default (no -C arg)
|
||||
custom functions are compiled in but disabled so that only
|
||||
portable calc scripts may be used.
|
||||
|
||||
@@ -36,7 +36,7 @@ DESCRIPTION
|
||||
multi-precision calculations in a C-like environment. You should
|
||||
consider implementing algorithms in the calc language as a first
|
||||
choice. Sometimes an algorithm requires use of special hardware, a
|
||||
non-portable OS or pre-compiled C library. In these cases a custom
|
||||
non-portable OS or pre-compiled C library. In these cases a custom
|
||||
interface may be needed.
|
||||
|
||||
The custom function interface is intended to make is easy for
|
||||
@@ -48,16 +48,16 @@ DESCRIPTION
|
||||
To add a new custom function requires access to calc source.
|
||||
For information on how to add a new custom function, try:
|
||||
|
||||
help new_custom
|
||||
help new_custom
|
||||
|
||||
To serve as examples, calc is shipped with a few custom functions.
|
||||
If calc if invoked with -C, then either of the following will
|
||||
display information about the custom functions that are available:
|
||||
|
||||
show custom
|
||||
show custom
|
||||
or:
|
||||
|
||||
custom()
|
||||
custom()
|
||||
|
||||
A few resource files that uses these function are also provided
|
||||
to serve as usage examples.
|
||||
@@ -65,20 +65,20 @@ DESCRIPTION
|
||||
We welcome submissions for new custom functions. For information
|
||||
on how to submit new custom functions for general distribution, see:
|
||||
|
||||
help contrib
|
||||
help contrib
|
||||
|
||||
EXAMPLE
|
||||
If calc compiled with ALLOW_CUSTOM="-UCUSTOM", the custom system
|
||||
is disabled, even when -C is used on the command line:
|
||||
|
||||
; print custom("sysinfo", "baseb")
|
||||
Calc was built with custom functions disabled
|
||||
Calc was built with custom functions disabled
|
||||
Error E_NO_C_ARG
|
||||
|
||||
If calc compiled with ALLOW_CUSTOM= -DCUSTOM and is invoked without -C:
|
||||
|
||||
; print custom("sysinfo", "baseb")
|
||||
Calc must be run with a -C argument to use custom function
|
||||
Calc must be run with a -C argument to use custom function
|
||||
Error E_NO_C_ARG
|
||||
|
||||
If calc compiled with ALLOW_CUSTOM= -DCUSTOM and is invoked with -C:
|
||||
@@ -103,7 +103,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -111,8 +111,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1997/03/09 16:33:22
|
||||
## File existed as early as: 1997
|
||||
## Under source code control: 1997/03/09 16:33:22
|
||||
## File existed as early as: 1997
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
32
help/d2dm
32
help/d2dm
@@ -5,12 +5,12 @@ SYNOPSIS
|
||||
d2dm(degs, d, m [,rnd])
|
||||
|
||||
TYPES
|
||||
degs real
|
||||
d null-or-real-valued lvalue with assign-to permission
|
||||
m null-or-real-valued lvalue with assign-to permission
|
||||
rnd nonnegative integer, defaults to config("mod")
|
||||
degs real
|
||||
d null-or-real-valued lvalue with assign-to permission
|
||||
m null-or-real-valued lvalue with assign-to permission
|
||||
rnd nonnegative integer, defaults to config("mod")
|
||||
|
||||
return mod(degs, 360, rnd)
|
||||
return mod(degs, 360, rnd)
|
||||
|
||||
DESCRIPTION
|
||||
Convert degs degrees into d degrees, and m minutes.
|
||||
@@ -18,7 +18,7 @@ DESCRIPTION
|
||||
The return value is a normalized number of degrees, and is equivalent
|
||||
to the following:
|
||||
|
||||
return_value = mod(degs, 360, rnd);
|
||||
return_value = mod(degs, 360, rnd);
|
||||
|
||||
The argument rnd, if not given, defaults to config("mod").
|
||||
For more information on the effects of rnd, see "help mod".
|
||||
@@ -31,7 +31,7 @@ DESCRIPTION
|
||||
|
||||
The value d will be set as if the following were used:
|
||||
|
||||
d = int(return_value);
|
||||
d = int(return_value);
|
||||
|
||||
For some rounding modes, d will be an integer in the interval [0, 360).
|
||||
For other rounding modes, d will be an integer in the interval (-360, 0].
|
||||
@@ -41,9 +41,9 @@ DESCRIPTION
|
||||
|
||||
The value m will be set as if the following were used:
|
||||
|
||||
tmp = return_value - d;
|
||||
m = tmp * 60;
|
||||
free(tmp);
|
||||
tmp = return_value - d;
|
||||
m = tmp * 60;
|
||||
free(tmp);
|
||||
|
||||
For some rounding modes, m will be a real value in the interval [0, 60).
|
||||
For other rounding modes, m will be a real value in the interval (-60, 0].
|
||||
@@ -52,7 +52,7 @@ DESCRIPTION
|
||||
The following shows relationship between the return value and the resulting
|
||||
d, and m values:
|
||||
|
||||
return_value == d + m/60;
|
||||
return_value == d + m/60;
|
||||
|
||||
EXAMPLE
|
||||
; ## if args are undefined, pre-declare them or assign them as args
|
||||
@@ -100,7 +100,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -108,8 +108,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 2021/09/25 17:24:51
|
||||
## File existed as early as: 2021
|
||||
## Under source code control: 2021/09/25 17:24:51
|
||||
## File existed as early as: 2021
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
44
help/d2dms
44
help/d2dms
@@ -5,13 +5,13 @@ SYNOPSIS
|
||||
d2dms(degs, d, m, s [,rnd])
|
||||
|
||||
TYPES
|
||||
degs real
|
||||
d null-or-real-valued lvalue with assign-to permission
|
||||
m null-or-real-valued lvalue with assign-to permission
|
||||
s null-or-real-valued lvalue with assign-to permission
|
||||
rnd nonnegative integer, defaults to config("mod")
|
||||
degs real
|
||||
d null-or-real-valued lvalue with assign-to permission
|
||||
m null-or-real-valued lvalue with assign-to permission
|
||||
s null-or-real-valued lvalue with assign-to permission
|
||||
rnd nonnegative integer, defaults to config("mod")
|
||||
|
||||
return mod(degs, 360, rnd)
|
||||
return mod(degs, 360, rnd)
|
||||
|
||||
DESCRIPTION
|
||||
Convert degs degrees into d degrees, m minutes, and s seconds.
|
||||
@@ -19,7 +19,7 @@ DESCRIPTION
|
||||
The return value is a normalized number of degrees, and is equivalent
|
||||
to the following:
|
||||
|
||||
return_value = mod(degs, 360, rnd);
|
||||
return_value = mod(degs, 360, rnd);
|
||||
|
||||
The argument rnd, if not given, defaults to config("mod").
|
||||
For more information on the effects of rnd, see "help mod".
|
||||
@@ -32,7 +32,7 @@ DESCRIPTION
|
||||
|
||||
The value d will be set as if the following were used:
|
||||
|
||||
d = int(return_value);
|
||||
d = int(return_value);
|
||||
|
||||
For some rounding modes, d will be an integer in the interval [0, 360).
|
||||
For other rounding modes, d will be an integer in the interval (-360, 0].
|
||||
@@ -42,10 +42,10 @@ DESCRIPTION
|
||||
|
||||
The value m will be set as if the following were used:
|
||||
|
||||
tmp = return_value - d;
|
||||
tmp_m = tmp * 60;
|
||||
free(tmp);
|
||||
m = int(tmp_m);
|
||||
tmp = return_value - d;
|
||||
tmp_m = tmp * 60;
|
||||
free(tmp);
|
||||
m = int(tmp_m);
|
||||
|
||||
For some rounding modes, m will be an integer in the interval [0, 60).
|
||||
For other rounding modes, m will be an integer in the interval (-60, 0].
|
||||
@@ -55,10 +55,10 @@ DESCRIPTION
|
||||
|
||||
The value s will be set as if the following were used:
|
||||
|
||||
tmp = tmp_m - m;
|
||||
free(tmp_m);
|
||||
s = tmp * 60;
|
||||
free(tmp);
|
||||
tmp = tmp_m - m;
|
||||
free(tmp_m);
|
||||
s = tmp * 60;
|
||||
free(tmp);
|
||||
|
||||
For some rounding modes, s will be a real value in the interval [0, 60).
|
||||
For other rounding modes, s will be a real value in the interval (-60, 0].
|
||||
@@ -67,7 +67,7 @@ DESCRIPTION
|
||||
The following shows relationship between the return value and the resulting
|
||||
d, m, and s values:
|
||||
|
||||
return_value == d + m/60 + s/3600;
|
||||
return_value == d + m/60 + s/3600;
|
||||
|
||||
EXAMPLE
|
||||
; ## if args are undefined, pre-declare them or assign them as args
|
||||
@@ -115,7 +115,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -123,8 +123,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 2021/09/25 17:24:51
|
||||
## File existed as early as: 2021
|
||||
## Under source code control: 2021/09/25 17:24:51
|
||||
## File existed as early as: 2021
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
16
help/d2g
16
help/d2g
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
d2g(x [,eps])
|
||||
|
||||
TYPES
|
||||
x number (real or complex)
|
||||
eps eps value is ignored
|
||||
x number (real or complex)
|
||||
eps eps value is ignored
|
||||
|
||||
return number
|
||||
return number
|
||||
|
||||
DESCRIPTION
|
||||
Given x degrees, return the equivalent number of gradians.
|
||||
@@ -40,7 +40,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -48,8 +48,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 2021/09/07 12:04:28
|
||||
## File existed as early as: 2021
|
||||
## Under source code control: 2021/09/07 12:04:28
|
||||
## File existed as early as: 2021
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
16
help/d2r
16
help/d2r
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
d2r(x [,eps])
|
||||
|
||||
TYPES
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
x number (real or complex)
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
|
||||
return number
|
||||
return number
|
||||
|
||||
DESCRIPTION
|
||||
Given x degrees, return the equivalent number of radians.
|
||||
@@ -44,7 +44,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -52,8 +52,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 2021/09/07 12:04:28
|
||||
## File existed as early as: 2021
|
||||
## Under source code control: 2021/09/07 12:04:28
|
||||
## File existed as early as: 2021
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
84
help/define
84
help/define
@@ -6,11 +6,11 @@ SYNTAX
|
||||
define fname([param_1 [= default_1], ...]) { [statement_1 ... ] }
|
||||
|
||||
TYPES
|
||||
fname identifier, not a builtin function name
|
||||
param_1, ... identifiers, no two the same
|
||||
default_1, ... expressions
|
||||
expr expression
|
||||
statement_1, ... statements
|
||||
fname identifier, not a builtin function name
|
||||
param_1, ... identifiers, no two the same
|
||||
default_1, ... expressions
|
||||
expr expression
|
||||
statement_1, ... statements
|
||||
|
||||
DESCRIPTION
|
||||
The intention of a function definition is that the identifier fname
|
||||
@@ -30,17 +30,17 @@ DESCRIPTION
|
||||
For example, suppose a function f and a global variable A have been
|
||||
defined by:
|
||||
|
||||
; define f(x) = (x = 3);
|
||||
; global mat A[3];
|
||||
; define f(x) = (x = 3);
|
||||
; global mat A[3];
|
||||
|
||||
If g() is a function that evaluates to 2:
|
||||
|
||||
; f(A[g()]);
|
||||
; f(A[g()]);
|
||||
|
||||
assigns the value of A[2] to the parameter x and then assigns the
|
||||
value 3 to x:
|
||||
|
||||
; f(`A[g()]);
|
||||
; f(`A[g()]);
|
||||
|
||||
has essentially the effect of assigning A[2] as an lvalue to x and
|
||||
then assigning the value 3 to A[2]. (Very old versions of calc
|
||||
@@ -79,7 +79,7 @@ DESCRIPTION
|
||||
|
||||
If the expr is omitted from an expression definition, as in:
|
||||
|
||||
; define h() = ;
|
||||
; define h() = ;
|
||||
|
||||
any call to the function will evaluate the arguments and return the
|
||||
null value.
|
||||
@@ -105,11 +105,11 @@ DESCRIPTION
|
||||
|
||||
After fname has been defined, the definition may be removed by the command:
|
||||
|
||||
; undefine fname
|
||||
; undefine fname
|
||||
|
||||
The definitions of all user-defined functions may be removed by:
|
||||
|
||||
; undefine *
|
||||
; undefine *
|
||||
|
||||
If bit 0 of config("resource_debug") is set and the define command is
|
||||
at interactive level, a message saying that fname has been defined
|
||||
@@ -120,8 +120,8 @@ DESCRIPTION
|
||||
The identifiers used for the parameters in a function definition do
|
||||
not form part of the completed definition. For example,
|
||||
|
||||
; define f(a,b) = a + b;
|
||||
; define g(alpha, beta) = alpha + beta;
|
||||
; define f(a,b) = a + b;
|
||||
; define g(alpha, beta) = alpha + beta;
|
||||
|
||||
result in identical code for the functions f, g.
|
||||
|
||||
@@ -129,22 +129,22 @@ DESCRIPTION
|
||||
function are displayed on completion of its definition, parameters
|
||||
being specified by names used in the definition. For example:
|
||||
|
||||
; config("trace", 8),
|
||||
; define f(a,b) = a + b
|
||||
0: PARAMADDR a
|
||||
2: PARAMADDR b
|
||||
4: ADD
|
||||
5: RETURN
|
||||
f(a,b) defined
|
||||
; config("trace", 8),
|
||||
; define f(a,b) = a + b
|
||||
0: PARAMADDR a
|
||||
2: PARAMADDR b
|
||||
4: ADD
|
||||
5: RETURN
|
||||
f(a,b) defined
|
||||
|
||||
The opcodes may also be displayed later using the show opcodes command;
|
||||
parameters will be specified by indices instead of by names. For example:
|
||||
|
||||
; show opco f
|
||||
0: PARAMADDR 0
|
||||
2: PARAMADDR 1
|
||||
4: ADD
|
||||
5: RETURN
|
||||
; show opco f
|
||||
0: PARAMADDR 0
|
||||
2: PARAMADDR 1
|
||||
4: ADD
|
||||
5: RETURN
|
||||
|
||||
When a function is defined by the statement mode, the opcodes normally
|
||||
include DEBUG opcodes which specify statement boundaries at which
|
||||
@@ -169,17 +169,17 @@ EXAMPLE
|
||||
; define f(a,b) = 2*a + b;
|
||||
; define g(alpha, beta)
|
||||
;; {
|
||||
;; local a, pi2;
|
||||
;; local a, pi2;
|
||||
;;
|
||||
;; pi2 = 2 * pi();
|
||||
;; a = sin(alpha % pi2);
|
||||
;; if (a > 0.0) {
|
||||
;; return a*beta;
|
||||
;; }
|
||||
;; if (beta > 0.0) {
|
||||
;; a *= cos(-beta % pi2);
|
||||
;; }
|
||||
;; return a;
|
||||
;; pi2 = 2 * pi();
|
||||
;; a = sin(alpha % pi2);
|
||||
;; if (a > 0.0) {
|
||||
;; return a*beta;
|
||||
;; }
|
||||
;; if (beta > 0.0) {
|
||||
;; a *= cos(-beta % pi2);
|
||||
;; }
|
||||
;; return a;
|
||||
;; }
|
||||
|
||||
LIMITS
|
||||
@@ -192,7 +192,7 @@ SEE ALSO
|
||||
param, variable, undefine, show
|
||||
|
||||
## Copyright (C) 2000-2006,2021 David I. Bell, Landon Curt Noll
|
||||
## and Ernest Bowen
|
||||
## and Ernest Bowen
|
||||
##
|
||||
## 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
|
||||
@@ -200,7 +200,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -209,8 +209,8 @@ SEE ALSO
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
##
|
||||
## Under source code control: 1991/07/21 04:37:18
|
||||
## File existed as early as: 1991
|
||||
## Under source code control: 1991/07/21 04:37:18
|
||||
## File existed as early as: 1991
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
18
help/delete
18
help/delete
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
delete(lst, index)
|
||||
|
||||
TYPES
|
||||
lst list
|
||||
index nonnegative integer less than the size of the list
|
||||
lst list
|
||||
index nonnegative integer less than the size of the list
|
||||
|
||||
return type of the deleted element
|
||||
return type of the deleted element
|
||||
|
||||
DESCRIPTION
|
||||
Deletes element at the specified index from list lst, and returns
|
||||
@@ -24,7 +24,7 @@ EXAMPLE
|
||||
[[3]] = 5
|
||||
|
||||
; delete(lst, 2)
|
||||
4
|
||||
4
|
||||
; print lst
|
||||
|
||||
list (3 elements, 3 nonzero):
|
||||
@@ -50,7 +50,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -58,8 +58,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1994/03/19 03:13:18
|
||||
## File existed as early as: 1994
|
||||
## Under source code control: 1994/03/19 03:13:18
|
||||
## File existed as early as: 1994
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
24
help/den
24
help/den
@@ -5,23 +5,23 @@ SYNOPSIS
|
||||
den(x)
|
||||
|
||||
TYPES
|
||||
x real
|
||||
x real
|
||||
|
||||
return integer
|
||||
return integer
|
||||
|
||||
DESCRIPTION
|
||||
For real x, den(x) returns the denominator of x when x is expressed
|
||||
in lowest terms with positive denominator. In calc,
|
||||
in lowest terms with positive denominator. In calc,
|
||||
real values are actually rational values. Each calc real
|
||||
value can be uniquely expressed as:
|
||||
|
||||
n / d
|
||||
n / d
|
||||
|
||||
where:
|
||||
|
||||
n and d are integers
|
||||
gcd(n,d) == 1
|
||||
d > 0
|
||||
n and d are integers
|
||||
gcd(n,d) == 1
|
||||
d > 0
|
||||
|
||||
The denominator for this n/d is d.
|
||||
|
||||
@@ -46,7 +46,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -54,8 +54,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1995/10/05 04:52:26
|
||||
## File existed as early as: 1995
|
||||
## Under source code control: 1995/10/05 04:52:26
|
||||
## File existed as early as: 1995
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
@@ -5,9 +5,9 @@ SYNOPSIS
|
||||
* X
|
||||
|
||||
TYPES
|
||||
X address or lvalue
|
||||
X address or lvalue
|
||||
|
||||
return any
|
||||
return any
|
||||
|
||||
DESCRIPTION
|
||||
When used as a binary operator, '*' performs multiplication. When
|
||||
@@ -33,17 +33,17 @@ DESCRIPTION
|
||||
structure rather than the structure identified by X. For example,
|
||||
suppose B has been created by
|
||||
|
||||
; mat B[3] = {1,2,3}
|
||||
; mat B[3] = {1,2,3}
|
||||
|
||||
then
|
||||
|
||||
; A = *B = {4,5,6}
|
||||
; A = *B = {4,5,6}
|
||||
|
||||
will assign the values 4,5,6 to the elements of a copy of B, which
|
||||
will then become the value of A, so that the values of A and B will
|
||||
be different. On the other hand,
|
||||
|
||||
; A = B = {4,5,6}
|
||||
; A = B = {4,5,6}
|
||||
|
||||
will result in A and B having the same value.
|
||||
|
||||
@@ -52,9 +52,9 @@ DESCRIPTION
|
||||
The * operator may be iterated with suitable sequences of pointer-valued
|
||||
lvalues. For example, after
|
||||
|
||||
; global a, b, c;
|
||||
; b = &a;
|
||||
; c = &b;
|
||||
; global a, b, c;
|
||||
; b = &a;
|
||||
; c = &b;
|
||||
|
||||
**c returns the lvalue a; ***c returns the value of a.
|
||||
|
||||
@@ -90,7 +90,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -98,8 +98,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1997/09/06 20:03:34
|
||||
## File existed as early as: 1997
|
||||
## Under source code control: 1997/09/06 20:03:34
|
||||
## File existed as early as: 1997
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
22
help/det
22
help/det
@@ -5,14 +5,14 @@ SYNOPSIS
|
||||
det(m)
|
||||
|
||||
TYPES
|
||||
m square matrix with elements of suitable type
|
||||
m square matrix with elements of suitable type
|
||||
|
||||
return zero or value of type determined by types of elements
|
||||
return zero or value of type determined by types of elements
|
||||
|
||||
DESCRIPTION
|
||||
The matrix m has to be square, i.e. of dimension 2 with:
|
||||
|
||||
matmax(m,1) - matmin(m,1) == matmax(m,2) - matmin(m,2).
|
||||
matmax(m,1) - matmin(m,1) == matmax(m,2) - matmin(m,2).
|
||||
|
||||
If the elements of m are numbers (real or complex), det(m)
|
||||
returns the value of the determinant of m.
|
||||
@@ -26,15 +26,15 @@ DESCRIPTION
|
||||
If m is a 2 x 2 matrix with elements a, b, c, d, where a tests as
|
||||
nonzero, det(m) is evaluated by
|
||||
|
||||
det(m) = (a * d) - (c * b).
|
||||
det(m) = (a * d) - (c * b).
|
||||
|
||||
If a tests as zero, det(m) = - ((c * b) - (a * d)) is used.
|
||||
|
||||
If m is 3 * 3 with elements a, b, c, d, e, f, g, h, i, where a and
|
||||
a * e - d * b test as nonzero, det(m) is evaluated by
|
||||
|
||||
det(m) = ((a * e - d * b) * (a * i - g * c)
|
||||
- (a * h - g * b) * (a * f - d * c))/a.
|
||||
det(m) = ((a * e - d * b) * (a * i - g * c)
|
||||
- (a * h - g * b) * (a * f - d * c))/a.
|
||||
|
||||
EXAMPLE
|
||||
; mat A[3,3] = {2, 3, 5, 7, 11, 13, 17, 19, 23}
|
||||
@@ -83,7 +83,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -91,8 +91,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1995/11/28 11:17:47
|
||||
## File existed as early as: 1995
|
||||
## Under source code control: 1995/11/28 11:17:47
|
||||
## File existed as early as: 1995
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
48
help/digit
48
help/digit
@@ -5,11 +5,11 @@ SYNOPSIS
|
||||
digit(x, n [, b])
|
||||
|
||||
TYPES
|
||||
x real
|
||||
n integer
|
||||
b integer >= 2, default = 10
|
||||
x real
|
||||
n integer
|
||||
b integer >= 2, default = 10
|
||||
|
||||
return integer
|
||||
return integer
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
@@ -28,11 +28,11 @@ DESCRIPTION
|
||||
left of the "decimal" point; the digit d_n at position n contributes
|
||||
additively d_n * b^n to the value of x. For example,
|
||||
|
||||
; d_2 d_1 d_0 . d_-1 d_-2
|
||||
; d_2 d_1 d_0 . d_-1 d_-2
|
||||
|
||||
represents the number
|
||||
|
||||
; d_2 * b^2 + d_1 * b + d0 + d_-1 * b^-1 + d_-2 * b^-2
|
||||
; d_2 * b^2 + d_1 * b + d0 + d_-1 * b^-1 + d_-2 * b^-2
|
||||
|
||||
The sequence of digits has to be infinite if den(x) has a prime factor
|
||||
which is not a factor of the base b. In cases where the representation
|
||||
@@ -53,30 +53,30 @@ DESCRIPTION
|
||||
With base-b digits for x as explained above, the integer whose base-b
|
||||
representation is
|
||||
|
||||
; b_n+k-1 b_n_k-2 ... b_n,
|
||||
; b_n+k-1 b_n_k-2 ... b_n,
|
||||
|
||||
i.e. the k digits with last digit b_n, is given by
|
||||
|
||||
; digit(b^-r * x, q, b^k)
|
||||
; digit(b^-r * x, q, b^k)
|
||||
|
||||
if r and q satisfy n = q * b + r.
|
||||
|
||||
EXAMPLE
|
||||
; a = 123456.789
|
||||
; for (n = 6; n >= -6; n++) print digit(a, n),; print
|
||||
0 1 2 3 4 5 6 7 8 9 0 0 0
|
||||
; a = 123456.789
|
||||
; for (n = 6; n >= -6; n++) print digit(a, n),; print
|
||||
0 1 2 3 4 5 6 7 8 9 0 0 0
|
||||
|
||||
; for (n = 6; n >= -6; n--) print digit(a, n, 100),; print
|
||||
0 0 0 0 12 34 56 78 90 0 0 0 0
|
||||
; for (n = 6; n >= -6; n--) print digit(a, n, 100),; print
|
||||
0 0 0 0 12 34 56 78 90 0 0 0 0
|
||||
|
||||
; for (n = 6; n >= -6; n--) print digit(a, n, 256),; print
|
||||
0 0 0 0 1 226 64 201 251 231 108 139 67
|
||||
; for (n = 6; n >= -6; n--) print digit(a, n, 256),; print
|
||||
0 0 0 0 1 226 64 201 251 231 108 139 67
|
||||
|
||||
; for (n = 1; n >= -12; n++) print digit(10/7, n),; print
|
||||
; 0 1 4 2 8 5 7 1 4 2 8 5 7 1
|
||||
; for (n = 1; n >= -12; n++) print digit(10/7, n),; print
|
||||
; 0 1 4 2 8 5 7 1 4 2 8 5 7 1
|
||||
|
||||
; print digit(10/7, -7e1000, 1e6)
|
||||
428571
|
||||
; print digit(10/7, -7e1000, 1e6)
|
||||
428571
|
||||
|
||||
LIMITS
|
||||
|
||||
@@ -99,7 +99,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -107,8 +107,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1995/10/03 10:40:01
|
||||
## File existed as early as: 1995
|
||||
## Under source code control: 1995/10/03 10:40:01
|
||||
## File existed as early as: 1995
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
24
help/digits
24
help/digits
@@ -5,10 +5,10 @@ SYNOPSIS
|
||||
digits(x [,b])
|
||||
|
||||
TYPES
|
||||
x real
|
||||
b integer >= 2, defaults to 10
|
||||
x real
|
||||
b integer >= 2, defaults to 10
|
||||
|
||||
return integer
|
||||
return integer
|
||||
|
||||
DESCRIPTION
|
||||
Returns number of digits in the standard base-b representation
|
||||
@@ -23,10 +23,10 @@ DESCRIPTION
|
||||
|
||||
One should remember these special cases:
|
||||
|
||||
digits(12.3456) == 2 computes with the integer part only
|
||||
digits(-1234) == 4 computes with the absolute value only
|
||||
digits(0) == 1 special case
|
||||
digits(-0.123) == 1 combination of all of the above
|
||||
digits(12.3456) == 2 computes with the integer part only
|
||||
digits(-1234) == 4 computes with the absolute value only
|
||||
digits(0) == 1 special case
|
||||
digits(-0.123) == 1 combination of all of the above
|
||||
|
||||
EXAMPLE
|
||||
; print digits(100), digits(23209), digits(2^72)
|
||||
@@ -58,7 +58,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -66,8 +66,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1995/10/03 10:40:01
|
||||
## File existed as early as: 1995
|
||||
## Under source code control: 1995/10/03 10:40:01
|
||||
## File existed as early as: 1995
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
22
help/display
22
help/display
@@ -5,9 +5,9 @@ SYNOPSIS
|
||||
display([d])
|
||||
|
||||
TYPES
|
||||
d integer >= 0
|
||||
d integer >= 0
|
||||
|
||||
return integer
|
||||
return integer
|
||||
|
||||
DESCRIPTION
|
||||
When given an argument, this function sets the maximum number of
|
||||
@@ -21,13 +21,13 @@ DESCRIPTION
|
||||
|
||||
The builtin function:
|
||||
|
||||
display(d)
|
||||
display()
|
||||
display(d)
|
||||
display()
|
||||
|
||||
is an alias for:
|
||||
|
||||
config("display", d)
|
||||
config("display")
|
||||
config("display", d)
|
||||
config("display")
|
||||
|
||||
The display digit value does not change the stored value of a number.
|
||||
It only changes how a stored value is displayed.
|
||||
@@ -108,7 +108,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -116,8 +116,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 2004/07/25 23:50:40
|
||||
## File existed as early as: 2004
|
||||
## Under source code control: 2004/07/25 23:50:40
|
||||
## File existed as early as: 2004
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
22
help/dms2d
22
help/dms2d
@@ -6,19 +6,19 @@ SYNOPSIS
|
||||
dms2d(d, m, s [,rnd])
|
||||
|
||||
TYPES
|
||||
d real
|
||||
m real
|
||||
s real (defaults to 0)
|
||||
rnd nonnegative integer, defaults to config("mod")
|
||||
d real
|
||||
m real
|
||||
s real (defaults to 0)
|
||||
rnd nonnegative integer, defaults to config("mod")
|
||||
|
||||
return degrees
|
||||
return degrees
|
||||
|
||||
DESCRIPTION
|
||||
Convert degrees, m minutes, and s seconds returning degrees.
|
||||
|
||||
The return value in degrees, is equivalent to the following:
|
||||
|
||||
mod(d + m/60 + s/3600, 360, rnd);
|
||||
mod(d + m/60 + s/3600, 360, rnd);
|
||||
|
||||
Depending on the rounding mode, the return could be a real value
|
||||
in the interval [0, 360) or a real value in the interval (-360, 0].
|
||||
@@ -67,7 +67,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -75,8 +75,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 2021/09/25 17:24:51
|
||||
## File existed as early as: 2021
|
||||
## Under source code control: 2021/09/25 17:24:51
|
||||
## File existed as early as: 2021
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
20
help/dp
20
help/dp
@@ -5,21 +5,21 @@ SYNOPSIS
|
||||
dp(x, y)
|
||||
|
||||
TYPES
|
||||
x, y 1-dimensional matrices of the same size
|
||||
x, y 1-dimensional matrices of the same size
|
||||
|
||||
return depends on the nature of the elements of x and y
|
||||
return depends on the nature of the elements of x and y
|
||||
|
||||
DESCRIPTION
|
||||
Compute the dot product of two 1-dimensional matrices.
|
||||
|
||||
Let:
|
||||
|
||||
x = {x0, x1, ... xn}
|
||||
y = {y0, y1, ... yn}
|
||||
x = {x0, x1, ... xn}
|
||||
y = {y0, y1, ... yn}
|
||||
|
||||
Then dp(x,y) returns the result of the calculation:
|
||||
|
||||
x0*y0 + x1*y1 + ... + xn*yn
|
||||
x0*y0 + x1*y1 + ... + xn*yn
|
||||
|
||||
EXAMPLE
|
||||
; mat x[3] = {2,3,4}
|
||||
@@ -44,7 +44,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -52,8 +52,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1995/10/05 04:52:26
|
||||
## File existed as early as: 1995
|
||||
## Under source code control: 1995/10/05 04:52:26
|
||||
## File existed as early as: 1995
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
140
help/environment
140
help/environment
@@ -2,119 +2,119 @@ Environment variables
|
||||
|
||||
CALCPATH
|
||||
|
||||
A :-separated list of directories used to search for
|
||||
resource filenames (*.cal files) that do not begin with:
|
||||
A :-separated list of directories used to search for
|
||||
resource filenames (*.cal files) that do not begin with:
|
||||
|
||||
/ ./ ../ ~
|
||||
/ ./ ../ ~
|
||||
|
||||
If this variable does not exist, or if this
|
||||
variable is an empty string, a compiled value
|
||||
is used. Typically compiled in value is:
|
||||
If this variable does not exist, or if this
|
||||
variable is an empty string, a compiled value
|
||||
is used. Typically compiled in value is:
|
||||
|
||||
.:./cal:~/cal:${CALC_SHAREDIR}:${CUSTOMCALDIR}
|
||||
.:./cal:~/cal:${CALC_SHAREDIR}:${CUSTOMCALDIR}
|
||||
|
||||
which is usually:
|
||||
which is usually:
|
||||
|
||||
.:./cal:~/cal:/usr/share/calc:/usr/share/calc/custom
|
||||
.:./cal:~/cal:/usr/share/calc:/usr/share/calc/custom
|
||||
|
||||
This value is used by the READ command. It is an error
|
||||
if no such readable file is found.
|
||||
This value is used by the READ command. It is an error
|
||||
if no such readable file is found.
|
||||
|
||||
The CALCBINDINGS file searches the CALCPATH as well.
|
||||
The CALCBINDINGS file searches the CALCPATH as well.
|
||||
|
||||
CALCRC
|
||||
|
||||
On startup (unless -h or -q was given on the command
|
||||
line), calc searches for files along the :-separated
|
||||
$CALCRC environment variable.
|
||||
On startup (unless -h or -q was given on the command
|
||||
line), calc searches for files along the :-separated
|
||||
$CALCRC environment variable.
|
||||
|
||||
If this variable does not exist, or if this
|
||||
If this variable does not exist, or if this
|
||||
variable is an empty string, a compiled value
|
||||
is used. Typically compiled in value is:
|
||||
is used. Typically compiled in value is:
|
||||
|
||||
${CALC_SHAREDIR}/startup:~/.calcrc:./.calcinit
|
||||
${CALC_SHAREDIR}/startup:~/.calcrc:./.calcinit
|
||||
|
||||
which is usually:
|
||||
which is usually:
|
||||
|
||||
/usr/share/calc/startup:~/.calcrc:./.calcinit
|
||||
/usr/share/calc/startup:~/.calcrc:./.calcinit
|
||||
|
||||
Missing files along the $CALCRC path are silently ignored.
|
||||
Missing files along the $CALCRC path are silently ignored.
|
||||
|
||||
CALCBINDINGS
|
||||
|
||||
On startup (unless -h or -q was given on the command
|
||||
line), calc reads key bindings from the filename specified
|
||||
in the $CALCRC environment variable. These key bindings
|
||||
are used for command line editing and the command history.
|
||||
On startup (unless -h or -q was given on the command
|
||||
line), calc reads key bindings from the filename specified
|
||||
in the $CALCRC environment variable. These key bindings
|
||||
are used for command line editing and the command history.
|
||||
|
||||
If this variable does not exist, a compiled value is used.
|
||||
Typically compiled in value is:
|
||||
If this variable does not exist, a compiled value is used.
|
||||
Typically compiled in value is:
|
||||
|
||||
bindings
|
||||
bindings
|
||||
|
||||
The bindings file is searched along the CALCPATH. Unlike
|
||||
the READ command, a .cal extension is not added.
|
||||
The bindings file is searched along the CALCPATH. Unlike
|
||||
the READ command, a .cal extension is not added.
|
||||
|
||||
If the file could not be opened, or if standard input is not
|
||||
a terminal, then calc will still run, but fancy command line
|
||||
editing is disabled.
|
||||
If the file could not be opened, or if standard input is not
|
||||
a terminal, then calc will still run, but fancy command line
|
||||
editing is disabled.
|
||||
|
||||
NOTE: If calc was compiled with GNU-readline support, the
|
||||
CALCBINDINGS facility is ignored and the standard
|
||||
readline mechanisms (see readline(3)) are used.
|
||||
NOTE: If calc was compiled with GNU-readline support, the
|
||||
CALCBINDINGS facility is ignored and the standard
|
||||
readline mechanisms (see readline(3)) are used.
|
||||
|
||||
HOME
|
||||
|
||||
This value is taken to be the home directory of the
|
||||
current user. It is used when files begin with '~/'.
|
||||
This value is taken to be the home directory of the
|
||||
current user. It is used when files begin with '~/'.
|
||||
|
||||
If this variable does not exist, or if this
|
||||
variable is an empty string, the home directory password
|
||||
entry of the current user is used. If that information
|
||||
is not available, '.' is used.
|
||||
If this variable does not exist, or if this
|
||||
variable is an empty string, the home directory password
|
||||
entry of the current user is used. If that information
|
||||
is not available, '.' is used.
|
||||
|
||||
PAGER
|
||||
|
||||
When invoking help, this environment variable is used
|
||||
to display a help file.
|
||||
When invoking help, this environment variable is used
|
||||
to display a help file.
|
||||
|
||||
If this variable does not exist, or if this
|
||||
variable is an empty string, a compiled value
|
||||
is used. Typically compiled in value is something
|
||||
such as 'more', 'less', 'pg' or 'cat'.
|
||||
If this variable does not exist, or if this
|
||||
variable is an empty string, a compiled value
|
||||
is used. Typically compiled in value is something
|
||||
such as 'more', 'less', 'pg' or 'cat'.
|
||||
|
||||
SHELL
|
||||
|
||||
When a !-command is used, the program indicated by
|
||||
this environment variable is used.
|
||||
When a !-command is used, the program indicated by
|
||||
this environment variable is used.
|
||||
|
||||
If this variable does not exist, or if this
|
||||
variable is an empty string, a compiled value
|
||||
is used. Typically compiled in value is something
|
||||
such as 'sh' is used.
|
||||
If this variable does not exist, or if this
|
||||
variable is an empty string, a compiled value
|
||||
is used. Typically compiled in value is something
|
||||
such as 'sh' is used.
|
||||
|
||||
CALCHISTFILE
|
||||
|
||||
This value is taken to be the calc history file.
|
||||
This value is taken to be the calc history file.
|
||||
|
||||
If this variable does not exist, or if this
|
||||
variable is an empty string, then ~/.calc_history
|
||||
is used.
|
||||
If this variable does not exist, or if this
|
||||
variable is an empty string, then ~/.calc_history
|
||||
is used.
|
||||
|
||||
CALCHELP
|
||||
|
||||
Location of the calc help directory.
|
||||
Location of the calc help directory.
|
||||
|
||||
If this variable does not exist, or if this
|
||||
variable is an empty string, then ${HELPDIR}
|
||||
If this variable does not exist, or if this
|
||||
variable is an empty string, then ${HELPDIR}
|
||||
|
||||
CALCCUSTOMHELP
|
||||
|
||||
Location of the calc custom help directory.
|
||||
Location of the calc custom help directory.
|
||||
|
||||
If this variable does not exist, or if this
|
||||
variable is an empty string, then ${CUSTOMHELPDIR}
|
||||
is used.
|
||||
If this variable does not exist, or if this
|
||||
variable is an empty string, then ${CUSTOMHELPDIR}
|
||||
is used.
|
||||
|
||||
## Copyright (C) 1999,2021 Landon Curt Noll
|
||||
##
|
||||
@@ -124,7 +124,7 @@ Environment variables
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -132,8 +132,8 @@ Environment variables
|
||||
## 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: 1991/07/23 05:47:25
|
||||
## File existed as early as: 1991
|
||||
## Under source code control: 1991/07/23 05:47:25
|
||||
## File existed as early as: 1991
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
14
help/epsilon
14
help/epsilon
@@ -5,9 +5,9 @@ SYNOPSIS
|
||||
epsilon([eps])
|
||||
|
||||
TYPES
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
eps 0 < real < 1, defaults to epsilon()
|
||||
|
||||
return real number greater than 0 and less than 1
|
||||
return real number greater than 0 and less than 1
|
||||
|
||||
DESCRIPTION
|
||||
Without args, epsilon() returns the current epsilon value.
|
||||
@@ -89,7 +89,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -97,8 +97,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1995/10/05 04:52:26
|
||||
## File existed as early as: 1995
|
||||
## Under source code control: 1995/10/05 04:52:26
|
||||
## File existed as early as: 1995
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
@@ -5,9 +5,9 @@ SYNOPSIS
|
||||
errcount([num])
|
||||
|
||||
TYPES
|
||||
num integer
|
||||
num integer
|
||||
|
||||
return integer
|
||||
return integer
|
||||
|
||||
DESCRIPTION
|
||||
An internal variable keeps count of the number of functions
|
||||
@@ -22,7 +22,7 @@ DESCRIPTION
|
||||
|
||||
If an error value is assigned to a variable as in:
|
||||
|
||||
infty = 1/0;
|
||||
infty = 1/0;
|
||||
|
||||
then a function returning that variable does not contribute to
|
||||
errcount.
|
||||
@@ -31,9 +31,9 @@ EXAMPLE
|
||||
; ## NOTE: Your output may vary:
|
||||
|
||||
; errmax(10)
|
||||
0
|
||||
0
|
||||
; errcount()
|
||||
0
|
||||
0
|
||||
; a = 1/0; b = 2 + ""; c = error(27); d = newerror("a");
|
||||
; print errcount(), a, errcount(), errmax();
|
||||
4 Error E_DIVBYZERO 4 10
|
||||
@@ -55,7 +55,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -63,8 +63,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1997/03/08 08:51:14
|
||||
## File existed as early as: 1997
|
||||
## Under source code control: 1997/03/08 08:51:14
|
||||
## File existed as early as: 1997
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
20
help/errmax
20
help/errmax
@@ -5,9 +5,9 @@ SYNOPSIS
|
||||
errmax([num])
|
||||
|
||||
TYPES
|
||||
num integer
|
||||
num integer
|
||||
|
||||
return integer
|
||||
return integer
|
||||
|
||||
DESCRIPTION
|
||||
Without an argument, errmax() returns the current value of an
|
||||
@@ -20,9 +20,9 @@ DESCRIPTION
|
||||
|
||||
EXAMPLE
|
||||
; errmax(2)
|
||||
20
|
||||
20
|
||||
; errcount()
|
||||
0
|
||||
0
|
||||
; a = 1/0; b = 2 + ""; c = error(27); d = newerror("alpha");
|
||||
Error 27 caused errcount to exceed errmax
|
||||
|
||||
@@ -33,7 +33,7 @@ EXAMPLE
|
||||
0 0
|
||||
|
||||
; errmax(-1)
|
||||
2
|
||||
2
|
||||
|
||||
LIMITS
|
||||
-1 <= num <= 2147483647
|
||||
@@ -52,7 +52,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -60,8 +60,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1997/03/08 08:51:14
|
||||
## File existed as early as: 1997
|
||||
## Under source code control: 1997/03/08 08:51:14
|
||||
## File existed as early as: 1997
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
68
help/errno
68
help/errno
@@ -5,55 +5,55 @@ SYNOPSIS
|
||||
errno([errnum | "E_STRING"])
|
||||
|
||||
TYPES
|
||||
errnum integer
|
||||
E_STRING string
|
||||
errnum integer
|
||||
E_STRING string
|
||||
|
||||
return integer
|
||||
return integer
|
||||
|
||||
DESCRIPTION
|
||||
With errno(errnum) numeric argument:
|
||||
|
||||
For 0 < errnum <= 32767:
|
||||
For 0 < errnum <= 32767:
|
||||
|
||||
errno(errnum) sets "global calc_errno value" to the value
|
||||
errnum and returns its previous value. Unlike error(errnum)
|
||||
calling errno(errnum) does NOT increment the global calc
|
||||
error count (see help errcount).
|
||||
errno(errnum) sets "global calc_errno value" to the value
|
||||
errnum and returns its previous value. Unlike error(errnum)
|
||||
calling errno(errnum) does NOT increment the global calc
|
||||
error count (see help errcount).
|
||||
|
||||
For all other errnum values:
|
||||
For all other errnum values:
|
||||
|
||||
An error error condition is raised about the valid errnum.
|
||||
An error error condition is raised about the valid errnum.
|
||||
|
||||
With errno("E_STRING") string argument:
|
||||
|
||||
If E_STRING is a valid errsym code, then the E_STRING errsym
|
||||
is converted into an equivalent errnum and errno is set to errnum.
|
||||
If E_STRING is a valid errsym code, then the E_STRING errsym
|
||||
is converted into an equivalent errnum and errno is set to errnum.
|
||||
|
||||
If E_STRING is not a valid errsym code, an error error condition
|
||||
is raised about the invalid E_STRING.
|
||||
If E_STRING is not a valid errsym code, an error error condition
|
||||
is raised about the invalid E_STRING.
|
||||
|
||||
For example, these two calls are equivalent:
|
||||
For example, these two calls are equivalent:
|
||||
|
||||
errno(10003); /* error 10003 has a E_STRING of "E_ADD" */
|
||||
errno("E_ADD"); /* error 10003 has a E_STRING of "E_ADD" */
|
||||
errno(10003); /* error 10003 has a E_STRING of "E_ADD" */
|
||||
errno("E_ADD"); /* error 10003 has a E_STRING of "E_ADD" */
|
||||
|
||||
See help errsym for information on E_STRING errsym codes.
|
||||
See help errsym for information on E_STRING errsym codes.
|
||||
|
||||
For a list of the E_STRING associated with calc computation error
|
||||
codes, see help errorcodes.
|
||||
For a list of the E_STRING associated with calc computation error
|
||||
codes, see help errorcodes.
|
||||
|
||||
With errno() no argument:
|
||||
|
||||
errno() returns the current value of "global calc_errno
|
||||
value". Unlike error() calling errno() does NOT increment
|
||||
the global calc error count (see help errcount).
|
||||
errno() returns the current value of "global calc_errno
|
||||
value". Unlike error() calling errno() does NOT increment
|
||||
the global calc error count (see help errcount).
|
||||
|
||||
NOTE:
|
||||
|
||||
The errno() builtin should not be confused with the errno
|
||||
used by libc in C. The range of errnum extend beyond the
|
||||
C's libc errno. See help error for information on the mean
|
||||
of various errnum ranges.
|
||||
The errno() builtin should not be confused with the errno
|
||||
used by libc in C. The range of errnum extend beyond the
|
||||
C's libc errno. See help error for information on the mean
|
||||
of various errnum ranges.
|
||||
|
||||
Unlike error() calling errno() does NOT increment the global
|
||||
calc error count (see help errcount).
|
||||
@@ -97,10 +97,10 @@ LIMITS
|
||||
E_STRING is string that must match the regular expression: ^E_[A-Z0-9_]+$
|
||||
|
||||
LINK LIBRARY
|
||||
int calc_errno; /* global calc_errno value */
|
||||
int calc_errno; /* global calc_errno value */
|
||||
int set_errno(int e);
|
||||
|
||||
CONST struct errtbl error_table[ECOUNT+2]; /* calc error codes, error symbols and error messages */
|
||||
CONST struct errtbl error_table[ECOUNT+2]; /* calc error codes, error symbols and error messages */
|
||||
|
||||
bool is_e_digits(CONST char *errsym);
|
||||
bool is_valid_errnum(int errnum);
|
||||
@@ -126,7 +126,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -134,8 +134,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1994/10/27 03:05:08
|
||||
## File existed as early as: 1994
|
||||
## Under source code control: 1994/10/27 03:05:08
|
||||
## File existed as early as: 1994
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
102
help/error
102
help/error
@@ -5,63 +5,63 @@ SYNOPSIS
|
||||
error([errnum | "E_STRING"])
|
||||
|
||||
TYPES
|
||||
errnum integer, defaults to errno()
|
||||
E_STRING string
|
||||
errnum integer, defaults to errno()
|
||||
E_STRING string
|
||||
|
||||
return null value or error value
|
||||
return null value or error value
|
||||
|
||||
DESCRIPTION
|
||||
If errnum == 0:
|
||||
|
||||
error(errnum) returns the null value.
|
||||
error(errnum) returns the null value.
|
||||
|
||||
The "global calc_errno value" is set to 0.
|
||||
The "global calc_errno value" is set to 0.
|
||||
|
||||
The global calc error count is not changed.
|
||||
The global calc error count is not changed.
|
||||
|
||||
With error(errnum) numeric argument:
|
||||
|
||||
For 0 < errnum <= 32767:
|
||||
For 0 < errnum <= 32767:
|
||||
|
||||
error(errnum) returns a value that is of a special type called
|
||||
"error". The "error" return value, when given to iserror()
|
||||
will cause that function to return a true value that happens
|
||||
to match the "global calc_errno value".
|
||||
error(errnum) returns a value that is of a special type called
|
||||
"error". The "error" return value, when given to iserror()
|
||||
will cause that function to return a true value that happens
|
||||
to match the "global calc_errno value".
|
||||
|
||||
The "global calc_errno value" is then set to errnum.
|
||||
The "global calc_errno value" is then set to errnum.
|
||||
|
||||
For all other errnum values:
|
||||
For all other errnum values:
|
||||
|
||||
An error error condition is raised about the valid errnum.
|
||||
An error error condition is raised about the valid errnum.
|
||||
|
||||
The global calc error count (see help errcount) is incremented.
|
||||
If the global calc error count exceeds the maximum count
|
||||
(see help errmax), any ongoing calc execution is aborted.
|
||||
The global calc error count (see help errcount) is incremented.
|
||||
If the global calc error count exceeds the maximum count
|
||||
(see help errmax), any ongoing calc execution is aborted.
|
||||
|
||||
With error("E_STRING") string argument:
|
||||
|
||||
If E_STRING is a valid errsym code, then the E_STRING errsym
|
||||
is converted into an equivalent errnum and respective calc
|
||||
error condition is raised.
|
||||
If E_STRING is a valid errsym code, then the E_STRING errsym
|
||||
is converted into an equivalent errnum and respective calc
|
||||
error condition is raised.
|
||||
|
||||
If E_STRING is not a valid errsym code, an error error condition
|
||||
is raised about the invalid E_STRING.
|
||||
If E_STRING is not a valid errsym code, an error error condition
|
||||
is raised about the invalid E_STRING.
|
||||
|
||||
For example, these two calls are equivalent:
|
||||
For example, these two calls are equivalent:
|
||||
|
||||
error(10003); /* error 10003 has a E_STRING of "E_ADD" */
|
||||
error("E_ADD"); /* error 10003 has a E_STRING of "E_ADD" */
|
||||
error(10003); /* error 10003 has a E_STRING of "E_ADD" */
|
||||
error("E_ADD"); /* error 10003 has a E_STRING of "E_ADD" */
|
||||
|
||||
See help errsym for information on E_STRING errsym codes.
|
||||
See help errsym for information on E_STRING errsym codes.
|
||||
|
||||
For a list of the E_STRING associated with calc computation error
|
||||
codes, see help errorcodes.
|
||||
For a list of the E_STRING associated with calc computation error
|
||||
codes, see help errorcodes.
|
||||
|
||||
For no errnum arg:
|
||||
|
||||
Calling error() without an argument will return the current
|
||||
"global calc_errno value" AND will also increment the
|
||||
global calc error count.
|
||||
Calling error() without an argument will return the current
|
||||
"global calc_errno value" AND will also increment the
|
||||
global calc error count.
|
||||
|
||||
All other values of errnum are reserved for future use and currently
|
||||
will generate an error.
|
||||
@@ -81,23 +81,23 @@ DESCRIPTION
|
||||
|
||||
By convention, the "global calc_errno value" has the following ranges:
|
||||
|
||||
errnum < 0 Reserved for future use
|
||||
errnum == 0 calc_errno cleared: libc errno codes above here
|
||||
1 <= errnum <= 9999 system error and libc errno codes
|
||||
errnum == 10000 Reserved for "No error" calc internal state
|
||||
10001 <= errnum <= E__HIGHEST calc computation error codes
|
||||
E__HIGHEST < errnum < 20000 Reserved for future calc error codes
|
||||
20000 < errnum <= 32767 User defined error codes start here
|
||||
errnum >= 32768 Reserved for future use
|
||||
errnum < 0 Reserved for future use
|
||||
errnum == 0 calc_errno cleared: libc errno codes above here
|
||||
1 <= errnum <= 9999 system error and libc errno codes
|
||||
errnum == 10000 Reserved for "No error" calc internal state
|
||||
10001 <= errnum <= E__HIGHEST calc computation error codes
|
||||
E__HIGHEST < errnum < 20000 Reserved for future calc error codes
|
||||
20000 < errnum <= 32767 User defined error codes start here
|
||||
errnum >= 32768 Reserved for future use
|
||||
|
||||
The following constants are part of the calc error code mechanism:
|
||||
|
||||
E__BASE == 10000 1 less than the 1st calc computation error code
|
||||
E__HIGHEST highest assigned calc computation error code
|
||||
E__USERDEF == 20000 user defined error codes start here
|
||||
E__USERMAX == 32767 maximum user defined error code
|
||||
E__BASE == 10000 1 less than the 1st calc computation error code
|
||||
E__HIGHEST highest assigned calc computation error code
|
||||
E__USERDEF == 20000 user defined error codes start here
|
||||
E__USERMAX == 32767 maximum user defined error code
|
||||
|
||||
ECOUNT number of calc computation error codes (not including E__BASE)
|
||||
ECOUNT number of calc computation error codes (not including E__BASE)
|
||||
|
||||
See help errorcodes for the actual values of the above constants.
|
||||
|
||||
@@ -134,9 +134,9 @@ LIMITS
|
||||
E_STRING is string that must match the regular expression: ^E_[A-Z0-9_]+$
|
||||
|
||||
LINK LIBRARY
|
||||
int calc_errno; /* global calc_errno value */
|
||||
int calc_errno; /* global calc_errno value */
|
||||
|
||||
CONST struct errtbl error_table[ECOUNT+2]; /* calc error codes, error symbols and error messages */
|
||||
CONST struct errtbl error_table[ECOUNT+2]; /* calc error codes, error symbols and error messages */
|
||||
|
||||
bool is_e_digits(CONST char *errsym);
|
||||
bool is_valid_errnum(int errnum);
|
||||
@@ -163,7 +163,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -171,8 +171,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1995/12/18 03:30:59
|
||||
## File existed as early as: 1995
|
||||
## Under source code control: 1995/12/18 03:30:59
|
||||
## File existed as early as: 1995
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
150
help/errsym
150
help/errsym
@@ -5,96 +5,96 @@ SYNOPSIS
|
||||
errsym(errnum | "E_STRING")
|
||||
|
||||
TYPES
|
||||
errnum integer
|
||||
E_STRING string
|
||||
errnum integer
|
||||
E_STRING string
|
||||
|
||||
return integer or string or error value
|
||||
return integer or string or error value
|
||||
|
||||
DESCRIPTION
|
||||
When called with in integer errnum argument:
|
||||
|
||||
When E__BASE < errnum <= E__HIGHEST, the corresponding errsym E_STRING
|
||||
from the error_table[] array is returned.
|
||||
When E__BASE < errnum <= E__HIGHEST, the corresponding errsym E_STRING
|
||||
from the error_table[] array is returned.
|
||||
|
||||
For example:
|
||||
For example:
|
||||
|
||||
; print errsym(10003)
|
||||
E_ADD
|
||||
; print errsym(10003)
|
||||
E_ADD
|
||||
|
||||
When an errnum that matches one of the following errtbl.h #define,
|
||||
then the #define string is returned:
|
||||
When an errnum that matches one of the following errtbl.h #define,
|
||||
then the #define string is returned:
|
||||
|
||||
E__NONE
|
||||
E__BASE
|
||||
E__USERDEF
|
||||
E__USERMAX
|
||||
E__NONE
|
||||
E__BASE
|
||||
E__USERDEF
|
||||
E__USERMAX
|
||||
|
||||
NOTE: For errnum == E__HIGHEST, the corresponding E_STRING that
|
||||
is returned is NOT "E__HIGHEST". Instead the E_STRING corresponding
|
||||
to the highest errnum number from the error_table[] array is returned.
|
||||
NOTE: For errnum == E__HIGHEST, the corresponding E_STRING that
|
||||
is returned is NOT "E__HIGHEST". Instead the E_STRING corresponding
|
||||
to the highest errnum number from the error_table[] array is returned.
|
||||
|
||||
For example:
|
||||
For example:
|
||||
|
||||
; print errsym(0)
|
||||
E_NONE
|
||||
; print errsym(0)
|
||||
E_NONE
|
||||
|
||||
When E__NONE <= errnum < E__BASE, or when E__USERDEF <= errnum <= E__USERMAX,
|
||||
an "E_STRING" errsym of the form "E_digits" is returned where "digits"
|
||||
are the ASCII digits of the decimal value of errnum.
|
||||
When E__NONE <= errnum < E__BASE, or when E__USERDEF <= errnum <= E__USERMAX,
|
||||
an "E_STRING" errsym of the form "E_digits" is returned where "digits"
|
||||
are the ASCII digits of the decimal value of errnum.
|
||||
|
||||
For example:
|
||||
For example:
|
||||
|
||||
; print errsym(123)
|
||||
E_123
|
||||
; print errsym(123)
|
||||
E_123
|
||||
|
||||
For all other errnum values, an error is returned.
|
||||
For all other errnum values, an error is returned.
|
||||
|
||||
When called with E_STRING string argument:
|
||||
|
||||
When the E_STRING starts with "E_" followed by only decimal digits:
|
||||
|
||||
If E_STRING is "E_0", 0 is returned.
|
||||
If E_STRING is "E_0", 0 is returned.
|
||||
|
||||
If E_STRING matches the regular expression:
|
||||
If E_STRING matches the regular expression:
|
||||
|
||||
^E_[1-9][0-9]+$
|
||||
^E_[1-9][0-9]+$
|
||||
|
||||
where digits 0 < errnum <= 32767, the errnum value is returned.
|
||||
where digits 0 < errnum <= 32767, the errnum value is returned.
|
||||
|
||||
For all other cases of "E_" by only decimal digits, an error is returned.
|
||||
For all other cases of "E_" by only decimal digits, an error is returned.
|
||||
|
||||
When the E_STRING matches one of the following special
|
||||
symbols, the symbol's numeric value as #define-d in errsym.h
|
||||
or errtbl.h is returned:
|
||||
When the E_STRING matches one of the following special
|
||||
symbols, the symbol's numeric value as #define-d in errsym.h
|
||||
or errtbl.h is returned:
|
||||
|
||||
E__NONE
|
||||
E__BASE
|
||||
E__HIGHEST
|
||||
E__USERDEF
|
||||
E__USERMAX
|
||||
E__NONE
|
||||
E__BASE
|
||||
E__HIGHEST
|
||||
E__USERDEF
|
||||
E__USERMAX
|
||||
|
||||
For example:
|
||||
For example:
|
||||
|
||||
; print errsym("E_NONE")
|
||||
0
|
||||
; print errsym("E_NONE")
|
||||
0
|
||||
|
||||
For all other E_STRING strings that start with "E__", an error is returned.
|
||||
For all other E_STRING strings that start with "E__", an error is returned.
|
||||
|
||||
When the E_STRING starts with "E_" followed by an UPPER CASE LETTER that
|
||||
also matches the regular expression:
|
||||
When the E_STRING starts with "E_" followed by an UPPER CASE LETTER that
|
||||
also matches the regular expression:
|
||||
|
||||
^E_[A-Z][A-Z0-9_]+$
|
||||
^E_[A-Z][A-Z0-9_]+$
|
||||
|
||||
The error_table[] is searched for an errsym that exactly matches
|
||||
the E_STRING. If a match is found, the corresponding errnum number
|
||||
is returned. If no match is found, an error is returned.
|
||||
The error_table[] is searched for an errsym that exactly matches
|
||||
the E_STRING. If a match is found, the corresponding errnum number
|
||||
is returned. If no match is found, an error is returned.
|
||||
|
||||
For example:
|
||||
For example:
|
||||
|
||||
; print errsym("E_ADD")
|
||||
10003
|
||||
; print errsym("E_ADD")
|
||||
10003
|
||||
|
||||
For all other string arguments, an error is returned.
|
||||
For all other string arguments, an error is returned.
|
||||
|
||||
When errsym returns an integer, the global calc error count (see help errcount)
|
||||
is NOT changed. And of course, when errsym("E_STRING") returns an error, the
|
||||
@@ -102,30 +102,30 @@ DESCRIPTION
|
||||
|
||||
Consider the E_MUL calc error condition:
|
||||
|
||||
Given a E_STRING errsym, errsym("E_STRING") will return the errnum integer
|
||||
error code that is associated with the E_STRING errsym.
|
||||
Given a E_STRING errsym, errsym("E_STRING") will return the errnum integer
|
||||
error code that is associated with the E_STRING errsym.
|
||||
|
||||
The 4th entry of struct errtbl error_table is:
|
||||
The 4th entry of struct errtbl error_table is:
|
||||
|
||||
{ 10005, "E_MUL", "Bad arguments for +" },
|
||||
{ 10005, "E_MUL", "Bad arguments for +" },
|
||||
|
||||
And errcode -d produces a errsym.h with the following #define:
|
||||
And errcode -d produces a errsym.h with the following #define:
|
||||
|
||||
#define E_MUL 10005 /* Bad arguments for * */
|
||||
#define E_MUL 10005 /* Bad arguments for * */
|
||||
|
||||
Thus 10005 is the errnum, "E_MUL" is the E_STRING errsym that is
|
||||
associated with the errmsg error message: "Bad arguments for +".
|
||||
Thus 10005 is the errnum, "E_MUL" is the E_STRING errsym that is
|
||||
associated with the errmsg error message: "Bad arguments for +".
|
||||
|
||||
In the above example, errsym("E_MUL") will return 10005.
|
||||
Also errsym("E_10005") will also return 10005.
|
||||
In the above example, errsym("E_MUL") will return 10005.
|
||||
Also errsym("E_10005") will also return 10005.
|
||||
|
||||
To complete the E_STRING use in the above example:
|
||||
To complete the E_STRING use in the above example:
|
||||
|
||||
Both error(10005) and error("E_MUL") both raise the E_MUL calc error condition
|
||||
Both error(10005) and error("E_MUL") both raise the E_MUL calc error condition
|
||||
|
||||
Both errno(10005) and errno("E_MUL") both return 10005
|
||||
Both errno(10005) and errno("E_MUL") both return 10005
|
||||
|
||||
Both strerror(10005) and strerror("E_MUL") both return "Bad arguments for *"
|
||||
Both strerror(10005) and strerror("E_MUL") both return "Bad arguments for *"
|
||||
|
||||
EXAMPLE
|
||||
; print errsym("E_ADD"), errsym("E_SUB"), errsym("E_MUL"), errsym("E_DIV")
|
||||
@@ -146,9 +146,9 @@ LIMITS
|
||||
E_STRING is string that must match the regular expression: ^E_[A-Z0-9_]+$
|
||||
|
||||
LINK LIBRARY
|
||||
int calc_errno; /* global calc_errno value */
|
||||
int calc_errno; /* global calc_errno value */
|
||||
|
||||
CONST struct errtbl error_table[ECOUNT+2]; /* calc error codes, error symbols and error messages */
|
||||
CONST struct errtbl error_table[ECOUNT+2]; /* calc error codes, error symbols and error messages */
|
||||
|
||||
bool is_e_digits(CONST char *errsym);
|
||||
bool is_valid_errnum(int errnum);
|
||||
@@ -174,7 +174,7 @@ SEE ALSO
|
||||
##
|
||||
## 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
|
||||
## 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
|
||||
@@ -182,8 +182,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1995/12/18 03:30:59
|
||||
## File existed as early as: 1995
|
||||
## Under source code control: 1995/12/18 03:30:59
|
||||
## File existed as early as: 1995
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user