in reply to Re^3: NaNs are true (NaN == 0 -> true? Really?)
in thread NaNs are true
I think all of those are correct, though not particularly useful. They should also prompt (at least) a warning, though I think a catchable exception is better.
You also have to be careful to distinguish between a variable containing NaN, and a constant NaN I think.
That is, I think the only time any comparison involving a variable containg NaN should result in a true value, is if it is compared against a predefined constant NaN; were one to be provided. Though an isNaN( $x ) function or equivalenly $x->isNan() method would serve the same purpose and be less likely to confuse.
|
|---|