Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.

ANN: Zelefunt

Skip to first unread message

David N. Williams

Apr 6, 2003, 11:26:45 AM4/6/03
The port of W. J. Cody's celefunt package for testing the
accuracy of complex elementary functions is finished, and can be
found as a collection of .fs files under "ports of celefunt
tests" and "ports of celefunt subprograms" at

It tests the functions |z|, zexp, zln, zpow, zsin, zcos, and
zsqrt, using complex.fs and complex-kahan.fs, ANS Forth versions
of Julian Noble's complex lexicon mentioned on the page. It
also works with the pfe C primitive implementation of the JVN

The code is intended to be ANS compatible except for DEFER and
IS, up to case sensitivity. Works under pfe and gforth on the
MacOS and linux systems I use.

The port is intended to be as far as possible equivalent to
Cody's calculations. The Fortan source is fairly readable,
especially because it is quite regular. Except for formulas, I
find the Forth more readable, but that might be due to
familiarity with the Fortran context. If it's not, I need to
revise the commenting.

I have not posted results for zexp.fs, zpow.fs, zsincos.fs.
They are mostly similar to the Fortran celefunt results on my
system, but with Fortran occasionally winning by 6-9 out of 53
bits of accuracy. This is not surprising, since I didn't do any
higher accuracy algorithms in the lexicon for the "simpler"
functions. Somebody should do that -- maybe I'll return to it
after a rest.

As I got further along, I got more and more annoyed at my
decision to use variables instead of constants for the machine
parameter results in machar.fs. This is definitely worth
changing. The reason was that the machar calculations produce
intermediate results that require some variables, and I thought
it would be easier not to have to remember what's a variable and
what's a constant.

Anyway, there it is!

-- David

0 new messages