Re: Question on performance
On 2010-10-15 17:33:58 +0100, N.M. Maclaren wrote:
> On Oct 15 2010, Vincent Lefevre wrote:
> >What I meant is that isnan() and x != x can be seen as equivalent
> >even if __STDC_IEC_559__ is 1.
>
> Don't you mean 'is not'?
No. It seems clear that isnan() and x != x can be seen as equivalent
if __STDC_IEC_559__ is not 1, since on non-NaN values both are false,
and on NaN values, the behavior is implementation-dependent. So, an
implementation may specify its behavior so that they are equivalent.
However if __STDC_IEC_559__ is 1, one may think that isnan() and
x != x should not be seen as equivalent because of the different
behavior on sNaN. But sNaN can't be created in a conforming C
program. So, without anything more specified by the implementation,
the optimization is valid.
--
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)