[SciPy-user] Re: nan puzzle

Howey, David A d.howey at imperial.ac.uk
Wed Jul 27 10:57:25 CDT 2005

Just found this, thought it might be of interest-- gurus probably know this already, I wasn't aware:


From: scipy-user-bounces at scipy.net on behalf of Grant Edwards
Sent: Wed 13/07/2005 05:16
To: scipy-user at scipy.org
Subject: [SciPy-user] Re: nan puzzle

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
>>> y = 1.234
>>> x is y
>>> x == y

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??

SciPy-user mailing list
SciPy-user at scipy.net

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 5164 bytes
Desc: not available
Url : http://www.scipy.net/pipermail/scipy-user/attachments/20050727/71fdba84/attachment.bin

More information about the SciPy-user mailing list