Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Doc/library/decimal.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1729,6 +1729,8 @@ condition.
0 ** 0
x ** (non-integer)
x ** Infinity
NaN >= 0
NaN < 0


.. class:: Overflow
Expand Down Expand Up @@ -1858,6 +1860,8 @@ expanding the precision sufficiently to avoid loss of significance:
Decimal('0.0060000')


.. _decimal-notes-specials:

Special values
^^^^^^^^^^^^^^

Expand Down
7 changes: 5 additions & 2 deletions Doc/reference/expressions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2129,12 +2129,15 @@ built-in types.
involved, they compare mathematically (algorithmically) correct without loss
of precision.

The not-a-number values ``float('NaN')`` and ``decimal.Decimal('NaN')`` are
The not-a-number floating-point numbers, like ``float('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`` and
``x == x`` are all false, while ``x != x`` is true. This behavior is
compliant with IEEE 754.
compliant with IEEE 754. Similar behavior holds for
:class:`decimal.Decimal`'s not-a-number values, like ``Decimal('NaN')``.
Refer to the :ref:`Special values <decimal-notes-specials>` section
of the :mod:`decimal` documentation.

* ``None`` and :data:`NotImplemented` are singletons. :PEP:`8` advises that
comparisons for singletons should always be done with ``is`` or ``is not``,
Expand Down
Loading