diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2008-02-07 01:42:06 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2008-02-07 01:42:06 (GMT) |
commit | 00c2e65850cb48e6d17afdd8e9d210b48e0d3ce5 (patch) | |
tree | 14a22490b7c5947150e3baaa2e3b42cbf16a5902 /Doc | |
parent | ff6672fda185624955ac322540935dbd5ed420e1 (diff) | |
download | cpython-00c2e65850cb48e6d17afdd8e9d210b48e0d3ce5.zip cpython-00c2e65850cb48e6d17afdd8e9d210b48e0d3ce5.tar.gz cpython-00c2e65850cb48e6d17afdd8e9d210b48e0d3ce5.tar.bz2 |
IEEE 754 should be IEEE 854; give precise reference for
comparisons involving NaNs.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/decimal.rst | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Doc/library/decimal.rst b/Doc/library/decimal.rst index 89857f0..7bf4494 100644 --- a/Doc/library/decimal.rst +++ b/Doc/library/decimal.rst @@ -1295,12 +1295,12 @@ The behavior of Python's comparison operators can be a little surprising where a quiet or signaling :const:`NaN` always returns :const:`False` (even when doing ``Decimal('NaN')==Decimal('NaN')``), while a test for inequality always returns :const:`True`. An attempt to compare two Decimals using any of the ``<``, -``<=``, ``>`` or ``>=`` operators will raise the -:exc:`InvalidOperation` signal if either operand is a :const:`NaN`, and return -:const:`False` if this signal is trapped. Note that the General Decimal -Arithmetic specification does not specify the behavior of direct comparisons; -these rules for comparisons involving a :const:`NaN` were taken from the IEEE -754 standard. To ensure strict standards-compliance, use the :meth:`compare` +``<=``, ``>`` or ``>=`` operators will raise the :exc:`InvalidOperation` signal +if either operand is a :const:`NaN`, and return :const:`False` if this signal is +trapped. Note that the General Decimal Arithmetic specification does not +specify the behavior of direct comparisons; these rules for comparisons +involving a :const:`NaN` were taken from the IEEE 854 standard (see Table 3 in +section 5.7). To ensure strict standards-compliance, use the :meth:`compare` and :meth:`compare-signal` methods instead. The signed zeros can result from calculations that underflow. They keep the sign |