aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Dickinson <mdickinson@enthought.com>2020-04-05 10:25:24 +0100
committerGitHub <noreply@github.com>2020-04-05 10:25:24 +0100
commit810f68f1282c917fc1ad6af540a9f08524dfe310 (patch)
tree43f8c2bf8be6e32f1e4bf3084280b0f923bedef2 /Doc/reference
parentbpo-40190: Add support for _SC_AIX_REALMEM in sysconf (GH-19380) (diff)
downloadcpython-810f68f1282c917fc1ad6af540a9f08524dfe310.tar.gz
cpython-810f68f1282c917fc1ad6af540a9f08524dfe310.tar.bz2
cpython-810f68f1282c917fc1ad6af540a9f08524dfe310.zip
Fix misinformation about NaN != NaN comparison (GH-19357)
Diffstat (limited to 'Doc/reference')
-rw-r--r--Doc/reference/expressions.rst5
1 files changed, 3 insertions, 2 deletions
diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst
index 16542cdcec1..8036a491c29 100644
--- a/Doc/reference/expressions.rst
+++ b/Doc/reference/expressions.rst
@@ -1422,8 +1422,9 @@ built-in types.
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.
+ themselves. For example, if ``x = float('NaN')``, ``3 < x``, ``x < 3`` and
+ ``x == x`` are all false, while ``x != x`` is true. This behavior is
+ compliant with IEEE 754.
* ``None`` and ``NotImplemented`` are singletons. :PEP:`8` advises that
comparisons for singletons should always be done with ``is`` or ``is not``,