[2141] in comp.os.os2.announce archive

home help back first fref pref prev next nref lref last post

FREEWARE: RXXMATH -- Arbitrary Precision Math Functions for REXX

daemon@ATHENA.MIT.EDU (John Brock)
Thu Nov 28 21:47:25 1996

To: os2ann.DISCUSS@bloom-picayune.MIT.EDU
Date: 28 Nov 1996 21:46:37 GMT
From: jbrock@panix.com (John Brock)
Reply-To: jbrock@panix.com (John Brock)

Reply-to:     jbrock@panix.com (John Brock)
---------------------------------------------------------------------
URLs:         ftp://hobbes.nmsu.edu/os2/dev32/rexx/rxxmath.zip/
              ftp://hobbes.cdrom.com/pub/os2/rexx/rxxmath.zip/

RXXMATH is a math package, written in REXX, which can be called either from
the command line or as an external function or subroutine from REXX. Because
it is written entirely in REXX it is not as fast as math packages written in
C, but unlike such packages it fully supports REXX style arbitrary precision
numbers, and will run essentially unchanged in any environment which supports
standard REXX (which is why I am crossposting this announcement from
comp.os.os2.announce to several non-OS/2 newsgroups).

The following functions are supported:

            FACT(x)    --  Factorial of x
            PERM(x,y)  --  Permutations of x by y
            COMB(x,y)  --  Combinations of x by y
            SQRT(x)    --  Square root of x
            POW(x,y)   --  x to the power of y
            LOG(x,y)   --  Log of y base x
            EXP(x)     --  e to the power of x
            LN(x)      --  Natural log of x
            PI()       --  Value of pi
            SIN(x)     --  Sine of x
            COS(x)     --  Cosine of x
            TAN(x)     --  Tangent of x
            COT(x)     --  Cotangent of x
            SEC(x)     --  Secant of x
            CSC(x)     --  Cosecant of x
            ARCSIN(x)  --  Inverse sine of x
            ARCCOS(x)  --  Inverse cosine of x
            ARCTAN(x)  --  Inverse tangent of x
            ARCCOT(x)  --  Inverse cotangent of x
            ARCSEC(x)  --  Inverse secant of x
            ARCCSC(x)  --  Inverse cosecant of x
            CALC(x)    --  Calculate the value of an expression
                             (e.g. '1 + exp(pi() / 2)')

Note however that all of these functions are supported through one function
call. For example, if you wanted to use RXXMATH to find the value of 1.1 **
2.2 to 50 places, the call would look like this:

    a = rxxmath(50, "POW", 1.1, 2.2)

A couple of requests:

I posted some earlier versions of RXXMATH (then called RXMATH) to USENET a
couple of years ago, but I never uploaded them to any FTP sites, and I'm not
sure what sort of propagation they got. If anyone is still using those
earlier versions, could you let me know?

So far I have run RXXMATH under VM/CMS (which it was originally written for),
MVS/TSO, IBM PC DOS 7, and OS/2 (which the current version was tested under).
I would be interested in hearing from anyone who tries to run it under other
systems, such as the AS/400, one of the Unix or Windows REXXes, or even Amiga
REXX. In theory RXXMATH should run under any standard REXX, and I'd like to
see how well theory accords with practice. Also, I would be interested in
hearing from anyone who tries compiling RXXMATH. Using the VM/CMS REXX
compiler resulted in a very significant increase in speed for me, and I would
expect the same would hold for any true compiler.

Finally, I think it's kind of silly that the basic math functions are still
not included as part of standard REXX. They are perfectly well defined, not
all that difficult to implement, and it seems to me that if you are going to
have arbitrary precision arithmetic in a language then you ought to include
arbitrary precision math functions as well. Anyway, I've set the follow-ups on
this post to comp.lang.rexx (which is read by Mike Cowlishaw, the author of
the language, as well as others involved in the definition and implementation
of REXX), so if you think math functions should be included as part of the
REXX standard (or OREXX now, I guess) please post a follow-up and say so.

John Brock jbrock@panix.com
=====================================================================
-- To submit to c.o.os2.announce: POST (or email os2_ann_req@bix.com)
-- For comments to the moderator: email lfirrantello@bix.com.
 - for posting guidelines see: http://www.bix.com/pub/os2ann/pindex.htm

home help back first fref pref prev next nref lref last post