New submission from Arnuld <lispyarn...@gmail.com>:

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

----------
assignee: docs@python
components: Documentation
files: Screenshot_2020-04-04 6 Expressions — Python 3 8 2 documentation.png
messages: 365742
nosy: ArnuldOnData, docs@python
priority: normal
severity: normal
status: open
title: Python Language Reference Documentation
type: enhancement
versions: Python 3.7, Python 3.8, Python 3.9
Added file: https://bugs.python.org/file49033/Screenshot_2020-04-04 6 
Expressions — Python 3 8 2 documentation.png

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40177>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to