[SciPy-user] Re: nan puzzle

Grant Edwards grante at visi.com
Wed Jul 13 00:16:35 EDT 2005


On 2005-07-13, Alan G Isaac <aisaac at american.edu> wrote:

> Is this expected behavior?

>>>> x is nan
> True
>>>> x=z[2]
>>>> x
> -1.#IND
>>>> x is nan
> False

May I ask why you care?  

The expression "x is nan" seems pretty useless to me.  The "is"
operator isn't really useful for other floating point values,
why would it be useful for nans?

>>> x = 1.234
>>> x is 1.234
False
>>> 
>>> y = 1.234
>>> x is y
False
>>> x == y
True
>>> 

What you probably want to be checking is if x has a nan value,
not whether x is the same object as some other object that
has a nan value.

-- 
Grant Edwards                   grante             Yow!  Is this my STOP??
                                  at               
                               visi.com            




More information about the SciPy-User mailing list