Issue #2531: Make float-to-decimal comparisons return correct results.
Float to decimal comparison operations now return a result based on
the numeric values of the operands. Decimal.__hash__ has also been
fixed so that Decimal and float values that compare equal have equal
hash value.
diff --git a/Doc/library/decimal.rst b/Doc/library/decimal.rst
index d8ce673..7c03b6a 100644
--- a/Doc/library/decimal.rst
+++ b/Doc/library/decimal.rst
@@ -364,6 +364,24 @@
compared, sorted, and coerced to another type (such as :class:`float` or
:class:`long`).
+ Decimal objects cannot generally be combined with floats in
+ arithmetic operations: an attempt to add a :class:`Decimal` to a
+ :class:`float`, for example, will raise a :exc:`TypeError`.
+ There's one exception to this rule: it's possible to use Python's
+ comparison operators to compare a :class:`float` instance ``x``
+ with a :class:`Decimal` instance ``y``. Without this exception,
+ comparisons between :class:`Decimal` and :class:`float` instances
+ would follow the general rules for comparing objects of different
+ types described in the :ref:`expressions` section of the reference
+ manual, leading to confusing results.
+
+ .. versionchanged:: 2.7
+ A comparison between a :class:`float` instance ``x`` and a
+ :class:`Decimal` instance ``y`` now returns a result based on
+ the values of ``x`` and ``y``. In earlier versions ``x < y``
+ returned the same (arbitrary) result for any :class:`Decimal`
+ instance ``x`` and any :class:`float` instance ``y``.
+
In addition to the standard numeric properties, decimal floating point
objects also have a number of specialized methods: