NaN's (was Re: FLOATING NULL?)

Henry Spencer henry at zoo.toronto.edu
Sun Jun 2 10:55:49 AEST 1991


In article <24890 at lanl.gov> jlg at 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 at zoo.toronto.edu  utzoo!henry



More information about the Comp.lang.c mailing list