[issue28579] nan != nan

Liam Marsh report at bugs.python.org
Tue Nov 1 11:00:37 EDT 2016


New submission from Liam Marsh:

I found a really weird comportment with NANs:

>>> from math import nan, isnan, inf
>>> nan==nan
False
>>> nan!=nan
True
>>> a=nan  # maybe get another instance would fix it (or so I thought)
>>> a==nan
False
>>> a==a
False
>>> a is a  
True
>>> # because `is` works, it could be a
>>> # deliberate comportment. is it?
>>> a is nan
True
>>> isnan(a) and isnan(nan)
True
>>> nan == -nan
False
>>> nan is -nan
False
>>> a < 1
False
>>> a > 0
False
>>> a < inf
False
>>> b=external_pyd_call_that_returns_nan()
>>> isnan(b)
True
>>> b == nan
False

that sums what I tried up.

thanks for reading this.

----------
messages: 279878
nosy: niacdoial
priority: normal
severity: normal
status: open
title: nan != nan
type: behavior
versions: Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28579>
_______________________________________


More information about the Python-bugs-list mailing list