encoding of a :class:`Decimal` instance is always canonical, so
this operation returns its argument unchanged.
- .. versionadded:: 2.6
.. method:: Decimal.compare(other[, context])
NaN then any quiet NaN operand is treated as though it were a
signaling NaN.
- .. versionadded:: 2.6
.. method:: Decimal.compare_total(other)
than the second operand. See the specification for details of the
total order.
- .. versionadded:: 2.6
.. method:: Decimal.compare_total_mag(other)
of each operand. ``x.compare_total_mag(y)`` is equivalent to
``x.copy_abs().compare_total(y.copy_abs())``.
- .. versionadded:: 2.6
.. method:: Decimal.copy_abs()
unaffected by the context and is quiet: no flags are changed and no
rounding is performed.
- .. versionadded:: 2.6
.. method:: Decimal.copy_negate()
by the context and is quiet: no flags are changed and no rounding
is performed.
- .. versionadded:: 2.6
.. method:: Decimal.copy_sign(other)
This operation is unaffected by the context and is quiet: no flags
are changed and no rounding is performed.
- .. versionadded:: 2.6
.. method:: Decimal.exp([context])
>>> Decimal(321).exp()
Decimal("2.561702493119680037517373933E+139")
- .. versionadded:: 2.6
.. method:: Decimal.fma(other, third[, context])
>>> Decimal(2).fma(3, 5)
Decimal("11")
- .. versionadded:: 2.6
.. method:: Decimal.is_canonical()
is always canonical, so this operation always returns
:const:`True`.
- .. versionadded:: 2.6
.. method:: is_finite()
Return :const:`True` if the argument is a finite number, and
:const:`False` if the argument is an infinity or a NaN.
- .. versionadded:: 2.6
.. method:: is_infinite()
Return :const:`True` if the argument is either positive or
negative infinity and :const:`False` otherwise.
- .. versionadded:: 2.6
.. method:: is_nan()
Return :const:`True` if the argument is a (quiet or signaling)
NaN and :const:`False` otherwise.
- .. versionadded:: 2.6
.. method:: is_normal()
Return :const:`False` if the argument is zero, subnormal, infinite
or a NaN.
- .. versionadded:: 2.6
.. method:: is_qnan()
Return :const:`True` if the argument is a quiet NaN, and
:const:`False` otherwise.
- .. versionadded:: 2.6
.. method:: is_signed()
:const:`False` otherwise. Note that zeros and NaNs can both carry
signs.
- .. versionadded:: 2.6
.. method:: is_snan()
Return :const:`True` if the argument is a signaling NaN and
:const:`False` otherwise.
- .. versionadded:: 2.6
.. method:: is_subnormal()
Return :const:`True` if the argument is subnormal, and
:const:`False` otherwise.
- .. versionadded:: 2.6
.. method:: is_zero()
Return :const:`True` if the argument is a (positive or negative)
zero and :const:`False` otherwise.
- .. versionadded:: 2.6
.. method:: Decimal.ln([context])
is correctly rounded using the :const:`ROUND_HALF_EVEN` rounding
mode.
- .. versionadded:: 2.6
.. method:: Decimal.log10([context])
Return the base ten logarithm of the operand. The result is
correctly rounded using the :const:`ROUND_HALF_EVEN` rounding mode.
- .. versionadded:: 2.6
.. method: Decimal.logb([context])
:const:`DivisionByZero` flag is raised. If the operand is an
infinity then ``Decimal("Infinity")`` is returned.
- .. versionadded:: 2.6
.. method:: Decimal.logical_and(other[, context])
*logical operands* (see :ref:`logical_operands_label`). The result
is the digit-wise ``and`` of the two operands.
- .. versionadded:: 2.6
.. method:: Decimal.logical_invert(other[, context])
be a *logical operand* (see :ref:`logical_operands_label`). The
result is the digit-wise inversion of the operand.
- .. versionadded:: 2.6
.. method:: Decimal.logical_or(other[, context])
operands* (see :ref:`logical_operands_label`). The result is the
digit-wise ``or`` of the two operands.
- .. versionadded:: 2.6
.. method:: Decimal.logical_xor(other[, context])
*logical operands* (see :ref:`logical_operands_label`). The result
is the digit-wise exclusive or of the two operands.
- .. versionadded:: 2.6
.. method:: Decimal.max(other[, context])
before returning and that :const:`NaN` values are either signaled or ignored
(depending on the context and whether they are signaling or quiet).
+
.. method:: Decimal.max_mag(other[, context])
Similar to the :meth:`max` method, but the comparison is done using
the absolute values of the operands.
- .. versionadded:: 2.6
.. method:: Decimal.min(other[, context])
Similar to the :meth:`min` method, but the comparison is done using
the absolute values of the operands.
- .. versionadded:: 2.6
.. method:: Decimal.next_minus([context])
in the current thread's context if no context is given) that is smaller
than the given operand.
- .. versionadded:: 2.6
.. method:: Decimal.next_plus([context])
in the current thread's context if no context is given) that is
larger than the given operand.
- .. versionadded:: 2.6
.. method:: Decimal.next_toward(other[, context])
operands are numerically equal, return a copy of the first operand
with the sign set to be the same as the sign of the second operand.
- .. versionadded:: 2.6
.. method:: Decimal.normalize([context])
``Decimal("32.100")`` and ``Decimal("0.321000e+2")`` both normalize to the
equivalent value ``Decimal("32.1")``.
+
.. method:: Decimal.number_class([context])
Return a string describing the *class* of the operand. The
* ``"NaN"``, indicating that the operand is a quiet NaN (Not a Number).
* ``"sNaN"``, indicating that the operand is a signaling NaN.
- .. versionadded:: 2.6
.. method:: Decimal.quantize(exp[, rounding[, context[, watchexp]]])
:class:`Decimal` class does all its arithmetic. Included for
compatibility with the specification.
- .. versionadded:: 2.6
.. method:: Decimal.remainder_near(other[, context])
if necessary. The sign and exponent of the first operand are
unchanged.
- .. versionadded:: 2.6
.. method:: Decimal.same_quantum(other[, context])
Equivalently, return the first operand multiplied by ``10**other``.
The second operand must be an integer.
- .. versionadded:: 2.6
.. method:: Decimal.shift(other[, context])
coefficient are zeros. The sign and exponent of the first operand
are unchanged.
- .. versionadded:: 2.6
.. method:: Decimal.sqrt([context])
parameter is given then the rounding mode of the current context is
used.
- .. versionadded:: 2.6
.. method:: Decimal.to_integral_value([rounding[, context]])
:const:`Rounded`. If given, applies *rounding*; otherwise, uses the rounding
method in either the supplied *context* or the current context.
- .. versionchanged:: 2.6
- renamed from ``to_integral`` to ``to_integral_value``. The old name
- remains valid for compatibility.
.. method:: Decimal.trim()
is, the last element of the :meth:`as_tuple` representation) is
positive.
- .. versionadded:: 2.6
.. _logical_operands_label:
:const:`1`, exponents are printed with a capital :const:`E`; otherwise, a
lowercase :const:`e` is used: :const:`Decimal('6.02e+23')`.
- .. versionchanged:: 2.6
- The :const:`ROUND_05UP` rounding mode was added.
The :class:`Context` class defines several general purpose methods as
well as a large number of methods for doing arithmetic directly in a
modulo`` with unbounded precision, but is computed more
efficiently. It is always exact.
- .. versionchanged:: 2.6
- ``y`` may now be nonintegral in ``x**y``.
- Stricter requirements for the three-argument version.
-
.. method:: Context.remainder(x, y)