Floating point exceptions

Andrew Koenig ark at alice.UUCP
Sun Aug 5 00:18:29 AEST 1990


In article <446 at demott.COM>, kdq at demott.COM (Kevin D. Quitt) writes:

>     I need to be able to examine an IEEE double to see if it is anything
> but a number (e.g. NAN) *before* I actually try to use it.

If your implementation is nice to you, you will have some library
function like isNaN().

If not, then you're supposed to be able to turn traps off and
(I think) check whether the number is equal to itself (!) --
I believe that all six relational operators are supposed to
return `false' if either operand is a NaN.  If you have a
signalling NaN, though, you'd better make sure you turn traps
off.
-- 
				--Andrew Koenig
				  ark at europa.att.com



More information about the Comp.lang.c mailing list