The exponentional function can be calculated accurately for large
arguments using relatively few terms of the Taylor series by using the
identity

^y-:(2^n)*^(y-n*^.2)

where n=<.0.5 y% ^.2 .

This is the method used by Microsoft (and other) libm libraries.  It
has the advantage that multiplication by 2^n can be done by adding n
to the exponent.

Unfortunately, (y-n*^.2) involves subtracting nearly equal quantities,
which leads to loss of precision.  In particular, ^.2 has to be
calculated to greater precision than the result.  This is commonly not
done carefully, and results are not reliable.  I leave it to the
reader to show that ^100 in J (and most languages) does not have full
precision.

Best wishes,

John


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to