exp(large numbers) on IRIS
John D. McCalpin
mccalpin at MASIG1.OCEAN.FSU.EDU
Fri Jul 8 03:56:09 AEST 1988
Silicon Graphics has known about the pathetic behavior of the exp
function for a long time, but they do not seem at all interested in
doing anything about it.... As I understand it, they bought the
compiler from Silicon Valley Software, and did an in-house rewrite of
the intrinsic transcendental functions.
The behaviour can be modified (though not corrected) by initializing
the floating-point exception handler. You will need to add the
following lines to the example code:
#include <fortfpe.h> ! somewhere in declarations
call setfpe (NOCOREDUMP, ZEROVALS) ! first executable statement
This makes MOST underflows go gently to zero, but it does not
fix the exp() problem. I don't know why the floating-point exception
handler is not active by default....
I have to uses a fix to the exp() problem, I use
x = min(x,88.0)
x = max(-88.0,x)
result=exp(x)
or, in one line:
result = exp(max(-88.0,min(x,88.0)))
The constant 88.0 is the largest value which returns a correct result
with 32-bit precision. I can't recall the number for 64-bit precision
--- I think it is about 300.
Now that the 4D's are the SGI's main interest, I would not count on
getting any improvements to the SVS Fortran on the IRIS 3000's....
especially since they did not respond when the IRIS 3000 was their
only entry. I suggest that you try a SUN machine. They have troubles,
but at least the Fortran numerics are quite robust.
John D. McCalpin
mccalpin at nu.cs.fsu.edu
More information about the Comp.sys.sgi
mailing list