[Fwd: Re: [std-interval] Interval comparison operators]
Alan Eliasen
eliasen at mindspring.com
Mon Jun 5 16:13:54 PDT 2006
> On Jun 1, 2006, at 3:25 AM, Alan Eliasen wrote:
>
>> I know of no portable functions other than std::isnan()
>> (defined in cmath) which simply detects if it's a NaN or not, so you
>> shouldn't even expect to differentiate between these two.
Hervé Brönnimann wrote:
> FWIW, std::numeric_limits<T> has members has_quiet_NaN and
> has_signaling_NaN along with quiet_NaN and signaling_NaN. What you can
> expect is to differentiate between them IF your platform supports them
> (and the numeric_limits given by your system is accurate for the
> platform, as it should).
If the implementations I've looked at are proper, has_quiet_NaN and
has_signaling_NaN are only boolean fields (not functions!) which only
tell you if a particular numeric type (e.g. double or int) has a special
value which could represent those NaNs. They tell you nothing about
whether a particular number *is* a NaN of either type.
In, say, gcc 4.1.1, has_signaling_NaN is simply defined as:
static const bool has_signaling_NaN = has_quiet_NaN;
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.
--
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