[Python-checkins] Fix misinformation about NaN != NaN comparison (GH-19357) (GH-19383)

Miss Islington (bot) webhook-mailer at python.org
Sun Apr 5 05:56:42 EDT 2020


https://github.com/python/cpython/commit/f7b0259d0d243a71d79a3fda9ec7aad4306513eb
commit: f7b0259d0d243a71d79a3fda9ec7aad4306513eb
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2020-04-05T10:56:37+01:00
summary:

Fix misinformation about NaN != NaN comparison (GH-19357) (GH-19383)

(cherry picked from commit 810f68f1282c917fc1ad6af540a9f08524dfe310)

Co-authored-by: Mark Dickinson <mdickinson at enthought.com>

files:
M Doc/reference/expressions.rst

diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst
index 16542cdcec197..8036a491c29ab 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``,



More information about the Python-checkins mailing list