Author ArnuldOnData
Recipients ArnuldOnData, docs@python
Date 2020-04-04.03:36:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1585971365.58.0.193657354587.issue40177@roundup.psfhosted.org>
In-reply-to
Content
In section "6.10.1 Value comparisons", it is written:

https://docs.python.org/3/reference/expressions.html

"The not-a-number values float('NaN') and decimal.Decimal('NaN') are
special. Any ordered comparison of a number to a not-a-number value is
false. A counter-intuitive implication is that not-a-number values are
not equal to themselves. For example, if x = float('NaN'), 3 < x, x <
3, x == x, x != x are all false. This behavior is compliant with IEEE
754."

Last comparison "x != x" does not return False, it returns True. Here is the output from my iPython interpeter I am using on Arch Linux (latest as of today):

In [86]: x == y
Out[86]: False

In [87]: x != y
Out[87]: True


I verified the bug it on Wikipedia too:

https://en.wikipedia.org/wiki/NaN#Comparison_with_NaN
History
Date User Action Args
2020-04-04 03:36:05ArnuldOnDatasetrecipients: + ArnuldOnData, docs@python
2020-04-04 03:36:05ArnuldOnDatasetmessageid: <1585971365.58.0.193657354587.issue40177@roundup.psfhosted.org>
2020-04-04 03:36:05ArnuldOnDatalinkissue40177 messages
2020-04-04 03:36:05ArnuldOnDatacreate