develooper Front page | perl.perl6.language | Postings from October 2001

Re: NaN semantics

Thread Previous | Thread Next
RaFaL Pocztarski
October 8, 2001 05:53
Re: NaN semantics
Message ID:
Damian Conway wrote:

> RaFaL asked:
>    > So OK, tell me if I get it right, and how (and why) it will look in Perl
>    > 6. From Exegesis I see that NaN==NaN, but that's not stated in
>    > Apocalypse (or I just missed it).
> No, it's not stated there. But I hope that Perl 6 will follow the lead of
> other high level languages and reject the non-identity of NaN.

OK, I see what's your point (from your answer to Piers).

I don't like NaN==NaN returning true for practical reasons (I'm to lazy
to type $x==$y!=NaN when I could just $x==$y). I personally would like
NaN to return undef (not plain false) in any numerical comparison (so
also NaN==NaN would return undef).

I think that we don't agree because I see == operator as numerical
comparison, not just comparison. If it was just comparison then of
course I agree that anything compared to itself should return true, it
wouldn't make sense otherwise.

But I assume that == means numerically equal (and here I could be
wrong). If what I assume is true however, then anything which doesn't
have any numerical meaning, numerically compared to anything (even to
itself) should not return the misleading result that the two compared
values are numerically equal.

Then again, if you tell me that == operator doesn't mean "numerically
equal", I will agree that NaN==NaN should be true even considering that
'cat'=='dog' will also be true.

I know that == is also used for comparing references but they have
numerical meaning.

So please tell me if I'm wrong assuming that == operator means numerical

- RaFaL Pocztarski,

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About