Damian Conway wrote:

>    > 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.
>
> But 'cat'=='dog' *is* true. Numerically, they *are* equal.
> They are equally not numbers.  One should certainly get a warning
> (and one will if warnings are enabled), but this
> expression shouldn't return false.

OK, now I see your point even better. The difference in our points is
that I suggested that numerical comparison of NaNs shouldn't make sense.
But yes, two NaNs are equally not numbers. Now the question is if being
a NaN should be the special case of numerical meaning or the lack of any
numerical meaning. I don't think that the one idea is more correct than
another, maybe that's the matter of taste, however they are mutually
exclusive, so one of them has to be chosen. I joined this thread,
because I thought that assuming that NaN!=NaN idea is just ugly and thus
not worth deeper discussion, was oversimplifying and the problem
deserves a little more of controversy. However I wasn't suspecting that
NaN semantics will grow to one of the most important threads here.

> Sigh. I *do* see your point of view (Laziness), but I still have immense
> difficulty with the notion that:
>
>         $x == NaN
>
> doesn't return true if $x contains NaN.

Well, Laziness is very important to me, but here it won't be hurt much,
as in fact $x==$y!=NaN wouldn't be used very often. Only when
numerically comparing two unknown values, and I can't remember when I
did it last time. Maybe when sorting but with sorting it doesn't matter
if every NaN is equal or not. Hmmm, maybe NaN==NaN would make starship
operator simpler..? Anyway, even with NaN==NaN 'text'!=0, unlike Perl 5,
where 'text'==0, which could've been the main problem with == operator.

- RaFaL Pocztarski, [EMAIL PROTECTED]


Reply via email to