A set of mathematical functions
Name A set of mathematical functions for REXX
Version v1.0, 21 Jan 2000
Author Toby Thurston
(see EMail Addresses)
Distrib. Freeware
Type REXX CMDs
Price -
Source Internet
Name: math100.*
Description of the author:
"Here is a nice simple collections of programs to add standard mathematical
and trigonometric functions to REXX. They are all written as functions so
once you have unpacked them into your PATH, then you can use them just as
if they were REXX BIFs. I have tried them on OS/2 Warp Classic REXX, Windows
95 with Object REXX and Regina and Windows NT with Regina. The following
functions are supported:
fact(x)
returns x! (or 0 if x < 1).
perm(x,y)
returns the number of permutations
of x things taken y at a time (or 0 if x < y or y < 1).
comb(x,y)
returns the number of combinations
of x things taken y at a time (or 0 if x < y or y < 1).
sqrt(x)
returns the square root of x, (or
0 if x <= 0).
pow(x,y)
returns x raised to the power y,
(or 0 if x < 0 and y is not an integer).
log(x[,y])
returns the log of x to the base
y. If y is omitted (or is not an integer) it defaults to 10, otherwise y
should be > 0.
exp(x)
ln(x)
returns the natural log of x (or
0 if x <= 0).
pi()
sin(x)
returns the sine of x (x in radians).
cos(x)
returns the cosine of x (x in radians).
tan(x)
returns the tangent of x (x in radians).
cot(x)
returns the cotangent of x (x in
radians).
sec(x)
returns the secant of x (x in radians).
csc(x)
returns the cosecant of x (x in
radians).
arcsin(x)
returns the inverse of sin(x).
arccos(x)
returns the inverse of cos(x).
arctan(x)
returns the inverse of tan(x).
arccot(x)
returns the inverse of cot(x).
arcsec(x)
returns the inverse of sec(x).
arccsc(x)
returns the inverse of csc(x).
- If you feel the need to speed these functions up, then you can run the
loadmath.cmd script that comes with the package. This will load all the
macros into your macro space. Note that to use this you need to have a copy
of the REXXUTIL external function library that supports SysAddRexxMacro,
such as the one that comes with Object REXX for Windows.
There is one disadvantage to this nice simple way of providing math functions:
because they run as external functions they do not inherit the current setting
of numeric digits from the caller. If you need to use a precision other
than the default of 9, then you should copy the code from each function
you need and make it into a procedure in your main program."
[Back: RXXMATH - Arbitrary Precision Math Functions for REXX]
[Next: Regina Rexx Math functions]