From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Sun, 5 Apr 2020 09:57:05 +0000 (-0700) Subject: Fix misinformation about NaN != NaN comparison (GH-19357) (GH-19384) X-Git-Tag: v3.7.8rc1~104 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=44c1cdd53f5f782e7b0d0603a530ba331fa35b94;p=thirdparty%2FPython%2Fcpython.git Fix misinformation about NaN != NaN comparison (GH-19357) (GH-19384) (cherry picked from commit 810f68f1282c917fc1ad6af540a9f08524dfe310) Co-authored-by: Mark Dickinson --- diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst index 51e779c05368..3c14fc98d008 100644 --- a/Doc/reference/expressions.rst +++ b/Doc/reference/expressions.rst @@ -1420,8 +1420,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. * Binary sequences (instances of :class:`bytes` or :class:`bytearray`) can be compared within and across their types. They compare lexicographically using