[std-interval] detecting NaN

Alan Eliasen eliasen at mindspring.com
Tue Jun 6 00:40:01 PDT 2006


Alan Eliasen wrote:
>> So, again, without lack of evidence to the contrary, I stand by my
>> assertion that isnan() is the only standard function available to
>> detect if a number is a NaN or not, and it can't distinguish
>> between quiet and signaling NaNs.

Lee Winter wrote:
> Do you not like the use of fpclassify() to detect NaNs?  On x86
> platforms there is hardware support for classification based on the
> fxam instruction.

   Thanks; I was not aware of fpclassify, only the boolean conditions
like isnan().  It appears from the documentation in gcc 4.1.1 that
isnan() "returns a non-zero value if (fpclassify(x) == FP_NAN)", so one
is simply defined in terms of the other, and confers no clear advantages
when testing for NaN.

   Still, it doesn't affect my point that there isn't a standardized
function to distinguish between quiet and signaling NaNs, other than
working directly with the bit patterns as I noted in my first posting on
the subject.

-- 
  Alan Eliasen                 |  "When trouble is solved before it
  eliasen at mindspring.com       |    forms, who calls that clever?"
  http://futureboy.us/         |              --Sun Tzu


More information about the Std-interval mailing list