HELP! Need Decent RS6000 Fortran Compiler!

Dik T. Winter dik at cwi.nl
Sat May 11 23:28:40 AEST 1991


In article <JKORPELA.91May10100448 at vipunen.hut.fi> jkorpela at vipunen.hut.fi (Jukka Korpela) writes:
 > - peculiarly, if you want to test within a program whether the value
 >   of X is NaN, X.NE.X seems to be the (undocumented) way; there are
 >   probably ways of detecting infinities as well
This is perfectly documented in the IEEE standard on floating point arithmetic!
To test for infinities try:
	(X-X).NE.(X-X)
(if X is an infinity, X-X is a NaN.)
another way:
	(1.0/X).EQ.0.0

 > - using the (documented, but poorly documented) routines FPGETS and
 >   FPSETS you can detect if floating-point errors have occurred
They probably extract the sticky IEEE flags.

 > - but you probably can't really trap them; even in C, you can't use
 >   the standardized tools; I tried to trap SIGFPE and the result is
 >   that a) 1.0/0.0 doesn't generate a trap, it simply produces INF,
 >   b) if I call fp_enable_all, 1.0/0.0 still doesn't generate a trap,
 >   but it produces 1.0 !!!
That is definitely a bug.  But you really do not want to trap them in the
RS6000.  According to my literature it is possible at the hardware level,
but it implies that all F-P operations will be serialized, which costs
you a lot of performance.

 > - errors in math routines (well, actually, more or less invalid args to
 >   them, like SQRT(-1.0) or EXP(1E30)) do not necessarily (usually?) set
 >   FPE flags on (understandable), so you can't use FPGETS to see if they;
 >   you CAN use matherr, but it's designed to be C callable, so you need
 >   a simple interface routine
SQRT must set the sticky bits according to IEEE.  IEEE does not talk about
EXP, but a honest implementation would also correctly set the bits.
--
dik t. winter, cwi, amsterdam, nederland
dik at cwi.nl



More information about the Comp.unix.aix mailing list