* IEEE standard 854-1987, `Unofficial IEEE 854 Text

<http://www.cs.berkeley.edu/~ejr/projects/754/private/drafts/854-1987/dir.html>`_.

-.. %~~ ~~%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

+.. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

the program manipulates the data no differently than with other Python numeric

-.. %~~ ~~%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

+.. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

.. class:: Decimal([value [, context]])

- Construct~~s~~ a new :class:`Decimal` object based from *value*.

+ Construct a new :class:`Decimal` object based from *value*.

*value* can be an integer, string, tuple, or another :class:`Decimal` object. If

no *value* is given, returns ``Decimal("0")``. If *value* is a string, it

correctly rounded using the :const:`ROUND_HALF_EVEN` rounding mode.

-.. method:~~ ~~ Decimal.logb([context])

+.. method:: Decimal.logb([context])

For a nonzero number, return the adjusted exponent of its operand

as a :class:`Decimal` instance. If the operand is a zero then

.. method:: Decimal.quantize(exp[, rounding[, context[, watchexp]]])

- Return~~s~~ a value equal to the first operand after rounding and

+ Return a value equal to the first operand after rounding and

having the exponent of the second operand.

>>> Decimal("1.41421356").quantize(Decimal("1.000"))

the given ``context`` argument; if neither argument is given the

rounding mode of the current thread's context is used.

- If watchexp is set (default), then an error is returned whenever

- the resulting exponent is greater than Emax or less than Etiny.

+ If *watchexp* is set (default), then an error is returned whenever the

+ resulting exponent is greater than :attr:`Emax` or less than :attr:`Etiny`.

.. method:: Decimal.radix()

.. method:: Decimal.remainder_near(other[, context])

- Compute~~s~~ the modulo as either a positive or negative value depending on which is

+ Compute the modulo as either a positive or negative value depending on which is

closest to zero. For instance, ``Decimal(10).remainder_near(6)`` returns

``Decimal("-2")`` which is closer to zero than ``Decimal("4")``.

.. method:: Decimal.to_integral_exact([rounding[, context]])

- Round ~~the argument ~~to the nearest integer, signaling

+ Round to the nearest integer, signaling

:const:`Inexact` or :const:`Rounded` as appropriate if rounding

occurs. The rounding mode is determined by the ``rounding``

parameter if given, else by the given ``context``. If neither

.. method:: Decimal.to_integral_value([rounding[, context]])

- Round~~s~~ to the nearest integer without signaling :const:`Inexact` or

+ Round to the nearest integer without signaling :const:`Inexact` or

:const:`Rounded`. If given, applies *rounding*; otherwise, uses the rounding

method in either the supplied *context* or the current context.

.. method:: Decimal.trim()

- Return~~s its argument~~ with *insignificant* trailing zeros removed.

+ Return the decimal with *insignificant* trailing zeros removed.

Here, a trailing zero is considered insignificant either if it

follows the decimal point, or if the exponent of the argument (that

is, the last element of the :meth:`as_tuple` representation) is

exponent and sign are both zero, and whose digits are all either

:const:`0` or :const:`1`.

-.. %~~ ~~%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

+.. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Converts a number to a string using scientific notation.

-.. %~~ ~~%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

+.. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

-.. %~~ ~~%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

+.. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

>>> 1 / Decimal('Infinity')

-.. %~~ ~~%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

+.. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

-.. %~~ ~~%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

+.. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

-.. %~~ ~~%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

+.. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%