Useless sNaNs...
> Date: Fri, 15 Oct 2010 15:43:16 +0200
> From: Vincent Lefevre <vincent@xxxxxxxxxx>
> To: stds-1788 <stds-1788@xxxxxxxxxxxxxxxxx>
> Subject: Re: Question on performance
>
> On 2010-10-15 06:37:54 -0400, Michel Hack wrote:
> > Vincent Lef?vre a ?crit:
> > > ... It's strange that GCC doesn't replace isnan() by a test x != x
> >
> > Perhaps because these are NOT equivalent?
>
> I think they are on conforming code.
>
> > They differ for SNaN.
>
> sNaN is undefined behavior in ISO C99:
>
> F.2.1 Infinities, signed zeros, and NaNs
>
> This specification does not define the behavior of signaling NaNs.
>
> So, the transformation is OK.
>
> --
> Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.net/>
Yes, this is how the C people had to
deal with the ambiguity we were forced
to leave in 754 WRT NaN behavior.
Within broad limits, pretty much any
behavior is permitted.
It is one of the reasons NaNs are
effectively useless for expanding the
behavior of the number system in any
meaningful & reproducible way.
One major distinction between standards
& mathematics is that you often have to
make compromises to have a standard.
Dan