No subject

uunet!research.att.com!dmg uunet!research.att.com!dmg
Sat Nov 20 07:32:00 PST 1993


to- Ronald F. Guilmette (uunet.UU.NET!uunet!netcom.com!segfault!rfg ncegacray.com)
from- David M. Gay

> Is it required that the
> following code
>
>  double y=some_value;
>  double x=y;
>  if(x ==y)
>    cout<<"TRUE";
> 
> always prints TRUE?

No, for at least two reasons.  First, some_value might be a NaN.
Second, the compiler may choose to keep y in an extended-precision
register but store x to memory.  (I've been bitten by this second
situation.  I'd be delighted to have a persuasive argument that
it violates ANSI C.)

-- dmg



More information about the Numeric-interest mailing list