Newsgroups: comp.lang.c Path: utzoo!henry From: henry@zoo.toronto.edu (Henry Spencer) Subject: Re: NaN's (was Re: FLOATING NULL?) Message-ID: <1991Jun2.005549.18303@zoo.toronto.edu> Date: Sun, 2 Jun 1991 00:55:49 GMT References: <13223@uhccux.uhcc.Hawaii.Edu> <1991May28.153655.24199@zoo.toronto.edu> <2726@root44.co.uk> <14@tdatirv.UUCP> <1991Jun1.214347.11696@zoo.toronto.edu> <24890@lanl.gov> Organization: U of Toronto Zoology In article <24890@lanl.gov> jlg@cochiti.lanl.gov (Jim Giles) writes: >|> [...] It is simply a fact that in IEEE floating point, x!=x >|> is sometimes true, and optimizing it to `false' is a compiler bug. > >I depends on how the `!=' operator is defined in C... Hmm, good point. >I can't find any specific reference in the ANSI C document which defines >which behaviour is appropriate. The ANSI/IEEE document Std 754-1985 >(IEEE Standard for Binary Floating-Point Numbers) _recommends_ that the >_Fortran_ operator .NE. should be defined as `?<>'... ANSI C doesn't touch the issue because C exists on many non-IEEE platforms and there didn't seem to be much prior art on which to base even an optional specification for an IEEEFP interface. (X3J11, unlike a lot of other standards committees, usually took "standardize existing practice, don't try to invent it" pretty seriously.) However, in the absence of anything more precise, I think we could take 754's advice on FORTRAN as relevant to C as well. The NCEG is attempting to come up with a consensus C->754 interface, I believe. -- "We're thinking about upgrading from | Henry Spencer @ U of Toronto Zoology SunOS 4.1.1 to SunOS 3.5." | henry@zoo.toronto.edu utzoo!henry