in reply to NaNs are true

As far as I understand it, a NaN signals more or less an error condition or the value of an operation whose result is undefined.

If you subscribe to that understanding, then a NaN could be seen closer to undef than to a nonzero number, and because undef is false, so could be NaN.

On the other hand, we already have undef, and I'm not sure whether it makes sense to introduce another form of undef, the "numerical undef", and what can of worms that opens (if any). I'm reminded of SQL and its various (theoretical) incarnations of NULL that you'd need if you went beyond 3NF.

Replies are listed 'Best First'.
Re^2: NaNs are true
by syphilis (Archbishop) on Feb 26, 2011 at 14:37 UTC
    I'm mainly wondering whether someone might be astounded that I've overloaded 'bool' in such a way that the NaN value in a Math::MPFR object is false:
    "Whoa !! ... NaN is false ? Where the hell does that come from ? ... certainly not in perl or C !!"

    Probably not worth thinking too deeply about - most people won't know, and the rest won't care ;-)

    Cheers,
    Rob