]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix misinformation about NaN != NaN comparison (GH-19357)
authorMark Dickinson <mdickinson@enthought.com>
Sun, 5 Apr 2020 09:25:24 +0000 (10:25 +0100)
committerGitHub <noreply@github.com>
Sun, 5 Apr 2020 09:25:24 +0000 (10:25 +0100)
Doc/reference/expressions.rst

index 16542cdcec1979f5c6112f37ea3bf03bdda21eb5..8036a491c29ab11266f3cf0cf0ab121b96fc0216 100644 (file)
@@ -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``,