NaN's (was Re: FLOATING NULL?)
Geoff Clare
gwc at root.co.uk
Fri May 31 03:18:13 AEST 1991
henry at zoo.toronto.edu (Henry Spencer) writes:
> If you are willing to constrain your code to run on machines using
>IEEE floating point, you could use a NaN value... but there is no standard
>way of generating such a value or testing for it.
I agree there is no standard way of generating NaN (although sqrt(-1.0)
is your best bet). However, there is a standard way of testing for NaN.
If x is a floating point variable, then (x != x) will be TRUE if and
only if x has the value NaN.
--
Geoff Clare <gwc at root.co.uk> (Dumb American mailers: ...!uunet!root.co.uk!gwc)
UniSoft Limited, London, England. Tel: +44 71 729 3773 Fax: +44 71 729 3273
More information about the Comp.lang.c
mailing list