Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: NaNs are true

by PeterPeiGuo (Hermit)
on Feb 26, 2011 at 17:40 UTC ( [id://890324] : note . print w/replies, xml ) Need Help??


in reply to NaNs are true

For example, the square root of -1 is supposed to be nan, since it cannot be precisely represented (within the domain of real numbers). However sqrt(-1) is not 0. It makes a lot more sense to treat i (which is a non-zero number in an extended domain) as true than false.

Peter (Guo) Pei

Replies are listed 'Best First'.
Re^2: NaNs are true
by syphilis (Archbishop) on Feb 27, 2011 at 01:44 UTC
    Yes, there might be something in what you say that supports having NaNs evaluate as "true" in the boolean sense - but I don't think there's any compelling argument there (and I'm a bit suspicious of the way you move about between the real and complex fields :-)

    I personally don't have an issue with sqrt(-1) being "false" in the real field && "true" in the complex field.

    Cheers,
    Rob