Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!zaphod.mps.ohio-state.edu!wuarchive!uunet!mcsun!ukc!pyrltd!root44!gwc From: gwc@root.co.uk (Geoff Clare) Newsgroups: comp.lang.c Subject: NaN's (was Re: FLOATING NULL?) Message-ID: <2726@root44.co.uk> Date: 30 May 91 17:18:13 GMT References: <13223@uhccux.uhcc.Hawaii.Edu> <1991May28.153655.24199@zoo.toronto.edu> Organization: UniSoft Ltd., London, England Lines: 13 henry@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 (Dumb American mailers: ...!uunet!root.co.uk!gwc) UniSoft Limited, London, England. Tel: +44 71 729 3773 Fax: +44 71 729 3273