Thread Links Date Links
Thread Prev Thread Next Thread Index Date Prev Date Next Date Index

Re: Question on performance



On 2010-10-15 10:02:34 -0400, Michel Hack wrote:
> Perhaps so, but 754-2008 is clear, and suggests that "!=" be QuietNotEqual,
> which is Quiet only for QNaNs.  SNaNs must set Invalid in ANY comparison;
> only certain operations, such as Copy, and explicit category predicates
> such as isNan(), can be totally silent.

OK. But now, GCC doesn't support signaling NaNs by default, so that
the optimization of isnan() to != would be valid.

`-fsignaling-nans'
     Compile code assuming that IEEE signaling NaNs may generate
     user-visible traps during floating-point operations.  Setting this
     option disables optimizations that may change the number of
     exceptions visible with signaling NaNs.  This option implies
     `-ftrapping-math'.

     This option causes the preprocessor macro `__SUPPORT_SNAN__' to be
     defined.

     The default is `-fno-signaling-nans'.

     This option is experimental and does not currently guarantee to
     disable all GCC optimizations that affect signaling NaN behavior.

> Even if "!=" were SignallingNotEqual (which is indeed up to Language
> standards -- 754-2008 only recommends a choice) there would be a
> difference, because isNaN() MUST be quiet.

on conforming code only.

-- 
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)