nan question

Don Clugston dac at nospam.com.au
Tue Sep 25 23:41:23 PDT 2007


Nathan Reed wrote:
> bobef wrote:
>> Janice Caron Wrote:
>>
>>> On 9/25/07, bobef <bobef at abv_nospam.bg> wrote:
>>>> something is totally wrong. Just look at this. "!<>="
>>> Well consider, the imaginary number i is not less than one. It is also
>>> not greater than one. It is also not equal to one. It makes perfect
>>> sense.
>>
>> I can't imagine such number, sorry :) But let aside my imagination. I 
>> don't know what imaginary number is, so I am not commenting if it 
>> makes sense. All I'm saying it that it is nonsense that 
>> if(double.nan!=double.nan) returns false (IMHO).
> 
> I'm assuming you meant to say that it makes no sense if double.nan == 
> double.nan returns false?  But if NaNs compared equal to each other, 
> then this:
> 
> sqrt(-1) == acos(2)
> 
> would be true, since both return a NaN.  I bet you don't really want that.

Yup, that's the reasoning.
Even so, I think it probably was a mistake by the IEEE standard to violate
x == x; I think the problems created by this decision are worse than the ones 
that were solved. (Note that they could even have used NaN payloads to detect 
the worst kinds of errors).

But it's built into the hardware everywhere, so it's Too Late Now.



More information about the Digitalmars-d mailing list