AlkantarClanX12

Your IP : 52.14.209.100


Current Path : /proc/thread-self/root/opt/alt/python33/lib64/python3.3/__pycache__/
Upload File :
Current File : //proc/thread-self/root/opt/alt/python33/lib64/python3.3/__pycache__/decimal.cpython-33.pyo

�
��f�|c+@scdZddddddddd	d
ddd
ddddddddddddddddddgZd Zd!Zd"d#lZd"d#lZd"d#lZ	d"d#l
Z
y#d"d$lmZ
e
d%d&�ZWnek
r�d'd(�ZYnXdZdZdZdZdZdZdZdZeZe
jd)d*d+krLd,Zd,Zd,Znd-Zd-Zd-Zeed+ZGd.d�de�Z Gd/d�de �Z!Gd0d�de �Z"Gd1d2�d2e"�Z#Gd3d	�d	e e$�Z%Gd4d5�d5e"�Z&Gd6d7�d7e"e$�Z'Gd8d
�d
e �Z(Gd9d:�d:e"�Z)Gd;d�de �Z*Gd<d�de �Z+Gd=d
�d
e(e*�Z,Gd>d�de(e*e+�Z-Gd?d�de e.�Z/e!e%e(e,e*e-e"e+e/g	Z0ie"e#6e"e&6e"e'6e"e)6Z1eeeeeeeefZ2yd"d#l3Z3Wn4ek
rZGd@dA�dAe4�Z5e5�Z3[5YnXye3j6WnNe7k
r�e8e3j9�dB�r�e3j9�`:ndCd�Z;dDd�Z<YnIXe3j6�Z6e8e6dB�r�e6`:ne6dEd�Z<e6dFd�Z;[3[6e=dGd�Z>GdHd�de4�Z?e@dIdJ�ZAe	jBjCe?�GdKdL�dLe4�ZDGdMd�de4�ZEGdNdO�dOe4�ZFd"dPdQ�ZGeHjIZJdRdS�ZKdTdU�ZLdVdW�ZMdXdY�ZNdZd[d\�ZOd]d^�ZPd_d`�ZQGdadb�dbe4�ZReR�jSZTdZdcdd�ZUdedf�ZVdgdh�ZWi	didj6dkdl6dmdn6dodp6dqdr6dsdt6dudv6dwdx6dydz6d{d|�ZXe@e@d}d~�ZYe@dd��ZZeEd�d�d�ed�e%e,e"gd�gd�d�d�d�d�d+d�d"�Z[eEd�d�d�ed�e%e,e"e!e-gd�g�Z\eEd�d�d�ed�gd�g�Z]d"d#l^Z^e^j_d�e^j`e^jaB�jbZce^j_d��jbZde^j_d��jbZee^j_d�e^j`e^jfB�Zg[^yd"d#lhZiWnek
r�YnXe=d�d��Zjd�d��Zkd�d��Zld+d�d��Zmd�d��Znd�d��Zoe?d��Zpe?d��Zqe?d��Zre?d"�Zse?d+�Zte?d+�ZuepeqfZve
jwjxZye
jwjzZ{e
jwj|Z}e~dweyd)ey�Z[
yd"d#l�Z�Wnek
r�YnTXe�e���Z�e�e�e���Z�xe�e�D]Z�e��e�=qW[�[�[�d"d�l�Te�d�kr_d"d#l�Z�d"d#l�Z�e�j�e��nd#S(�u�	
This is an implementation of decimal floating point arithmetic based on
the General Decimal Arithmetic Specification:

    http://speleotrove.com/decimal/decarith.html

and IEEE standard 854-1987:

    http://en.wikipedia.org/wiki/IEEE_854-1987

Decimal floating point has finite precision with arbitrarily large bounds.

The purpose of this module is to support arithmetic using familiar
"schoolhouse" rules and to avoid some of the tricky representation
issues associated with binary floating point.  The package is especially
useful for financial applications or for contexts where users have
expectations that are at odds with binary floating point (for instance,
in binary floating point, 1.00 % 0.1 gives 0.09999999999999995 instead
of 0.0; Decimal('1.00') % Decimal('0.1') returns the expected
Decimal('0.00')).

Here are some examples of using the decimal module:

>>> from decimal import *
>>> setcontext(ExtendedContext)
>>> Decimal(0)
Decimal('0')
>>> Decimal('1')
Decimal('1')
>>> Decimal('-.0123')
Decimal('-0.0123')
>>> Decimal(123456)
Decimal('123456')
>>> Decimal('123.45e12345678')
Decimal('1.2345E+12345680')
>>> Decimal('1.33') + Decimal('1.27')
Decimal('2.60')
>>> Decimal('12.34') + Decimal('3.87') - Decimal('18.41')
Decimal('-2.20')
>>> dig = Decimal(1)
>>> print(dig / Decimal(3))
0.333333333
>>> getcontext().prec = 18
>>> print(dig / Decimal(3))
0.333333333333333333
>>> print(dig.sqrt())
1
>>> print(Decimal(3).sqrt())
1.73205080756887729
>>> print(Decimal(3) ** 123)
4.85192780976896427E+58
>>> inf = Decimal(1) / Decimal(0)
>>> print(inf)
Infinity
>>> neginf = Decimal(-1) / Decimal(0)
>>> print(neginf)
-Infinity
>>> print(neginf + inf)
NaN
>>> print(neginf * inf)
-Infinity
>>> print(dig / 0)
Infinity
>>> getcontext().traps[DivisionByZero] = 1
>>> print(dig / 0)
Traceback (most recent call last):
  ...
  ...
  ...
decimal.DivisionByZero: x / 0
>>> c = Context()
>>> c.traps[InvalidOperation] = 0
>>> print(c.flags[InvalidOperation])
0
>>> c.divide(Decimal(0), Decimal(0))
Decimal('NaN')
>>> c.traps[InvalidOperation] = 1
>>> print(c.flags[InvalidOperation])
1
>>> c.flags[InvalidOperation] = 0
>>> print(c.flags[InvalidOperation])
0
>>> print(c.divide(Decimal(0), Decimal(0)))
Traceback (most recent call last):
  ...
  ...
  ...
decimal.InvalidOperation: 0 / 0
>>> print(c.flags[InvalidOperation])
1
>>> c.flags[InvalidOperation] = 0
>>> c.traps[InvalidOperation] = 0
>>> print(c.divide(Decimal(0), Decimal(0)))
NaN
>>> print(c.flags[InvalidOperation])
1
>>>
uDecimaluContextuDefaultContextuBasicContextuExtendedContextuDecimalExceptionuClampeduInvalidOperationuDivisionByZerouInexactuRoundedu	SubnormaluOverflowu	UnderflowuFloatOperationu
ROUND_DOWNu
ROUND_HALF_UPuROUND_HALF_EVENu
ROUND_CEILINGuROUND_FLOORuROUND_UPuROUND_HALF_DOWNu
ROUND_05UPu
setcontextu
getcontextulocalcontextuMAX_PRECuMAX_EMAXuMIN_EMINu	MIN_ETINYuHAVE_THREADSu1.70u2.4.0iN(u
namedtupleuDecimalTupleusign digits exponentcGs|S(N((uargs((u,/opt/alt/python33/lib64/python3.3/decimal.pyu<lambda>�su<lambda>ii?il��N�Zoi@�TcBs&|EeZdZdZdd�ZdS(uDecimalExceptionu1Base exception class.

    Used exceptions derive from this.
    If an exception derives from another exception besides this (such as
    Underflow (Inexact, Rounded, Subnormal) that indicates that it is only
    called if the others are present.  This isn't actually used for
    anything, though.

    handle  -- Called when context._raise_error is called and the
               trap_enabler is not set.  First argument is self, second is the
               context.  More arguments can be given, those being after
               the explanation in _raise_error (For example,
               context._raise_error(NewError, '(-x)!', self._sign) would
               call NewError().handle(context, self._sign).)

    To define a new exception, it should be sufficient to have it derive
    from DecimalException.
    cGsdS(N((uselfucontextuargs((u,/opt/alt/python33/lib64/python3.3/decimal.pyuhandle�suDecimalException.handleN(u__name__u
__module__u__qualname__u__doc__uhandle(u
__locals__((u,/opt/alt/python33/lib64/python3.3/decimal.pyuDecimalException�scBs|EeZdZdZdS(uClampedu)Exponent of a 0 changed to fit bounds.

    This occurs and signals clamped if the exponent of a result has been
    altered in order to fit the constraints of a specific concrete
    representation.  This may occur when the exponent of a zero result would
    be outside the bounds of a representation, or when a large normal
    number would have an encoded exponent that cannot be represented.  In
    this latter case, the exponent is reduced to fit and the corresponding
    number of zero digits are appended to the coefficient ("fold-down").
    N(u__name__u
__module__u__qualname__u__doc__(u
__locals__((u,/opt/alt/python33/lib64/python3.3/decimal.pyuClamped�s
cBs&|EeZdZdZdd�ZdS(uInvalidOperationu0An invalid operation was performed.

    Various bad things cause this:

    Something creates a signaling NaN
    -INF + INF
    0 * (+-)INF
    (+-)INF / (+-)INF
    x % 0
    (+-)INF % x
    x._rescale( non-integer )
    sqrt(-x) , x > 0
    0 ** 0
    x ** (non-integer)
    x ** (+-)INF
    An operand is invalid

    The result of the operation after these is a quiet positive NaN,
    except when the cause is a signaling NaN, in which case the result is
    also a quiet NaN, but with the original sign, and an optional
    diagnostic information.
    cGs:|r6t|dj|djdd�}|j|�StS(NiunT(u_dec_from_tripleu_signu_intuTrueu_fix_nanu_NaN(uselfucontextuargsuans((u,/opt/alt/python33/lib64/python3.3/decimal.pyuhandle�s#
uInvalidOperation.handleN(u__name__u
__module__u__qualname__u__doc__uhandle(u
__locals__((u,/opt/alt/python33/lib64/python3.3/decimal.pyuInvalidOperation�scBs&|EeZdZdZdd�ZdS(uConversionSyntaxu�Trying to convert badly formed string.

    This occurs and signals invalid-operation if an string is being
    converted to a number and it does not conform to the numeric string
    syntax.  The result is [0,qNaN].
    cGstS(N(u_NaN(uselfucontextuargs((u,/opt/alt/python33/lib64/python3.3/decimal.pyuhandle�suConversionSyntax.handleN(u__name__u
__module__u__qualname__u__doc__uhandle(u
__locals__((u,/opt/alt/python33/lib64/python3.3/decimal.pyuConversionSyntax�suConversionSyntaxcBs&|EeZdZdZdd�ZdS(uDivisionByZerou�Division by 0.

    This occurs and signals division-by-zero if division of a finite number
    by zero was attempted (during a divide-integer or divide operation, or a
    power operation with negative right-hand operand), and the dividend was
    not zero.

    The result of the operation is [sign,inf], where sign is the exclusive
    or of the signs of the operands for divide, or is 1 for an odd power of
    -0, for power.
    cGst|S(N(u_SignedInfinity(uselfucontextusignuargs((u,/opt/alt/python33/lib64/python3.3/decimal.pyuhandlesuDivisionByZero.handleN(u__name__u
__module__u__qualname__u__doc__uhandle(u
__locals__((u,/opt/alt/python33/lib64/python3.3/decimal.pyuDivisionByZero�scBs&|EeZdZdZdd�ZdS(uDivisionImpossibleu�Cannot perform the division adequately.

    This occurs and signals invalid-operation if the integer result of a
    divide-integer or remainder operation had too many digits (would be
    longer than precision).  The result is [0,qNaN].
    cGstS(N(u_NaN(uselfucontextuargs((u,/opt/alt/python33/lib64/python3.3/decimal.pyuhandlesuDivisionImpossible.handleN(u__name__u
__module__u__qualname__u__doc__uhandle(u
__locals__((u,/opt/alt/python33/lib64/python3.3/decimal.pyuDivisionImpossiblesuDivisionImpossiblecBs&|EeZdZdZdd�ZdS(uDivisionUndefinedu�Undefined result of division.

    This occurs and signals invalid-operation if division by zero was
    attempted (during a divide-integer, divide, or remainder operation), and
    the dividend is also zero.  The result is [0,qNaN].
    cGstS(N(u_NaN(uselfucontextuargs((u,/opt/alt/python33/lib64/python3.3/decimal.pyuhandle"suDivisionUndefined.handleN(u__name__u
__module__u__qualname__u__doc__uhandle(u
__locals__((u,/opt/alt/python33/lib64/python3.3/decimal.pyuDivisionUndefinedsuDivisionUndefinedcBs|EeZdZdZdS(uInexactu�Had to round, losing information.

    This occurs and signals inexact whenever the result of an operation is
    not exact (that is, it needed to be rounded and any discarded digits
    were non-zero), or if an overflow or underflow condition occurs.  The
    result in all cases is unchanged.

    The inexact signal may be tested (or trapped) to determine if a given
    operation (or sequence of operations) was inexact.
    N(u__name__u
__module__u__qualname__u__doc__(u
__locals__((u,/opt/alt/python33/lib64/python3.3/decimal.pyuInexact%s
cBs&|EeZdZdZdd�ZdS(uInvalidContextu�Invalid context.  Unknown rounding, for example.

    This occurs and signals invalid-operation if an invalid context was
    detected during an operation.  This can occur if contexts are not checked
    on creation and either the precision exceeds the capability of the
    underlying concrete representation or an unknown or unsupported rounding
    was specified.  These aspects of the context need only be checked when
    the values are required to be used.  The result is [0,qNaN].
    cGstS(N(u_NaN(uselfucontextuargs((u,/opt/alt/python33/lib64/python3.3/decimal.pyuhandle<suInvalidContext.handleN(u__name__u
__module__u__qualname__u__doc__uhandle(u
__locals__((u,/opt/alt/python33/lib64/python3.3/decimal.pyuInvalidContext1s	uInvalidContextcBs|EeZdZdZdS(uRoundedu�Number got rounded (not  necessarily changed during rounding).

    This occurs and signals rounded whenever the result of an operation is
    rounded (that is, some zero or non-zero digits were discarded from the
    coefficient), or if an overflow or underflow condition occurs.  The
    result in all cases is unchanged.

    The rounded signal may be tested (or trapped) to determine if a given
    operation (or sequence of operations) caused a loss of precision.
    N(u__name__u
__module__u__qualname__u__doc__(u
__locals__((u,/opt/alt/python33/lib64/python3.3/decimal.pyuRounded?s
cBs|EeZdZdZdS(u	Subnormalu�Exponent < Emin before rounding.

    This occurs and signals subnormal whenever the result of a conversion or
    operation is subnormal (that is, its adjusted exponent is less than
    Emin, before any rounding).  The result in all cases is unchanged.

    The subnormal signal may be tested (or trapped) to determine if a given
    or operation (or sequence of operations) yielded a subnormal result.
    N(u__name__u
__module__u__qualname__u__doc__(u
__locals__((u,/opt/alt/python33/lib64/python3.3/decimal.pyu	SubnormalKs	cBs&|EeZdZdZdd�ZdS(uOverflowuNumerical overflow.

    This occurs and signals overflow if the adjusted exponent of a result
    (from a conversion or from an operation that is not an attempt to divide
    by zero), after rounding, would be greater than the largest value that
    can be handled by the implementation (the value Emax).

    The result depends on the rounding mode:

    For round-half-up and round-half-even (and for round-half-down and
    round-up, if implemented), the result of the operation is [sign,inf],
    where sign is the sign of the intermediate result.  For round-down, the
    result is the largest finite number that can be represented in the
    current precision, with the sign of the intermediate result.  For
    round-ceiling, the result is the same as for round-down if the sign of
    the intermediate result is 1, or is [0,inf] otherwise.  For round-floor,
    the result is the same as for round-down if the sign of the intermediate
    result is 0, or is [1,inf] otherwise.  In all cases, Inexact and Rounded
    will also be raised.
    cGs�|jttttfkr#t|S|dkrk|jtkrFt|St|d|j|j	|jd�S|dkr�|jt
kr�t|St|d|j|j	|jd�SdS(Niu9i(uroundingu
ROUND_HALF_UPuROUND_HALF_EVENuROUND_HALF_DOWNuROUND_UPu_SignedInfinityu
ROUND_CEILINGu_dec_from_tripleuprecuEmaxuROUND_FLOOR(uselfucontextusignuargs((u,/opt/alt/python33/lib64/python3.3/decimal.pyuhandlelsuOverflow.handleN(u__name__u
__module__u__qualname__u__doc__uhandle(u
__locals__((u,/opt/alt/python33/lib64/python3.3/decimal.pyuOverflowVscBs|EeZdZdZdS(u	UnderflowuxNumerical underflow with result rounded to 0.

    This occurs and signals underflow if a result is inexact and the
    adjusted exponent of the result would be smaller (more negative) than
    the smallest value that can be handled by the implementation (the value
    Emin).  That is, the result is both inexact and subnormal.

    The result after an underflow will be a subnormal number rounded, if
    necessary, so that its exponent is not less than Etiny.  This may result
    in 0 with the sign of the intermediate result and an exponent of Etiny.

    In all cases, Inexact, Rounded, and Subnormal will also be raised.
    N(u__name__u
__module__u__qualname__u__doc__(u
__locals__((u,/opt/alt/python33/lib64/python3.3/decimal.pyu	Underflow|s
cBs|EeZdZdZdS(uFloatOperationu�Enable stricter semantics for mixing floats and Decimals.

    If the signal is not trapped (default), mixing floats and Decimals is
    permitted in the Decimal() constructor, context.create_decimal() and
    all comparison operators. Both conversion and comparisons are exact.
    Any occurrence of a mixed operation is silently recorded by setting
    FloatOperation in the context flags.  Explicit conversions with
    Decimal.from_float() or context.create_decimal_from_float() do not
    set the flag.

    Otherwise (the signal is trapped), only equality comparisons and explicit
    conversions are silent. All other mixed operations raise FloatOperation.
    N(u__name__u
__module__u__qualname__u__doc__(u
__locals__((u,/opt/alt/python33/lib64/python3.3/decimal.pyuFloatOperation�s
cBs#|EeZdZedd�ZdS(u
MockThreadingcCs|jtS(N(umodulesu__name__(uselfusys((u,/opt/alt/python33/lib64/python3.3/decimal.pyulocal�suMockThreading.localN(u__name__u
__module__u__qualname__usysulocal(u
__locals__((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
MockThreading�su
MockThreadingu__decimal_context__cCsA|tttfkr.|j�}|j�n|tj�_dS(u%Set this thread's context to context.N(uDefaultContextuBasicContextuExtendedContextucopyuclear_flagsu	threadingucurrent_threadu__decimal_context__(ucontext((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
setcontext�s
cCsFytj�jSWn.tk
rAt�}|tj�_|SYnXdS(u�Returns this thread's context.

        If this thread does not yet have a context, returns
        a new context and sets this thread's context.
        New contexts are copies of DefaultContext.
        N(u	threadingucurrent_threadu__decimal_context__uAttributeErroruContext(ucontext((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
getcontext�s
	cCs:y|jSWn(tk
r5t�}||_|SYnXdS(u�Returns this thread's context.

        If this thread does not yet have a context, returns
        a new context and sets this thread's context.
        New contexts are copies of DefaultContext.
        N(u__decimal_context__uAttributeErroruContext(u_localucontext((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
getcontext�s
		cCs;|tttfkr.|j�}|j�n||_dS(u%Set this thread's context to context.N(uDefaultContextuBasicContextuExtendedContextucopyuclear_flagsu__decimal_context__(ucontextu_local((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
setcontext�s
cCs"|dkrt�}nt|�S(ubReturn a context manager for a copy of the supplied context

    Uses a copy of the current context if no context is specified
    The returned context manager creates a local decimal context
    in a with statement:
        def sin(x):
             with localcontext() as ctx:
                 ctx.prec += 2
                 # Rest of sin calculation algorithm
                 # uses a precision 2 greater than normal
             return +s  # Convert result to normal precision

         def sin(x):
             with localcontext(ExtendedContext):
                 # Rest of sin calculation algorithm
                 # uses the Extended Context from the
                 # General Decimal Arithmetic Specification
             return +s  # Convert result to normal context

    >>> setcontext(DefaultContext)
    >>> print(getcontext().prec)
    28
    >>> with localcontext():
    ...     ctx = getcontext()
    ...     ctx.prec += 2
    ...     print(ctx.prec)
    ...
    30
    >>> with localcontext(ExtendedContext):
    ...     print(getcontext().prec)
    ...
    9
    >>> print(getcontext().prec)
    28
    N(uNoneu
getcontextu_ContextManager(uctx((u,/opt/alt/python33/lib64/python3.3/decimal.pyulocalcontext�s$cBs�|EeZdZdZd�Zdd�dd�Zd	d
�Zee�Zdd�Z	d
d�Z
d�d�dd�Zdd�Zdd�Z
dd�Zd�dd�Zd�dd�Zd�dd�Zd�dd�Zd�dd �Zd�d!d"�Zd�d#d$�Zd%d&�Zd'd(�Zd)d*�Zd�d�d+d,�Zd�d-d.�Zd�d/d0�Zd�d1d2�Zd�d�d3d4�Zd�d5d6�Z e Z!d�d7d8�Z"d�d9d:�Z#d�d;d<�Z$e$Z%d�d=d>�Z&d?d@�Z'd�dAdB�Z(d�dCdD�Z)d�dEdF�Z*d�dGdH�Z+d�dIdJ�Z,d�dKdL�Z-d�dMdN�Z.d�dOdP�Z/dQdR�Z0dSdT�Z1e1Z2dUdV�Z3e4e3�Z3dWdX�Z5e4e5�Z5dYdZ�Z6d[d\�Z7d]d^�Z8d_d`�Z9dadb�Z:dcdd�Z;dedf�Z<dgdh�Z=didj�Z>dkdl�Z?dmdn�Z@dodp�ZAeBdqe:dre;dse<dte=due>dve?dwe@dxeA�ZCd�dydz�ZDd{d|�ZEd}d~�ZFd�dd��ZGd�d�d��ZHd�d��ZId�d�d�d��ZJd�d�d��ZKd�d�d��ZLd�d�d�d�d��ZMd�d�d��ZNd�d��ZOd�d��ZPd�d�d�d��ZQd�d�d�d��ZReRZSd�d�d��ZTd�d�d��ZUd�d�d��ZVd�d��ZWd�d��ZXd�d��ZYd�d��ZZd�d�d��Z[d�d�d��Z\d�d�d��Z]d�d��Z^d�d��Z_d�d�d��Z`d�d�d��Zad�d��Zbd�d��Zcd�d��Zdd�d��Zed�d�d��Zfd�d��Zgd�d��Zhd�d��Zid�d�d��Zjd�d��Zkd�d��Zld�d�d��Zmd�d��Znd�d�d��Zod�d�d��Zpd�d��Zqd�d��Zrd�d�d��Zsd�d�d��Ztd�d�d��Zud�d�d��Zvd�d�d��Zwd�d�d��Zxd�d�d��Zyd�d�d��Zzd�d�d��Z{d�d�d��Z|d�d��Z}d�d�d��Z~d�d�d��Zd�d�d��Z�d�d��Z�d�d��Z�d�d��Z�d�d�d�d��Z�d�S(�uDecimalu,Floating point class for decimal arithmetic.u_expu_intu_signu_is_specialu0c	Cs�tj|�}t|t�r�t|j��}|dkrh|dkrTt�}n|jt	d|�S|j
d�dkr�d|_n	d|_|j
d�}|dk	r|j
d�p�d}t|j
d	�p�d
�}tt||��|_
|t|�|_d|_n�|j
d�}|dk	r{tt|p?d
��jd
�|_
|j
d�rod
|_q�d|_nd
|_
d|_d|_|St|t�r�|dkr�d|_n	d|_d|_tt|��|_
d|_|St|t�r8|j|_|j|_|j
|_
|j|_|St|t�r�|j|_t|j�|_
t|j�|_d|_|St|ttf�rFt|�dkr�td��nt|dt�o�|ddks�td��n|d|_|ddkr+d
|_
|d|_d|_ng}	xn|dD]b}
t|
t�r�d|
kohdknr�|	s|
dkr�|	j|
�q�q<td��q<W|ddkr�djtt|	��|_
|d|_d|_n\t|dt�r6djtt|	pdg��|_
|d|_d|_ntd��|St|t�r�|dkrmt�}n|jt d�tj!|�}|j|_|j|_|j
|_
|j|_|St"d|��dS(u�Create a decimal point instance.

        >>> Decimal('3.14')              # string input
        Decimal('3.14')
        >>> Decimal((0, (3, 1, 4), -2))  # tuple (sign, digit_tuple, exponent)
        Decimal('3.14')
        >>> Decimal(314)                 # int
        Decimal('314')
        >>> Decimal(Decimal(314))        # another decimal instance
        Decimal('314')
        >>> Decimal('  3.14  \n')        # leading and trailing whitespace okay
        Decimal('3.14')
        uInvalid literal for Decimal: %rusignu-iiuintufracuuexpu0udiagusignaluNunuFiutInvalid tuple size in creation of Decimal from list or tuple.  The list or tuple should have exactly three elements.u|Invalid sign.  The first value in the tuple should be an integer; either 0 for a positive number or 1 for a negative number.ii	uTThe second value in the tuple must be composed of integers in the range 0 through 9.uUThe third value in the tuple must be an integer, or one of the strings 'F', 'n', 'N'.u;strict semantics for mixing floats and Decimals are enableduCannot convert %r to DecimalNFT(ii(unuN(#uobjectu__new__u
isinstanceustru_parserustripuNoneu
getcontextu_raise_erroruConversionSyntaxugroupu_signuintu_intulenu_expuFalseu_is_specialulstripuTrueuabsuDecimalu_WorkRepusignuexpulistutupleu
ValueErroruappendujoinumapufloatuFloatOperationu
from_floatu	TypeError(uclsuvalueucontextuselfumuintpartufracpartuexpudiagudigitsudigit((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__new__-s�		$							#
	
+
$
	uDecimal.__new__cCs�t|t�r||�St|t�s7td��ntj|�sUtj|�re|t|��Stjd|�dkr�d}nd}t	|�j
�\}}|j�d}t|t
|d|�|�}|tkr�|S||�SdS(u.Converts a float to a decimal number, exactly.

        Note that Decimal.from_float(0.1) is not the same as Decimal('0.1').
        Since 0.1 is not exactly representable in binary floating point, the
        value is stored as the nearest representable value which is
        0x1.999999999999ap-4.  The exact equivalent of the value in decimal
        is 0.1000000000000000055511151231257827021181583404541015625.

        >>> Decimal.from_float(0.1)
        Decimal('0.1000000000000000055511151231257827021181583404541015625')
        >>> Decimal.from_float(float('nan'))
        Decimal('NaN')
        >>> Decimal.from_float(float('inf'))
        Decimal('Infinity')
        >>> Decimal.from_float(-float('inf'))
        Decimal('-Infinity')
        >>> Decimal.from_float(-0.0)
        Decimal('-0')

        uargument must be int or float.g�?iiiN(u
isinstanceuintufloatu	TypeErroru_mathuisinfuisnanureprucopysignuabsuas_integer_ratiou
bit_lengthu_dec_from_tripleustruDecimal(uclsufusignunudukuresult((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
from_float�s
	!uDecimal.from_floatcCs9|jr5|j}|dkr"dS|dkr5dSndS(urReturns whether the number is not actually one.

        0 if a number
        1 if NaN
        2 if sNaN
        uniuNii(u_is_specialu_exp(uselfuexp((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_isnan�s		uDecimal._isnancCs$|jdkr |jrdSdSdS(uyReturns whether the number is infinite

        0 if finite or not a number
        1 if +INF
        -1 if -INF
        uFiii����(u_expu_sign(uself((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_isinfinity�s
	uDecimal._isinfinitycCs�|j�}|dkr!d}n|j�}|s9|r�|dkrQt�}n|dkrp|jtd|�S|dkr�|jtd|�S|r�|j|�S|j|�SdS(u�Returns whether the number is not actually one.

        if self, other are sNaN, signal
        if self, other are NaN return nan
        return 0

        Done before operations.
        iusNaNiNF(u_isnanuNoneuFalseu
getcontextu_raise_erroruInvalidOperationu_fix_nan(uselfuotherucontextuself_is_nanuother_is_nan((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_check_nans	s"
	

uDecimal._check_nanscCs�|dkrt�}n|js*|jr�|j�rI|jtd|�S|j�rh|jtd|�S|j�r�|jtd|�S|j�r�|jtd|�SndS(uCVersion of _check_nans used for the signaling comparisons
        compare_signal, __le__, __lt__, __ge__, __gt__.

        Signal InvalidOperation if either self or other is a (quiet
        or signaling) NaN.  Signaling NaNs take precedence over quiet
        NaNs.

        Return 0 if neither operand is a NaN.

        ucomparison involving sNaNucomparison involving NaNiN(uNoneu
getcontextu_is_specialuis_snanu_raise_erroruInvalidOperationuis_qnan(uselfuotherucontext((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_compare_check_nans)s(				
uDecimal._compare_check_nanscCs|jp|jdkS(uuReturn True if self is nonzero; otherwise return False.

        NaNs and infinities are considered nonzero.
        u0(u_is_specialu_int(uself((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__bool__JsuDecimal.__bool__cCsd|js|jrQ|j�}|j�}||kr:dS||krJdSdSn|sp|sadSd|jSn|s�d|jS|j|jkr�dS|j|jkr�dS|j�}|j�}||kr=|jd|j|j}|jd|j|j}||krdS||kr/d	|jSd
|jSn#||krTd|jSd|jSdS(
u�Compare the two non-NaN decimal instances self and other.

        Returns -1 if self < other, 0 if self == other and 1
        if self > other.  This routine is for internal use only.iiu0Ni����i����i����i����i����i����i����i����(u_is_specialu_isinfinityu_signuadjustedu_intu_exp(uselfuotheruself_infu	other_infu
self_adjusteduother_adjusteduself_paddeduother_padded((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_cmpQs>uDecimal._cmpcCsTt||dd�\}}|tkr+|S|j||�rAdS|j|�dkS(Nuequality_opiTF(u_convert_for_comparisonuTrueuNotImplementedu_check_nansuFalseu_cmp(uselfuotherucontext((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__eq__�suDecimal.__eq__cCsTt||dd�\}}|tkr+|S|j||�rAdS|j|�dkS(Nuequality_opiT(u_convert_for_comparisonuTrueuNotImplementedu_check_nansu_cmp(uselfuotherucontext((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__ne__�suDecimal.__ne__cCsTt||�\}}|tkr%|S|j||�}|rAdS|j|�dkS(NiF(u_convert_for_comparisonuNotImplementedu_compare_check_nansuFalseu_cmp(uselfuotherucontextuans((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__lt__�suDecimal.__lt__cCsTt||�\}}|tkr%|S|j||�}|rAdS|j|�dkS(NiF(u_convert_for_comparisonuNotImplementedu_compare_check_nansuFalseu_cmp(uselfuotherucontextuans((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__le__�suDecimal.__le__cCsTt||�\}}|tkr%|S|j||�}|rAdS|j|�dkS(NiF(u_convert_for_comparisonuNotImplementedu_compare_check_nansuFalseu_cmp(uselfuotherucontextuans((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__gt__�suDecimal.__gt__cCsTt||�\}}|tkr%|S|j||�}|rAdS|j|�dkS(NiF(u_convert_for_comparisonuNotImplementedu_compare_check_nansuFalseu_cmp(uselfuotherucontextuans((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__ge__�suDecimal.__ge__cCs\t|dd�}|js*|rI|jrI|j||�}|rI|Snt|j|��S(u�Compares one to another.

        -1 => a < b
        0  => a = b
        1  => a > b
        NaN => one is NaN
        Like __cmp__, but returns Decimal instances.
        uraiseitT(u_convert_otheruTrueu_is_specialu_check_nansuDecimalu_cmp(uselfuotherucontextuans((u,/opt/alt/python33/lib64/python3.3/decimal.pyucompare�s	uDecimal.comparecCs�|jrI|j�r$td��qI|j�r4tS|jrBtStSn|jdkrptd|jt	�}ntt
|jt	�}t|j�|t	}|dkr�|n|}|dkr�dS|S(ux.__hash__() <==> hash(x)u"Cannot hash a signaling NaN value.ii
iii����i����(
u_is_specialuis_snanu	TypeErroruis_nanu_PyHASH_NANu_signu_PyHASH_INFu_expupowu_PyHASH_MODULUSu
_PyHASH_10INVuintu_int(uselfuexp_hashuhash_uans((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__hash__�s		uDecimal.__hash__cCs(t|jttt|j��|j�S(ueRepresents the number as a triple tuple.

        To show the internals exactly as they are.
        (uDecimalTupleu_signutupleumapuintu_intu_exp(uself((u,/opt/alt/python33/lib64/python3.3/decimal.pyuas_tuple�suDecimal.as_tuplecCsdt|�S(u0Represents the number as an instance of Decimal.u
Decimal('%s')(ustr(uself((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__repr__�suDecimal.__repr__c	Cs�ddg|j}|jrc|jdkr3|dS|jdkrQ|d|jS|d|jSn|jt|j�}|jdkr�|dkr�|}nE|s�d
}n6|jdkr�|d
dd
}n|d
dd
}|dkr
d}d
d||j}nf|t|j�krI|jd|t|j�}d}n*|jd|�}d
|j|d�}||kr�d}n7|dkr�t�}nddg|jd||}||||S(u�Return string representation of the number in scientific notation.

        Captures all of the information in the underlying representation.
        uu-uFuInfinityunuNaNusNaNiiiu0iu.NueuEu%+di����(u_signu_is_specialu_expu_intulenuNoneu
getcontextucapitals(	uselfuengucontextusignu
leftdigitsudotplaceuintpartufracpartuexp((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__str__�s:					uDecimal.__str__cCs|jddd|�S(uConvert to engineering-type string.

        Engineering notation has an exponent which is a multiple of 3, so there
        are up to 3 digits left of the decimal place.

        Same rules for when in exponential and when as a value as in __str__.
        uengucontextT(u__str__uTrue(uselfucontext((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
to_eng_string3suDecimal.to_eng_stringcCs~|jr(|jd|�}|r(|Sn|dkr@t�}n|re|jtkre|j�}n|j�}|j|�S(uRReturns a copy with the sign switched.

        Rounds, if it has reason.
        ucontextN(	u_is_specialu_check_nansuNoneu
getcontexturoundinguROUND_FLOORucopy_absucopy_negateu_fix(uselfucontextuans((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__neg__=s	uDecimal.__neg__cCs~|jr(|jd|�}|r(|Sn|dkr@t�}n|re|jtkre|j�}nt|�}|j|�S(uhReturns a copy, unless it is a sNaN.

        Rounds the number (if more then precision digits)
        ucontextN(	u_is_specialu_check_nansuNoneu
getcontexturoundinguROUND_FLOORucopy_absuDecimalu_fix(uselfucontextuans((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__pos__Ss	uDecimal.__pos__cCsl|s|j�S|jr8|jd|�}|r8|Sn|jrV|jd|�}n|jd|�}|S(u�Returns the absolute value of self.

        If the keyword argument 'round' is false, do not round.  The
        expression self.__abs__(round=False) is equivalent to
        self.copy_abs().
        ucontext(ucopy_absu_is_specialu_check_nansu_signu__neg__u__pos__(uselfurounducontextuans((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__abs__hs
		uDecimal.__abs__c
Csqt|�}|tkr|S|dkr4t�}n|jsF|jr�|j||�}|rb|S|j�r�|j|jkr�|j�r�|jt	d�St
|�S|j�r�t
|�Snt|j|j�}d}|j
tkr|j|jkrd}n|r[|r[t|j|j�}|r6d}nt|d|�}|j|�}|S|s�t||j|jd�}|j||j
�}|j|�}|S|s�t||j|jd�}|j||j
�}|j|�}|St|�}t|�}t|||j�\}}t�}	|j|jkr�|j|jkrvt|d|�}|j|�}|S|j|jkr�||}}n|jdkr�d|	_|j|j|_|_qd|	_n6|jdkrd|	_d\|_|_n	d|	_|jdkr3|j|j|	_n|j|j|	_|j|	_t
|	�}|j|�}|S(ubReturns self + other.

        -INF + INF (or the reverse) cause InvalidOperation errors.
        u
-INF + INFiiu0N(ii(u_convert_otheruNotImplementeduNoneu
getcontextu_is_specialu_check_nansu_isinfinityu_signu_raise_erroruInvalidOperationuDecimaluminu_expuroundinguROUND_FLOORu_dec_from_tripleu_fixumaxuprecu_rescaleu_WorkRepu
_normalizeusignuintuexp(
uselfuotherucontextuansuexpunegativezerousignuop1uop2uresult((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__add__~s|

!						uDecimal.__add__cCsit|�}|tkr|S|js.|jrP|j|d|�}|rP|Sn|j|j�d|�S(uReturn self - otherucontext(u_convert_otheruNotImplementedu_is_specialu_check_nansu__add__ucopy_negate(uselfuotherucontextuans((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__sub__�suDecimal.__sub__cCs/t|�}|tkr|S|j|d|�S(uReturn other - selfucontext(u_convert_otheruNotImplementedu__sub__(uselfuotherucontext((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__rsub__�suDecimal.__rsub__cCs�t|�}|tkr|S|dkr4t�}n|j|jA}|jsV|jr�|j||�}|rr|S|j�r�|s�|jt	d�St
|S|j�r�|s�|jt	d�St
|Sn|j|j}|s�|rt|d|�}|j
|�}|S|jdkrCt||j|�}|j
|�}|S|jdkrzt||j|�}|j
|�}|St|�}t|�}t|t|j|j�|�}|j
|�}|S(u\Return self * other.

        (+-) INF * 0 (or its reverse) raise InvalidOperation.
        u(+-)INF * 0u0 * (+-)INFu0u1N(u_convert_otheruNotImplementeduNoneu
getcontextu_signu_is_specialu_check_nansu_isinfinityu_raise_erroruInvalidOperationu_SignedInfinityu_expu_dec_from_tripleu_fixu_intu_WorkRepustruint(uselfuotherucontextu
resultsignuansu	resultexpuop1uop2((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__mul__�sH"uDecimal.__mul__cCslt|�}|tkrtS|d
kr4t�}n|j|jA}|jsV|jr�|j||�}|rr|S|j�r�|j�r�|jt	d�S|j�r�t
|S|j�r�|jtd�t|d|j
��Sn|s|s�|jtd�S|jtd|�S|s1|j|j}d}nt|j�t|j�|jd}|j|j|}t|�}t|�}	|dkr�t|jd||	j�\}}
n$t|j|	jd|�\}}
|
r|d	dkrG|d7}qGnG|j|j}x4||krF|ddkrF|d}|d7}qWt|t|�|�}|j|�S(uReturn self / other.u(+-)INF/(+-)INFuDivision by infinityu0u0 / 0ux / 0iii
iN(u_convert_otheruNotImplementeduNoneu
getcontextu_signu_is_specialu_check_nansu_isinfinityu_raise_erroruInvalidOperationu_SignedInfinityuClampedu_dec_from_tripleuEtinyuDivisionUndefineduDivisionByZerou_expulenu_intuprecu_WorkRepudivmoduintustru_fix(uselfuotherucontextusignuansuexpucoeffushiftuop1uop2u	remainderu	ideal_exp((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__truediv__%sP	'&$
uDecimal.__truediv__cCs�|j|jA}|j�r(|j}nt|j|j�}|j�|j�}|sr|j�sr|dkr�t|dd�|j||j�fS||jkrot	|�}t	|�}|j
|j
kr�|jd|j
|j
9_n|jd|j
|j
9_t|j|j�\}}	|d|jkrot|t
|�d�t|jt
|	�|�fSn|jtd�}
|
|
fS(u�Return (self // other, self % other), to context.prec precision.

        Assumes that neither self nor other is a NaN, that self is not
        infinite and that other is nonzero.
        iu0ii
u%quotient too large in //, % or divmodi����(u_signu_isinfinityu_expuminuadjustedu_dec_from_tripleu_rescaleuroundinguprecu_WorkRepuexpuintudivmodustru_raise_erroruDivisionImpossible(uselfuotherucontextusignu	ideal_expuexpdiffuop1uop2uquruans((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_divide`s* 		uDecimal._dividecCs/t|�}|tkr|S|j|d|�S(u)Swaps self/other and returns __truediv__.ucontext(u_convert_otheruNotImplementedu__truediv__(uselfuotherucontext((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__rtruediv__�suDecimal.__rtruediv__cCs8t|�}|tkr|S|dkr4t�}n|j||�}|rV||fS|j|jA}|j�r�|j�r�|jtd�}||fSt	||jtd�fSn|s|s�|jt
d�}||fS|jtd|�|jtd�fSn|j||�\}}|j
|�}||fS(u6
        Return (self // other, self % other)
        udivmod(INF, INF)uINF % xudivmod(0, 0)ux // 0ux % 0N(u_convert_otheruNotImplementeduNoneu
getcontextu_check_nansu_signu_isinfinityu_raise_erroruInvalidOperationu_SignedInfinityuDivisionUndefineduDivisionByZerou_divideu_fix(uselfuotherucontextuansusignuquotientu	remainder((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
__divmod__�s0


uDecimal.__divmod__cCs/t|�}|tkr|S|j|d|�S(u(Swaps self/other and returns __divmod__.ucontext(u_convert_otheruNotImplementedu
__divmod__(uselfuotherucontext((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__rdivmod__�suDecimal.__rdivmod__cCs�t|�}|tkr|S|dkr4t�}n|j||�}|rP|S|j�rl|jtd�S|s�|r�|jtd�S|jtd�Sn|j	||�d}|j
|�}|S(u
        self % other
        uINF % xux % 0u0 % 0iN(u_convert_otheruNotImplementeduNoneu
getcontextu_check_nansu_isinfinityu_raise_erroruInvalidOperationuDivisionUndefinedu_divideu_fix(uselfuotherucontextuansu	remainder((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__mod__�s"uDecimal.__mod__cCs/t|�}|tkr|S|j|d|�S(u%Swaps self/other and returns __mod__.ucontext(u_convert_otheruNotImplementedu__mod__(uselfuotherucontext((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__rmod__�suDecimal.__rmod__cCs||d
krt�}nt|dd�}|j||�}|rF|S|j�rb|jtd�S|s�|r~|jtd�S|jtd�Sn|j�r�t	|�}|j
|�St|j|j�}|s�t
|jd|�}|j
|�S|j�|j�}||jdkr)|jt�S|dkrW|j||j�}|j
|�St|�}t|�}|j|jkr�|jd|j|j9_n|jd|j|j9_t|j|j�\}}	d|	|d@|jkr|	|j8}	|d7}n|d|jkr.|jt�S|j}
|	d	krWd|
}
|	}	nt
|
t|	�|�}|j
|�S(
uI
        Remainder nearest to 0-  abs(remainder-near) <= other/2
        uraiseituremainder_near(infinity, x)uremainder_near(x, 0)uremainder_near(0, 0)u0iii
iNTi����(uNoneu
getcontextu_convert_otheruTrueu_check_nansu_isinfinityu_raise_erroruInvalidOperationuDivisionUndefineduDecimalu_fixuminu_expu_dec_from_tripleu_signuadjusteduprecuDivisionImpossibleu_rescaleuroundingu_WorkRepuexpuintudivmodustr(uselfuotherucontextuansuideal_exponentuexpdiffuop1uop2uqurusign((u,/opt/alt/python33/lib64/python3.3/decimal.pyuremainder_near�sZ			




 


	

uDecimal.remainder_nearcCs�t|�}|tkr|S|dkr4t�}n|j||�}|rP|S|j�r�|j�rx|jtd�St|j	|j	ASn|s�|r�|jt
d|j	|j	A�S|jtd�Sn|j||�dS(u
self // otheru
INF // INFux // 0u0 // 0iN(
u_convert_otheruNotImplementeduNoneu
getcontextu_check_nansu_isinfinityu_raise_erroruInvalidOperationu_SignedInfinityu_signuDivisionByZerouDivisionUndefinedu_divide(uselfuotherucontextuans((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__floordiv__ s$uDecimal.__floordiv__cCs/t|�}|tkr|S|j|d|�S(u*Swaps self/other and returns __floordiv__.ucontext(u_convert_otheruNotImplementedu__floordiv__(uselfuotherucontext((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
__rfloordiv__<suDecimal.__rfloordiv__cCsU|j�r?|j�r'td��n|jr6dnd}nt|�}t|�S(uFloat representation.u%Cannot convert signaling NaN to floatu-nanunan(u_isnanuis_snanu
ValueErroru_signustrufloat(uselfus((u,/opt/alt/python33/lib64/python3.3/decimal.pyu	__float__CsuDecimal.__float__cCs�|jrB|j�r$td��qB|j�rBtd��qBnd|j}|jdkrz|t|j�d|jS|t|jd|j�p�d�SdS(	u1Converts self to an int, truncating if necessary.uCannot convert NaN to integeru"Cannot convert infinity to integeriii
Nu0i����(	u_is_specialu_isnanu
ValueErroru_isinfinityu
OverflowErroru_signu_expuintu_int(uselfus((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__int__Ms	
uDecimal.__int__cCs|S(N((uself((u,/opt/alt/python33/lib64/python3.3/decimal.pyureal\suDecimal.realcCs
td�S(Ni(uDecimal(uself((u,/opt/alt/python33/lib64/python3.3/decimal.pyuimag`suDecimal.imagcCs|S(N((uself((u,/opt/alt/python33/lib64/python3.3/decimal.pyu	conjugatedsuDecimal.conjugatecCstt|��S(N(ucomplexufloat(uself((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__complex__gsuDecimal.__complex__cCsq|j}|j|j}t|�|krg|t|�|d�jd�}t|j||jd�St	|�S(u2Decapitate the payload of a NaN to fit the contextNu0T(
u_intuprecuclampulenulstripu_dec_from_tripleu_signu_expuTrueuDecimal(uselfucontextupayloadumax_payload_len((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_fix_nanjs	#uDecimal._fix_nancCs;|jr/|j�r"|j|�St|�Sn|j�}|j�}|s�|j|g|j}tt	|j
|�|�}||j
kr�|jt�t
|jd|�St|�Snt|j�|j
|j}||kr|jtd|j�}|jt�|jt�|S||k}|r4|}n|j
|kr�t|j�|j
|}	|	dkr�t
|jd|d�}d}	n|j|j}
|
||	�}|jd|	�p�d}|dkrtt|�d�}t|�|jkr|dd�}|d7}qn||krA|jtd|j�}nt
|j||�}|rr|rr|jt�n|r�|jt�n|r�|jt�n|jt�|s�|jt�n|S|r�|jt�n|jdkr1|j
|kr1|jt�|jd|j
|}
t
|j|
|�St|�S(u�Round if it is necessary to keep self within prec precision.

        Rounds and fixes the exponent.  Does not raise on a sNaN.

        Arguments:
        self - Decimal instance
        context - context used.
        u0u
above Emaxiu1iNi����(u_is_specialu_isnanu_fix_nanuDecimaluEtinyuEtopuEmaxuclampuminumaxu_expu_raise_erroruClampedu_dec_from_tripleu_signulenu_intuprecuOverflowuInexactuRoundedu_pick_rounding_functionuroundingustruintu	Underflowu	Subnormal(uselfucontextuEtinyuEtopuexp_maxunew_expuexp_minuansuself_is_subnormaludigitsurounding_methoduchangeducoeffuself_padded((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_fixvsn
	





		

uDecimal._fixcCst|j|�rdSdSdS(u(Also known as round-towards-0, truncate.iiNi����(u
_all_zerosu_int(uselfuprec((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_round_down�suDecimal._round_downcCs|j|�S(uRounds away from 0.(u_round_down(uselfuprec((u,/opt/alt/python33/lib64/python3.3/decimal.pyu	_round_up�suDecimal._round_upcCs5|j|dkrdSt|j|�r-dSdSdS(uRounds 5 up (away from 0)u56789iiNi����(u_intu
_all_zeros(uselfuprec((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_round_half_up�s
uDecimal._round_half_upcCs't|j|�rdS|j|�SdS(uRound 5 downiNi����(u_exact_halfu_intu_round_half_up(uselfuprec((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_round_half_down�suDecimal._round_half_downcCsJt|j|�r9|dks5|j|ddkr9dS|j|�SdS(u!Round 5 to even, rest to nearest.iiu02468Ni����(u_exact_halfu_intu_round_half_up(uselfuprec((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_round_half_even�s#uDecimal._round_half_evencCs(|jr|j|�S|j|�SdS(u(Rounds up (not away from 0 if negative.)N(u_signu_round_down(uselfuprec((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_round_ceiling�s	
uDecimal._round_ceilingcCs(|js|j|�S|j|�SdS(u'Rounds down (not towards 0 if negative)N(u_signu_round_down(uselfuprec((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_round_floors	
uDecimal._round_floorcCs<|r*|j|ddkr*|j|�S|j|�SdS(u)Round down unless digit prec-1 is 0 or 5.iu05N(u_intu_round_down(uselfuprec((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_round_05up
s
uDecimal._round_05upu
ROUND_DOWNuROUND_UPu
ROUND_HALF_UPuROUND_HALF_DOWNuROUND_HALF_EVENu
ROUND_CEILINGuROUND_FLOORu
ROUND_05UPcCs�|dk	rJt|t�s*td��ntdd|�}|j|�S|jr}|j�rntd��q}t	d��nt|j
dt��S(u�Round self to the nearest integer, or to a given precision.

        If only one argument is supplied, round a finite Decimal
        instance self to the nearest integer.  If self is infinite or
        a NaN then a Python exception is raised.  If self is finite
        and lies exactly halfway between two integers then it is
        rounded to the integer with even last digit.

        >>> round(Decimal('123.456'))
        123
        >>> round(Decimal('-456.789'))
        -457
        >>> round(Decimal('-3.0'))
        -3
        >>> round(Decimal('2.5'))
        2
        >>> round(Decimal('3.5'))
        4
        >>> round(Decimal('Inf'))
        Traceback (most recent call last):
          ...
        OverflowError: cannot round an infinity
        >>> round(Decimal('NaN'))
        Traceback (most recent call last):
          ...
        ValueError: cannot round a NaN

        If a second argument n is supplied, self is rounded to n
        decimal places using the rounding mode for the current
        context.

        For an integer n, round(self, -n) is exactly equivalent to
        self.quantize(Decimal('1En')).

        >>> round(Decimal('123.456'), 0)
        Decimal('123')
        >>> round(Decimal('123.456'), 2)
        Decimal('123.46')
        >>> round(Decimal('123.456'), -2)
        Decimal('1E+2')
        >>> round(Decimal('-Infinity'), 37)
        Decimal('NaN')
        >>> round(Decimal('sNaN123'), 0)
        Decimal('NaN123')

        u+Second argument to round should be integraliu1ucannot round a NaNucannot round an infinityN(uNoneu
isinstanceuintu	TypeErroru_dec_from_tripleuquantizeu_is_specialuis_nanu
ValueErroru
OverflowErroru_rescaleuROUND_HALF_EVEN(uselfunuexp((u,/opt/alt/python33/lib64/python3.3/decimal.pyu	__round__s/
	uDecimal.__round__cCsI|jr3|j�r$td��q3td��nt|jdt��S(u�Return the floor of self, as an integer.

        For a finite Decimal instance self, return the greatest
        integer n such that n <= self.  If self is infinite or a NaN
        then a Python exception is raised.

        ucannot round a NaNucannot round an infinityi(u_is_specialuis_nanu
ValueErroru
OverflowErroruintu_rescaleuROUND_FLOOR(uself((u,/opt/alt/python33/lib64/python3.3/decimal.pyu	__floor__]s
	uDecimal.__floor__cCsI|jr3|j�r$td��q3td��nt|jdt��S(u�Return the ceiling of self, as an integer.

        For a finite Decimal instance self, return the least integer n
        such that n >= self.  If self is infinite or a NaN then a
        Python exception is raised.

        ucannot round a NaNucannot round an infinityi(u_is_specialuis_nanu
ValueErroru
OverflowErroruintu_rescaleu
ROUND_CEILING(uself((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__ceil__ls
	uDecimal.__ceil__cCs�t|dd�}t|dd�}|js6|jr=|d	krNt�}n|jdkrp|jtd|�S|jdkr�|jtd|�S|jdkr�|}q|jdkr�|}q|jdkr�|s�|jtd�St|j	|j	A}q|jdkr|s#|jtd�St|j	|j	A}qnBt
|j	|j	Att|j
�t|j
��|j|j�}|j||�S(
u:Fused multiply-add.

        Returns self*other+third with no rounding of the intermediate
        product self*other.

        self and other are multiplied together, with no rounding of
        the result.  The third operand is then added to the result,
        and a single final rounding is performed.
        uraiseituNusNaNunuFuINF * 0 in fmau0 * INF in fmaTN(u_convert_otheruTrueu_is_specialuNoneu
getcontextu_expu_raise_erroruInvalidOperationu_SignedInfinityu_signu_dec_from_tripleustruintu_intu__add__(uselfuotheruthirducontextuproduct((u,/opt/alt/python33/lib64/python3.3/decimal.pyufma{s6				uDecimal.fmac
Cs�t|�}|tkr|St|�}|tkr8|S|d
krPt�}n|j�}|j�}|j�}|s�|s�|r|dkr�|jtd|�S|dkr�|jtd|�S|dkr�|jtd|�S|r�|j|�S|r	|j|�S|j|�S|j�o7|j�o7|j�sJ|jtd�S|dkrf|jtd�S|s||jtd�S|j	�|j
kr�|jtd�S|r�|r�|jtd�S|j�r�d}n	|j}t
t|��}t|j��}t|j��}	|j|td	|j|�|}x)t|	j�D]}
t|d	|�}qGWt||	j|�}t|t|�d�S(u!Three argument version of __pow__iusNaNu@pow() 3rd argument not allowed unless all arguments are integersiuApow() 2nd argument cannot be negative when 3rd argument specifiedupow() 3rd argument cannot be 0uSinsufficient precision: pow() 3rd argument must not have more than precision digitsuXat least one of pow() 1st argument and 2nd argument must be nonzero ;0**0 is not definedi
N(u_convert_otheruNotImplementeduNoneu
getcontextu_isnanu_raise_erroruInvalidOperationu_fix_nanu
_isintegeruadjusteduprecu_isevenu_signuabsuintu_WorkReputo_integral_valueupowuexpurangeu_dec_from_tripleustr(uselfuotherumoduloucontextuself_is_nanuother_is_nanu
modulo_is_nanusignubaseuexponentui((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
_power_modulo�sl


							$uDecimal._power_modulocCs>t|�}|j|j}}x(|ddkrI|d}|d7}q"Wt|�}|j|j}}x(|ddkr�|d}|d7}qlW|dkrv||9}x(|ddkr�|d}|d7}q�W|dkr�dS|d|}	|jdkr|	}	n|j�rT|jdkrT|jt|�}
t|	|
|d�}nd}t	ddd||	|�S|jdkry|d}|dkrI||@|kr�dSt
|�d}
|d
d}|tt|��kr�dSt
|
||�}
t
|||�}|
dks(|dkr,dS|
|kr<dSd|
}n�|dkr@t
|�d
d}
td|
|�\}}|r�dSx(|ddkr�|d}|
d8}
q�W|dd}|tt|��kr�dSt
|
||�}
t
|||�}|
dks|dkr#dS|
|kr3dSd|
}ndS|d|krXdS|
|}t	dt|�|�S|dkr�|d|d}}n|dkr�ttt||���|kr�dSt
|�}|dkrttt|�|��|krdS|d|}}x<|d|dkoCdknr_|d}|d}q$Wx<|d|dko�dknr�|d}|d}qcW|dkrp|dkr�||kr�dSt||�\}}|dkr�dSdt
|�|>}xFt|||d�\}}||kr2Pq||d||}q||ko`|dksgdS|}n|dkr�||dt|�kr�dS||}||9}|d|kr�dSt|�}|j�r|jdkr|jt|�}
t||
|t|��}nd}t	d|d|||�S(uhAttempt to compute self**other exactly.

        Given Decimals self and other and an integer p, attempt to
        compute an exact result for the power self**other, with p
        digits of precision.  Return None if self**other is not
        exactly representable in p digits.

        Assumes that elimination of special cases has already been
        performed: self and other must both be nonspecial; self must
        be positive and not numerically equal to 1; other must be
        nonzero.  For efficiency, other._exp should not be too large,
        so that 10**abs(other._exp) is a feasible calculation.i
iiu1u0iiiii]iAiiiidN(iiii(u_WorkRepuintuexpuNoneusignu
_isintegeru_signu_expuminu_dec_from_tripleu_nbitsulenustru_decimal_lshift_exactudivmoduabsu	_log10_lb(uselfuotherupuxuxcuxeuyuycuyeuexponentuideal_exponentuzerosu
last_digitueuemaxu	remainderumunuxc_bitsuremuauqurustr_xc((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_power_exact�s�:








//'
'
	&

 uDecimal._power_exactcCs�|dk	r|j|||�St|�}|tkr;|S|dkrSt�}n|j||�}|ro|S|s�|s�|jtd�StSnd}|j	dkr�|j
�r�|j�s�d}q�n|r�|jtd�S|j�}n|s |j	dkrt
|dd�St|Sn|j�rV|j	dkrCt|St
|dd�Sn|tkr-|j
�r�|j	dkr�d}n'||jkr�|j}nt|�}|j|}|d|jkrd|j}|jt�qn'|jt�|jt�d|j}t
|dd||�S|j�}|j�r{|j	dk|dkkrpt
|dd�St|Snd}d}	|j�|j�}
|dk|j	dkkr�|
tt|j��kr0t
|d|jd�}q0n>|j�}|
tt|��kr0t
|d|d�}n|dkr�|j||jd�}|dk	r�|dkr�t
d|j|j�}nd
}	q�n|dkr}|j}t|�}
|
j|
j }}t|�}|j|j }}|j!dkr|}nd}xYt"||||||�\}}|dd	tt|��|drUPn|d7}q	t
|t|�|�}n|	r�|j
�r�t|j�|jkr�|jdt|j�}t
|j	|jd||j|�}n|j#�}|j$�xt%D]}d|j&|<q	W|j'|�}|jt�|j(t)rY|jt*�n|j(t+r|jt+d
|j	�nxLt*t)ttt,fD]#}|j(|r�|j|�q�q�Wn|j'|�}|S(uHReturn self ** other [ % modulo].

        With two arguments, compute self**other.

        With three arguments, compute (self**other) % modulo.  For the
        three argument form, the following restrictions on the
        arguments hold:

         - all three arguments must be integral
         - other must be nonnegative
         - either self or other (or both) must be nonzero
         - modulo must be nonzero and must have at most p digits,
           where p is the context precision.

        If any of these restrictions is violated the InvalidOperation
        flag is raised.

        The result of pow(self, other, modulo) is identical to the
        result that would be obtained by computing (self**other) %
        modulo with unbounded precision, but is computed more
        efficiently.  It is always exact.
        u0 ** 0iiu+x ** y with x negative and y not an integeru0u1iii
u
above EmaxNFT(-uNoneu
_power_modulou_convert_otheruNotImplementedu
getcontextu_check_nansu_raise_erroruInvalidOperationu_Oneu_signu
_isintegeru_isevenucopy_negateu_dec_from_tripleu_SignedInfinityu_isinfinityuprecuintu_expuRoundeduInexactuadjusteduFalseu_log10_exp_boundulenustruEmaxuEtinyu_power_exactu_intuTrueu_WorkRepuexpusignu_dpowerucopyuclear_flagsu_signalsutrapsu_fixuflagsu	Subnormalu	UnderflowuOverflowuClamped(uselfuotherumoduloucontextuansuresult_signu
multiplieruexpuself_adjuexactubounduEtinyupuxuxcuxeuyuycuyeuextraucoeffuexpdiffu
newcontextu	exception((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__pow__�s�		




	
"&






uDecimal.__pow__cCs/t|�}|tkr|S|j|d|�S(u%Swaps self/other and returns __pow__.ucontext(u_convert_otheruNotImplementedu__pow__(uselfuotherucontext((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__rpow__�	suDecimal.__rpow__cCs
|dkrt�}n|jr@|jd|�}|r@|Sn|j|�}|j�r_|S|sxt|jdd�S|j|j	�g|j
}t|j�}|j
}x;|j|ddkr�||kr�|d7}|d8}q�Wt|j|jd|�|�S(u?Normalize- strip trailing 0s, change anything equal to 0 to 0e0ucontextu0iiN(uNoneu
getcontextu_is_specialu_check_nansu_fixu_isinfinityu_dec_from_tripleu_signuEmaxuEtopuclampulenu_intu_exp(uselfucontextuansudupuexp_maxuenduexp((u,/opt/alt/python33/lib64/python3.3/decimal.pyu	normalize�	s$		&
uDecimal.normalizecCs�t|dd�}|d	kr*t�}n|d	krB|j}n|jsT|jr�|j||�}|rp|S|j�s�|j�r�|j�r�|j�r�t|�S|j	t
d�Sn|s|j|j|�}|j|jkr|j	t
�||kr|j	t�qn|S|j�|jko=|jknsR|j	t
d�S|s}t|jd|j�}|j|�S|j�}||jkr�|j	t
d�S||jd|jkr�|j	t
d�S|j|j|�}|j�|jkr|j	t
d�St|j�|jkr4|j	t
d�S|r_|j�|jkr_|j	t�n|j|jkr�||kr�|j	t�n|j	t
�n|j|�}|S(
u�Quantize self so its exponent is the same as that of exp.

        Similar to self._rescale(exp._exp) but with error checking.
        uraiseituquantize with one INFu)target exponent out of bounds in quantizeu0u9exponent of quantize result too large for current contextiu7quantize result has too many digits for current contextTN(u_convert_otheruTrueuNoneu
getcontexturoundingu_is_specialu_check_nansu_isinfinityuDecimalu_raise_erroruInvalidOperationu_rescaleu_expuRoundeduInexactuEtinyuEmaxu_dec_from_tripleu_signu_fixuadjustedupreculenu_intuEminu	Subnormal(uselfuexpuroundingucontextuwatchexpuansu
self_adjusted((u,/opt/alt/python33/lib64/python3.3/decimal.pyuquantize�	sb
	

(	
				uDecimal.quantizecCsbt|dd�}|js$|jrR|j�r<|j�pQ|j�oQ|j�S|j|jkS(u=Return True if self and other have the same exponent; otherwise
        return False.

        If either operand is a special value, the following rules are used:
           * return True if both operands are infinities
           * return True if both operands are NaNs
           * otherwise, return False.
        uraiseitT(u_convert_otheruTrueu_is_specialuis_nanuis_infiniteu_exp(uselfuotherucontext((u,/opt/alt/python33/lib64/python3.3/decimal.pyusame_quantum(
s
	uDecimal.same_quantumcCs|jrt|�S|s,t|jd|�S|j|kr`t|j|jd|j||�St|j�|j|}|dkr�t|jd|d�}d}n|j|}|||�}|jd|�p�d}|dkrtt	|�d�}nt|j||�S(usRescale self so that the exponent is exp, either by padding with zeros
        or by truncating digits, using the given rounding mode.

        Specials are returned without change.  This operation is
        quiet: it raises no flags, and uses no information from the
        context.

        exp = exp to scale to (an integer)
        rounding = rounding mode
        u0iu1iN(
u_is_specialuDecimalu_dec_from_tripleu_signu_expu_intulenu_pick_rounding_functionustruint(uselfuexpuroundingudigitsu
this_functionuchangeducoeff((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_rescale7
s"	
		
uDecimal._rescalecCs�|dkrtd��n|js+|r5t|�S|j|j�d||�}|j�|j�kr�|j|j�d||�}n|S(u"Round a nonzero, nonspecial Decimal to a fixed number of
        significant figures, using the given rounding mode.

        Infinities, NaNs and zeros are returned unaltered.

        This operation is quiet: it raises no flags, and uses no
        information from the context.

        iu'argument should be at least 1 in _roundi(u
ValueErroru_is_specialuDecimalu_rescaleuadjusted(uselfuplacesuroundinguans((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_roundY
s

 #uDecimal._roundcCs�|jr/|jd|�}|r%|St|�S|jdkrHt|�S|sat|jdd�S|dkryt�}n|dkr�|j}n|j	d|�}||kr�|j
t�n|j
t�|S(uVRounds to a nearby integer.

        If no rounding mode is specified, take the rounding mode from
        the context.  This method raises the Rounded and Inexact flags
        when appropriate.

        See also: to_integral_value, which does exactly the same as
        this method except that it doesn't raise Inexact or Rounded.
        ucontextiu0N(
u_is_specialu_check_nansuDecimalu_expu_dec_from_tripleu_signuNoneu
getcontexturoundingu_rescaleu_raise_erroruInexactuRounded(uselfuroundingucontextuans((u,/opt/alt/python33/lib64/python3.3/decimal.pyuto_integral_exactp
s$
	


uDecimal.to_integral_exactcCs�|dkrt�}n|dkr0|j}n|jr_|jd|�}|rU|St|�S|jdkrxt|�S|jd|�SdS(u@Rounds to the nearest integer, without raising inexact, rounded.ucontextiN(uNoneu
getcontexturoundingu_is_specialu_check_nansuDecimalu_expu_rescale(uselfuroundingucontextuans((u,/opt/alt/python33/lib64/python3.3/decimal.pyuto_integral_value�
s	

uDecimal.to_integral_valuecCs~|d
krt�}n|jre|jd|�}|r=|S|j�re|jdkret|�Sn|s�t|jd|jd�}|j	|�S|jdkr�|j
td�S|jd}t
|�}|jd?}|jd@r
|jd}t|j�d?d}n |j}t|j�dd?}||}|dkrZ|d|9}d}	n!t|d|�\}}
|
}	||8}d|}x+||}||kr�Pq�||d?}q�|	o�|||k}	|	r|dkr�|d|}n|d|9}||7}n|d	dkr/|d7}ntdt|�|�}|j�}|jt�}
|j	|�}|
|_|S(uReturn the square root of self.ucontextiu0iiusqrt(-x), x > 0i
idiNT(uNoneu
getcontextu_is_specialu_check_nansu_isinfinityu_signuDecimalu_dec_from_tripleu_expu_fixu_raise_erroruInvalidOperationuprecu_WorkRepuexpuintulenu_intuTrueudivmodustru
_shallow_copyu
_set_roundinguROUND_HALF_EVENurounding(uselfucontextuansuprecuopueuculushiftuexactu	remainderunuqurounding((u,/opt/alt/python33/lib64/python3.3/decimal.pyusqrt�
s`	





	
	




	uDecimal.sqrtcCst|dd�}|dkr*t�}n|js<|jr�|j�}|j�}|s`|r�|dkr�|dkr�|j|�S|dkr�|dkr�|j|�S|j||�Sn|j|�}|dkr�|j	|�}n|dkr�|}n|}|j|�S(u�Returns the larger value.

        Like max(self, other) except if one is not a number, returns
        NaN (and signals if one is sNaN).  Also rounds.
        uraiseitiiTNi����(
u_convert_otheruTrueuNoneu
getcontextu_is_specialu_isnanu_fixu_check_nansu_cmpu
compare_total(uselfuotherucontextusnuonucuans((u,/opt/alt/python33/lib64/python3.3/decimal.pyumaxs&

		uDecimal.maxcCst|dd�}|dkr*t�}n|js<|jr�|j�}|j�}|s`|r�|dkr�|dkr�|j|�S|dkr�|dkr�|j|�S|j||�Sn|j|�}|dkr�|j	|�}n|dkr�|}n|}|j|�S(u�Returns the smaller value.

        Like min(self, other) except if one is not a number, returns
        NaN (and signals if one is sNaN).  Also rounds.
        uraiseitiiTNi����(
u_convert_otheruTrueuNoneu
getcontextu_is_specialu_isnanu_fixu_check_nansu_cmpu
compare_total(uselfuotherucontextusnuonucuans((u,/opt/alt/python33/lib64/python3.3/decimal.pyumin-s&

	uDecimal.mincCsJ|jr
dS|jdkr dS|j|jd�}|dt|�kS(u"Returns whether self is an integeriNu0FT(u_is_specialuFalseu_expuTrueu_intulen(uselfurest((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
_isintegerOs	uDecimal._isintegercCs2|s|jdkrdS|jd|jdkS(u:Returns True if self is even.  Assumes self is an integer.iiu02468Ti����(u_expuTrueu_int(uself((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_isevenXsuDecimal._isevencCs9y|jt|j�dSWntk
r4dSYnXdS(u$Return the adjusted exponent of selfiiN(u_expulenu_intu	TypeError(uself((u,/opt/alt/python33/lib64/python3.3/decimal.pyuadjusted^s
uDecimal.adjustedcCs|S(u�Returns the same Decimal object.

        As we do not have different encodings for the same number, the
        received object already is in its canonical form.
        ((uself((u,/opt/alt/python33/lib64/python3.3/decimal.pyu	canonicalfsuDecimal.canonicalcCsAt|dd�}|j||�}|r.|S|j|d|�S(u�Compares self to the other operand numerically.

        It's pretty much like compare(), but all NaNs signal, with signaling
        NaNs taking precedence over quiet NaNs.
        uraiseitucontextT(u_convert_otheruTrueu_compare_check_nansucompare(uselfuotherucontextuans((u,/opt/alt/python33/lib64/python3.3/decimal.pyucompare_signalns
uDecimal.compare_signalcCs�t|dd�}|jr)|jr)tS|jr@|jr@tS|j}|j�}|j�}|sm|rs||kr�t|j�|jf}t|j�|jf}||kr�|r�tStSn||kr�|r�tStSntS|r0|dkr�tS|dkr
tS|dkrtS|dkrptSqs|dkr@tS|dkrPtS|dkr`tS|dkrstSn||kr�tS||kr�tS|j	|j	kr�|r�tStSn|j	|j	kr�|r�tStSntS(u�Compares self to other using the abstract representations.

        This is not like the standard compare, which use their numerical
        value. Note that a total ordering is defined for all possible abstract
        representations.
        uraiseitiiT(
u_convert_otheruTrueu_signu_NegativeOneu_Oneu_isnanulenu_intu_Zerou_exp(uselfuotherucontextusignuself_nanu	other_nanuself_keyu	other_key((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
compare_totalzsf	uDecimal.compare_totalcCs7t|dd�}|j�}|j�}|j|�S(u�Compares self to other using abstract repr., ignoring sign.

        Like compare_total, but with operand's sign ignored and assumed to be 0.
        uraiseitT(u_convert_otheruTrueucopy_absu
compare_total(uselfuotherucontextusuo((u,/opt/alt/python33/lib64/python3.3/decimal.pyucompare_total_mag�suDecimal.compare_total_magcCstd|j|j|j�S(u'Returns a copy with the sign set to 0. i(u_dec_from_tripleu_intu_expu_is_special(uself((u,/opt/alt/python33/lib64/python3.3/decimal.pyucopy_abs�suDecimal.copy_abscCsE|jr%td|j|j|j�Std|j|j|j�SdS(u&Returns a copy with the sign inverted.iiN(u_signu_dec_from_tripleu_intu_expu_is_special(uself((u,/opt/alt/python33/lib64/python3.3/decimal.pyucopy_negate�s	uDecimal.copy_negatecCs1t|dd�}t|j|j|j|j�S(u$Returns self with the sign of other.uraiseitT(u_convert_otheruTrueu_dec_from_tripleu_signu_intu_expu_is_special(uselfuotherucontext((u,/opt/alt/python33/lib64/python3.3/decimal.pyu	copy_sign�suDecimal.copy_signc
Cs�|d
krt�}n|jd|�}|r4|S|j�dkrJtS|sTtS|j�dkrpt|�S|j}|j�}|j	dkr�|t
t|jdd��kr�t
dd|jd�}n�|j	dkr(|t
t|j�dd��kr(t
dd|j�d�}n0|j	dkrj||krjt
ddd|dd|�}n�|j	dkr�||dkr�t
dd|d|d�}n�t|�}|j|j}}|jdkr�|}nd}xSt||||�\}	}
|	dd	t
t|	��|dr3Pn|d7}q�t
dt|	�|
�}|j�}|jt�}|j|�}||_|S(uReturns e ** self.ucontextiiiu1u0u9ii
Ni����(uNoneu
getcontextu_check_nansu_isinfinityu_Zerou_OneuDecimaluprecuadjustedu_signulenustruEmaxu_dec_from_tripleuEtinyu_WorkRepuintuexpusignu_dexpu
_shallow_copyu
_set_roundinguROUND_HALF_EVENu_fixurounding(uselfucontextuansupuadjuopucueuextraucoeffuexpurounding((u,/opt/alt/python33/lib64/python3.3/decimal.pyuexp�sJ
	26& "
&
	uDecimal.expcCsdS(u�Return True if self is canonical; otherwise return False.

        Currently, the encoding of a Decimal instance is always
        canonical, so this method returns True for any Decimal.
        T(uTrue(uself((u,/opt/alt/python33/lib64/python3.3/decimal.pyuis_canonical*suDecimal.is_canonicalcCs|jS(u�Return True if self is finite; otherwise return False.

        A Decimal instance is considered finite if it is neither
        infinite nor a NaN.
        (u_is_special(uself((u,/opt/alt/python33/lib64/python3.3/decimal.pyu	is_finite2suDecimal.is_finitecCs
|jdkS(u8Return True if self is infinite; otherwise return False.uF(u_exp(uself((u,/opt/alt/python33/lib64/python3.3/decimal.pyuis_infinite:suDecimal.is_infinitecCs
|jdkS(u>Return True if self is a qNaN or sNaN; otherwise return False.unuN(unuN(u_exp(uself((u,/opt/alt/python33/lib64/python3.3/decimal.pyuis_nan>suDecimal.is_nancCs?|js|rdS|dkr,t�}n|j|j�kS(u?Return True if self is a normal number; otherwise return False.FN(u_is_specialuFalseuNoneu
getcontextuEminuadjusted(uselfucontext((u,/opt/alt/python33/lib64/python3.3/decimal.pyu	is_normalBs
uDecimal.is_normalcCs
|jdkS(u;Return True if self is a quiet NaN; otherwise return False.un(u_exp(uself((u,/opt/alt/python33/lib64/python3.3/decimal.pyuis_qnanJsuDecimal.is_qnancCs
|jdkS(u8Return True if self is negative; otherwise return False.i(u_sign(uself((u,/opt/alt/python33/lib64/python3.3/decimal.pyu	is_signedNsuDecimal.is_signedcCs
|jdkS(u?Return True if self is a signaling NaN; otherwise return False.uN(u_exp(uself((u,/opt/alt/python33/lib64/python3.3/decimal.pyuis_snanRsuDecimal.is_snancCs?|js|rdS|dkr,t�}n|j�|jkS(u9Return True if self is subnormal; otherwise return False.FN(u_is_specialuFalseuNoneu
getcontextuadjusteduEmin(uselfucontext((u,/opt/alt/python33/lib64/python3.3/decimal.pyuis_subnormalVs
uDecimal.is_subnormalcCs|jo|jdkS(u6Return True if self is a zero; otherwise return False.u0(u_is_specialu_int(uself((u,/opt/alt/python33/lib64/python3.3/decimal.pyuis_zero^suDecimal.is_zerocCs�|jt|j�d}|dkrBtt|dd��dS|dkrnttd|dd��dSt|�}|j|j}}|dkr�t|d|�}t|�}t|�t|�||kS|ttd||��dS(u�Compute a lower bound for the adjusted exponent of self.ln().
        In other words, compute r such that self.ln() >= 10**r.  Assumes
        that self is finite and positive and that self != 1.
        iii
iii����i����(u_expulenu_intustru_WorkRepuintuexp(uselfuadjuopucueunumuden((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
_ln_exp_boundbs uDecimal._ln_exp_boundc
Css|d	krt�}n|jd|�}|r4|S|s>tS|j�dkrTtS|tkrdtS|jdkr�|j	t
d�St|�}|j|j
}}|j}||j�d}xOt|||�}|ddttt|���|drPn|d7}q�tt|dk�tt|��|�}|j�}|jt�}	|j|�}|	|_|S(
u/Returns the natural (base e) logarithm of self.ucontextiuln of a negative valueiii
iiN(uNoneu
getcontextu_check_nansu_NegativeInfinityu_isinfinityu	_Infinityu_Oneu_Zerou_signu_raise_erroruInvalidOperationu_WorkRepuintuexpuprecu
_ln_exp_boundu_dlogulenustruabsu_dec_from_tripleu
_shallow_copyu
_set_roundinguROUND_HALF_EVENu_fixurounding(
uselfucontextuansuopucueupuplacesucoeffurounding((u,/opt/alt/python33/lib64/python3.3/decimal.pyuln{s:		,
+	u
Decimal.lncCs|jt|j�d}|dkr:tt|��dS|dkr^ttd|��dSt|�}|j|j}}|dkr�t|d|�}td|�}t|�t|�||kdStd||�}t|�||dkdS(	u�Compute a lower bound for the adjusted exponent of self.log10().
        In other words, find r such that self.log10() >= 10**r.
        Assumes that self is finite and positive and that self != 1.
        iiii
i�u231i����i����(u_expulenu_intustru_WorkRepuintuexp(uselfuadjuopucueunumuden((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_log10_exp_bound�s"uDecimal._log10_exp_boundc
Cs�|dkrt�}n|jd|�}|r4|S|s>tS|j�dkrTtS|jdkrs|jtd�S|j	ddkr�|j	dd�dt
|j	�dkr�t|jt
|j	�d�}n�t
|�}|j|j}}|j}||j�d}xOt|||�}|d	d
t
tt|���|drTPn|d7}qtt|dk�tt|��|�}|j�}|jt�}	|j|�}|	|_|S(u&Returns the base 10 logarithm of self.ucontextiulog10 of a negative valueiu1Nu0iii
i(uNoneu
getcontextu_check_nansu_NegativeInfinityu_isinfinityu	_Infinityu_signu_raise_erroruInvalidOperationu_intulenuDecimalu_expu_WorkRepuintuexpuprecu_log10_exp_boundu_dlog10ustruabsu_dec_from_tripleu
_shallow_copyu
_set_roundinguROUND_HALF_EVENu_fixurounding(
uselfucontextuansuopucueupuplacesucoeffurounding((u,/opt/alt/python33/lib64/python3.3/decimal.pyulog10�s:	=#	,
+	u
Decimal.log10cCs||jd|�}|r|S|dkr4t�}n|j�rDtS|s]|jtdd�St|j��}|j	|�S(uM Returns the exponent of the magnitude of self's MSD.

        The result is the integer which is the exponent of the magnitude
        of the most significant digit of self (as though it were truncated
        to a single digit while maintaining the value of that digit and
        without limiting the resulting exponent).
        ucontextulogb(0)iN(
u_check_nansuNoneu
getcontextu_isinfinityu	_Infinityu_raise_erroruDivisionByZerouDecimaluadjustedu_fix(uselfucontextuans((u,/opt/alt/python33/lib64/python3.3/decimal.pyulogb�s	uDecimal.logbcCsJ|jdks|jdkr"dSx!|jD]}|dkr,dSq,WdS(u�Return True if self is a logical operand.

        For being logical, it must be a finite number with a sign of 0,
        an exponent of 0, and a coefficient whose digits must all be
        either 0 or 1.
        iu01FT(u_signu_expuFalseu_intuTrue(uselfudig((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
_islogical
suDecimal._islogicalcCs�|jt|�}|dkr0d||}n#|dkrS||jd�}n|jt|�}|dkr�d||}n#|dkr�||jd�}n||fS(Niu0(upreculen(uselfucontextuopauopbudif((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
_fill_logical*
suDecimal._fill_logicalcCs�|dkrt�}nt|dd�}|j�sD|j�rQ|jt�S|j||j|j�\}}dj	dd�t
||�D��}td|jd�p�dd�S(	u;Applies an 'and' operation between self and other's digits.uraiseitucSs2g|](\}}tt|�t|�@��qS((ustruint(u.0uaub((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
<listcomp>E
s	u'Decimal.logical_and.<locals>.<listcomp>iu0NT(
uNoneu
getcontextu_convert_otheruTrueu
_islogicalu_raise_erroruInvalidOperationu
_fill_logicalu_intujoinuzipu_dec_from_tripleulstrip(uselfuotherucontextuopauopburesult((u,/opt/alt/python33/lib64/python3.3/decimal.pyulogical_and7
s
!%uDecimal.logical_andcCs;|dkrt�}n|jtdd|jd�|�S(uInvert all its digits.iu1N(uNoneu
getcontextulogical_xoru_dec_from_tripleuprec(uselfucontext((u,/opt/alt/python33/lib64/python3.3/decimal.pyulogical_invertH
suDecimal.logical_invertcCs�|dkrt�}nt|dd�}|j�sD|j�rQ|jt�S|j||j|j�\}}dj	dd�t
||�D��}td|jd�p�dd�S(	u:Applies an 'or' operation between self and other's digits.uraiseitucSs2g|](\}}tt|�t|�B��qS((ustruint(u.0uaub((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
<listcomp>]
s	u&Decimal.logical_or.<locals>.<listcomp>iu0NT(
uNoneu
getcontextu_convert_otheruTrueu
_islogicalu_raise_erroruInvalidOperationu
_fill_logicalu_intujoinuzipu_dec_from_tripleulstrip(uselfuotherucontextuopauopburesult((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
logical_orO
s
!%uDecimal.logical_orcCs�|dkrt�}nt|dd�}|j�sD|j�rQ|jt�S|j||j|j�\}}dj	dd�t
||�D��}td|jd�p�dd�S(	u;Applies an 'xor' operation between self and other's digits.uraiseitucSs2g|](\}}tt|�t|�A��qS((ustruint(u.0uaub((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
<listcomp>n
s	u'Decimal.logical_xor.<locals>.<listcomp>iu0NT(
uNoneu
getcontextu_convert_otheruTrueu
_islogicalu_raise_erroruInvalidOperationu
_fill_logicalu_intujoinuzipu_dec_from_tripleulstrip(uselfuotherucontextuopauopburesult((u,/opt/alt/python33/lib64/python3.3/decimal.pyulogical_xor`
s
!%uDecimal.logical_xorcCst|dd�}|dkr*t�}n|js<|jr�|j�}|j�}|s`|r�|dkr�|dkr�|j|�S|dkr�|dkr�|j|�S|j||�Sn|j�j	|j��}|dkr�|j
|�}n|dkr|}n|}|j|�S(u8Compares the values numerically with their sign ignored.uraiseitiiTNi����(u_convert_otheruTrueuNoneu
getcontextu_is_specialu_isnanu_fixu_check_nansucopy_absu_cmpu
compare_total(uselfuotherucontextusnuonucuans((u,/opt/alt/python33/lib64/python3.3/decimal.pyumax_magq
s&

	uDecimal.max_magcCst|dd�}|dkr*t�}n|js<|jr�|j�}|j�}|s`|r�|dkr�|dkr�|j|�S|dkr�|dkr�|j|�S|j||�Sn|j�j	|j��}|dkr�|j
|�}n|dkr|}n|}|j|�S(u8Compares the values numerically with their sign ignored.uraiseitiiTNi����(u_convert_otheruTrueuNoneu
getcontextu_is_specialu_isnanu_fixu_check_nansucopy_absu_cmpu
compare_total(uselfuotherucontextusnuonucuans((u,/opt/alt/python33/lib64/python3.3/decimal.pyumin_mag�
s&

	uDecimal.min_magcCs�|dkrt�}n|jd|�}|r4|S|j�dkrJtS|j�dkrytdd|j|j��S|j�}|j	t
�|j�|j|�}||kr�|S|j
tdd|j�d�|�S(u=Returns the largest representable number smaller than itself.ucontextiiu9u1Ni����(uNoneu
getcontextu_check_nansu_isinfinityu_NegativeInfinityu_dec_from_tripleuprecuEtopucopyu
_set_roundinguROUND_FLOORu_ignore_all_flagsu_fixu__sub__uEtiny(uselfucontextuansunew_self((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
next_minus�
s"

uDecimal.next_minuscCs�|dkrt�}n|jd|�}|r4|S|j�dkrJtS|j�dkrytdd|j|j��S|j�}|j	t
�|j�|j|�}||kr�|S|j
tdd|j�d�|�S(u=Returns the smallest representable number larger than itself.ucontextiu9iu1Ni����(uNoneu
getcontextu_check_nansu_isinfinityu	_Infinityu_dec_from_tripleuprecuEtopucopyu
_set_roundingu
ROUND_CEILINGu_ignore_all_flagsu_fixu__add__uEtiny(uselfucontextuansunew_self((u,/opt/alt/python33/lib64/python3.3/decimal.pyu	next_plus�
s"

uDecimal.next_pluscCs@t|dd�}|dkr*t�}n|j||�}|rF|S|j|�}|dkrn|j|�S|dkr�|j|�}n|j|�}|j	�r�|j
td|j�|j
t
�|j
t�nb|j�|jkr<|j
t�|j
t�|j
t
�|j
t�|s<|j
t�q<n|S(u�Returns the number closest to self, in the direction towards other.

        The result is the closest representable number to self
        (excluding self) that is in the direction towards other,
        unless both have the same value.  If the two operands are
        numerically equal, then the result is a copy of self with the
        sign set to be the same as the sign of other.
        uraiseitiiu Infinite result from next_towardTNi����(u_convert_otheruTrueuNoneu
getcontextu_check_nansu_cmpu	copy_signu	next_plusu
next_minusu_isinfinityu_raise_erroruOverflowu_signuInexactuRoundeduadjusteduEminu	Underflowu	SubnormaluClamped(uselfuotherucontextuansu
comparison((u,/opt/alt/python33/lib64/python3.3/decimal.pyunext_toward�
s4	
	





uDecimal.next_towardcCs�|j�rdS|j�r dS|j�}|dkr<dS|dkrLdS|j�rl|jredSdSn|d
kr�t�}n|jd|�r�|jr�d	Sd
Sn|jr�dSdSd
S(uReturns an indication of the class of self.

        The class is one of the following strings:
          sNaN
          NaN
          -Infinity
          -Normal
          -Subnormal
          -Zero
          +Zero
          +Subnormal
          +Normal
          +Infinity
        usNaNuNaNiu	+Infinityu	-Infinityu-Zerou+Zeroucontextu
-Subnormalu
+Subnormalu-Normalu+NormalNi����(uis_snanuis_qnanu_isinfinityuis_zerou_signuNoneu
getcontextuis_subnormal(uselfucontextuinf((u,/opt/alt/python33/lib64/python3.3/decimal.pyunumber_class	s,			uDecimal.number_classcCs
td�S(u'Just returns 10, as this is Decimal, :)i
(uDecimal(uself((u,/opt/alt/python33/lib64/python3.3/decimal.pyuradix3su
Decimal.radixcCsV|dkrt�}nt|dd�}|j||�}|rF|S|jdkrb|jt�S|jt	|�ko�|jkns�|jt�S|j
�r�t|�St	|�}|j}|jt
|�}|dkr�d||}n |dkr||d�}n||d�|d|�}t|j|jd�pLd|j�S(u5Returns a rotated copy of self, value-of-other times.uraiseitiu0NT(uNoneu
getcontextu_convert_otheruTrueu_check_nansu_expu_raise_erroruInvalidOperationuprecuintu_isinfinityuDecimalu_intulenu_dec_from_tripleu_signulstrip(uselfuotherucontextuansutoroturotdigutopadurotated((u,/opt/alt/python33/lib64/python3.3/decimal.pyurotate7s,
)

		uDecimal.rotatecCs|dkrt�}nt|dd�}|j||�}|rF|S|jdkrb|jt�Sd|j|j	}d|j|j	}|t
|�ko�|kns�|jt�S|j�r�t|�St
|j|j|jt
|��}|j|�}|S(u>Returns self operand after adding the second value to its exp.uraiseitiiNTi����(uNoneu
getcontextu_convert_otheruTrueu_check_nansu_expu_raise_erroruInvalidOperationuEmaxuprecuintu_isinfinityuDecimalu_dec_from_tripleu_signu_intu_fix(uselfuotherucontextuansuliminfulimsupud((u,/opt/alt/python33/lib64/python3.3/decimal.pyuscalebXs"
"

%uDecimal.scalebcCsy|dkrt�}nt|dd�}|j||�}|rF|S|jdkrb|jt�S|jt	|�ko�|jkns�|jt�S|j
�r�t|�St	|�}|j}|jt
|�}|dkr�d||}n |dkr||d�}n|dkr2|d|�}n"|d|}||jd�}t|j|jd�pod|j�S(u5Returns a shifted copy of self, value-of-other times.uraiseitiu0NT(uNoneu
getcontextu_convert_otheruTrueu_check_nansu_expu_raise_erroruInvalidOperationuprecuintu_isinfinityuDecimalu_intulenu_dec_from_tripleu_signulstrip(uselfuotherucontextuansutoroturotdigutopadushifted((u,/opt/alt/python33/lib64/python3.3/decimal.pyushiftqs2
)

		u
Decimal.shiftcCs|jt|�ffS(N(u	__class__ustr(uself((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
__reduce__�suDecimal.__reduce__cCs)t|�tkr|S|jt|��S(N(utypeuDecimalu	__class__ustr(uself((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__copy__�suDecimal.__copy__cCs)t|�tkr|S|jt|��S(N(utypeuDecimalu	__class__ustr(uselfumemo((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__deepcopy__�suDecimal.__deepcopy__cCs|dkrt�}nt|d|�}|jrgt|j|�}t|j��}t|||�S|ddkr�ddg|j	|d<n|ddkr�t
|j|j|jd�}n|j
}|d}|dk	rn|ddkr|j|d	|�}qn|dd
kr1|j||�}qn|ddkrnt|j�|krn|j||�}qnn|r�|jdkr�|dd
kr�|jd|�}n|jt|j�}	|ddkr�|r�|dk	r�d	|}
qNd	}
nV|dd
kr|	}
n=|ddkrN|jdkrE|	dkrE|	}
qNd	}
n|
dkrud}d|
|j}nh|
t|j�kr�|jd|
t|j�}d}n,|jd|
�p�d}|j|
d�}|	|
}
t|j|||
|�S(u|Format a Decimal instance according to the given specifier.

        The specifier should be a standard format specifier, with the
        form described in PEP 3101.  Formatting types 'e', 'E', 'f',
        'F', 'g', 'G', 'n' and '%' are supported.  If the formatting
        type is omitted it defaults to 'g' or 'G', depending on the
        value of context.capitals.
        u_localeconvutypeuguGu%iu	precisionueEiufF%ugGiiu0uNi����(uNoneu
getcontextu_parse_format_specifieru_is_specialu_format_signu_signustrucopy_absu
_format_alignucapitalsu_dec_from_tripleu_intu_expuroundingu_roundu_rescaleulenu_format_number(uselfu	specifierucontextu_localeconvuspecusignubodyuroundingu	precisionu
leftdigitsudotplaceuintpartufracpartuexp((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
__format__�sV	"	
%&
					
uDecimal.__format__N(u_expu_intu_signu_is_specialFT(�u__name__u
__module__u__qualname__u__doc__u	__slots__uNoneu__new__u
from_floatuclassmethodu_isnanu_isinfinityu_check_nansu_compare_check_nansu__bool__u_cmpu__eq__u__ne__u__lt__u__le__u__gt__u__ge__ucompareu__hash__uas_tupleu__repr__uFalseu__str__u
to_eng_stringu__neg__u__pos__uTrueu__abs__u__add__u__radd__u__sub__u__rsub__u__mul__u__rmul__u__truediv__u_divideu__rtruediv__u
__divmod__u__rdivmod__u__mod__u__rmod__uremainder_nearu__floordiv__u
__rfloordiv__u	__float__u__int__u	__trunc__urealupropertyuimagu	conjugateu__complex__u_fix_nanu_fixu_round_downu	_round_upu_round_half_upu_round_half_downu_round_half_evenu_round_ceilingu_round_flooru_round_05upudictu_pick_rounding_functionu	__round__u	__floor__u__ceil__ufmau
_power_modulou_power_exactu__pow__u__rpow__u	normalizeuquantizeusame_quantumu_rescaleu_rounduto_integral_exactuto_integral_valueuto_integralusqrtumaxuminu
_isintegeru_isevenuadjustedu	canonicalucompare_signalu
compare_totalucompare_total_magucopy_absucopy_negateu	copy_signuexpuis_canonicalu	is_finiteuis_infiniteuis_nanu	is_normaluis_qnanu	is_signeduis_snanuis_subnormaluis_zerou
_ln_exp_boundulnu_log10_exp_boundulog10ulogbu
_islogicalu
_fill_logicalulogical_andulogical_invertu
logical_orulogical_xorumax_magumin_magu
next_minusu	next_plusunext_towardunumber_classuradixurotateuscalebushiftu
__reduce__u__copy__u__deepcopy__u
__format__(u
__locals__((u,/opt/alt/python33/lib64/python3.3/decimal.pyuDecimal$s�&
 !@					4
V7;!$K

f		>,U��G"c*"	IK23
.*!'cCs7tjt�}||_||_||_||_|S(u�Create a decimal instance directly, without any validation,
    normalization (e.g. removal of leading zeros) or argument
    conversion.

    This function is for *internal use only*.
    (uobjectu__new__uDecimalu_signu_intu_expu_is_special(usignucoefficientuexponentuspecialuself((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_dec_from_triple�s				u_dec_from_triplecBs>|EeZdZdZdd�Zdd�Zdd�ZdS(	u_ContextManageru�Context manager class to support localcontext().

      Sets a copy of the supplied context in __enter__() and restores
      the previous decimal context in __exit__()
    cCs|j�|_dS(N(ucopyunew_context(uselfunew_context((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__init__su_ContextManager.__init__cCs t�|_t|j�|jS(N(u
getcontextu
saved_contextu
setcontextunew_context(uself((u,/opt/alt/python33/lib64/python3.3/decimal.pyu	__enter__s
u_ContextManager.__enter__cCst|j�dS(N(u
setcontextu
saved_context(uselfutuvutb((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__exit__su_ContextManager.__exit__N(u__name__u
__module__u__qualname__u__doc__u__init__u	__enter__u__exit__(u
__locals__((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_ContextManagersu_ContextManagercBs|EeZdZdZd�d�d�d�d�d�d�d�d�dd�	Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZeZd�dd�Zdd�Zdd�Zdd�Zd�Zd d!�Zd"d#�Zd$d%�Zd&d'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Z d7d8�Z!d9d:�Z"d;d<�Z#d=d>�Z$d?d@�Z%dAdB�Z&dCdD�Z'dEdF�Z(dGdH�Z)dIdJ�Z*dKdL�Z+dMdN�Z,dOdP�Z-dQdR�Z.dSdT�Z/dUdV�Z0dWdX�Z1dYdZ�Z2d[d\�Z3d]d^�Z4d_d`�Z5dadb�Z6dcdd�Z7dedf�Z8dgdh�Z9didj�Z:dkdl�Z;dmdn�Z<dodp�Z=dqdr�Z>dsdt�Z?dudv�Z@dwdx�ZAdydz�ZBd{d|�ZCd}d~�ZDdd��ZEd�d��ZFd�d��ZGd�d��ZHd�d�d��ZId�d��ZJd�d��ZKd�d��ZLd�d��ZMd�d��ZNd�d��ZOd�d��ZPd�d��ZQd�d��ZRd�d��ZSd�d��ZTd�d��ZUd�d��ZVd�d��ZWeWZXd�S(�uContextu�Contains the context for a Decimal instance.

    Contains:
    prec - precision (for use in rounding, division, square roots..)
    rounding - rounding type (how you round)
    traps - If traps[exception] = 1, then the exception is
                    raised when it is caused.  Otherwise, a value is
                    substituted in.
    flags  - When an exception is caused, flags[exception] is set.
             (Whether or not the trap_enabler is set)
             Should be reset by user of Decimal instance.
    Emin -   Minimum exponent
    Emax -   Maximum exponent
    capitals -      If 1, 1*10^1 is printed as 1E+1.
                    If 0, printed as 1e1
    clamp -  If 1, change exponents if too high (Default 0)
    c
s�y
t}
Wntk
rYnX|dk	r1|n|
j|_|dk	rO|n|
j|_|dk	rm|n|
j|_|dk	r�|n|
j|_|dk	r�|n|
j|_|dk	r�|n|
j|_|	dkr�g|_	n	|	|_	�dkr|
j
j�|_
nAt�t
�sMt
�fdd�t�D��|_
n	�|_
�dkrzt
jtd�|_nAt�t
�s�t
�fdd�t�D��|_n	�|_dS(Nc3s'|]}|t|�k�fVqdS(N(uint(u.0us(utraps(u,/opt/alt/python33/lib64/python3.3/decimal.pyu	<genexpr>Jsu#Context.__init__.<locals>.<genexpr>ic3s'|]}|t|�k�fVqdS(N(uint(u.0us(uflags(u,/opt/alt/python33/lib64/python3.3/decimal.pyu	<genexpr>Qs(uDefaultContextu	NameErroruNoneuprecuroundinguEminuEmaxucapitalsuclampu_ignored_flagsutrapsucopyu
isinstanceudictu_signalsufromkeysuflags(uselfuprecuroundinguEminuEmaxucapitalsuclampuflagsutrapsu_ignored_flagsudc((uflagsutrapsu,/opt/alt/python33/lib64/python3.3/decimal.pyu__init__1s.

	)	)uContext.__init__cCs�t|t�s"td|��n|dkr\||kr�td||||f��q�nq|dkr�||kr�td||||f��q�n7||ks�||kr�td||||f��ntj|||�S(Nu%s must be an integeru-infu%s must be in [%s, %d]. got: %suinfu%s must be in [%d, %s]. got: %su%s must be in [%d, %d]. got %s(u
isinstanceuintu	TypeErroru
ValueErroruobjectu__setattr__(uselfunameuvalueuvminuvmax((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_set_integer_checkUs""uContext._set_integer_checkcCs�t|t�s"td|��nx-|D]%}|tkr)td|��q)q)Wx-tD]%}||krYtd|��qYqYWtj|||�S(Nu%s must be a signal dictu%s is not a valid signal dict(u
isinstanceudictu	TypeErroru_signalsuKeyErroruobjectu__setattr__(uselfunameudukey((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_set_signal_dictcs

uContext._set_signal_dictcCsC|dkr"|j||dd�S|dkrD|j||dd�S|dkrf|j||dd�S|dkr�|j||dd�S|d	kr�|j||dd�S|d
kr�|tkr�td|��ntj|||�S|dks|d
kr|j||�S|dkr/tj|||�Std|��dS(NupreciuinfuEminu-infiuEmaxucapitalsuclampuroundingu%s: invalid rounding modeuflagsutrapsu_ignored_flagsu.'decimal.Context' object has no attribute '%s'(u_set_integer_checku_rounding_modesu	TypeErroruobjectu__setattr__u_set_signal_dictuAttributeError(uselfunameuvalue((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__setattr__ns(uContext.__setattr__cCstd|��dS(Nu%s cannot be deleted(uAttributeError(uselfuname((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__delattr__�suContext.__delattr__c	Csodd�|jj�D�}dd�|jj�D�}|j|j|j|j|j|j|j	||ffS(NcSs"g|]\}}|r|�qS(((u.0usiguv((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
<listcomp>�s	u&Context.__reduce__.<locals>.<listcomp>cSs"g|]\}}|r|�qS(((u.0usiguv((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
<listcomp>�s	(
uflagsuitemsutrapsu	__class__uprecuroundinguEminuEmaxucapitalsuclamp(uselfuflagsutraps((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
__reduce__�s
uContext.__reduce__cCs�g}|jdt|��dd�|jj�D�}|jddj|�d�dd�|jj�D�}|jddj|�d�dj|�d	S(
uShow the current context.urContext(prec=%(prec)d, rounding=%(rounding)s, Emin=%(Emin)d, Emax=%(Emax)d, capitals=%(capitals)d, clamp=%(clamp)dcSs%g|]\}}|r|j�qS((u__name__(u.0ufuv((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
<listcomp>�s	u$Context.__repr__.<locals>.<listcomp>uflags=[u, u]cSs%g|]\}}|r|j�qS((u__name__(u.0utuv((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
<listcomp>�s	utraps=[u)(uappenduvarsuflagsuitemsujoinutraps(uselfusunames((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__repr__�s	uContext.__repr__cCs%x|jD]}d|j|<q
WdS(uReset all flags to zeroiN(uflags(uselfuflag((u,/opt/alt/python33/lib64/python3.3/decimal.pyuclear_flags�suContext.clear_flagscCs%x|jD]}d|j|<q
WdS(uReset all traps to zeroiN(utraps(uselfuflag((u,/opt/alt/python33/lib64/python3.3/decimal.pyuclear_traps�suContext.clear_trapsc
CsCt|j|j|j|j|j|j|j|j|j	�	}|S(u!Returns a shallow copy from self.(
uContextuprecuroundinguEminuEmaxucapitalsuclampuflagsutrapsu_ignored_flags(uselfunc((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
_shallow_copy�suContext._shallow_copyc
CsOt|j|j|j|j|j|j|jj�|j	j�|j
�	}|S(uReturns a deep copy from self.(uContextuprecuroundinguEminuEmaxucapitalsuclampuflagsucopyutrapsu_ignored_flags(uselfunc((u,/opt/alt/python33/lib64/python3.3/decimal.pyucopy�s
uContext.copycGsqtj||�}||jkr4|�j||�Sd|j|<|j|sa|�j||�S||��dS(u#Handles an error

        If the flag is in _ignored_flags, returns the default response.
        Otherwise, it sets the flag, then, if the corresponding
        trap_enabler is set, it reraises the exception.  Otherwise, it returns
        the default value after setting the flag.
        iN(u_condition_mapugetu_ignored_flagsuhandleuflagsutraps(uselfu	conditionuexplanationuargsuerror((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_raise_error�s

uContext._raise_errorcCs
|jt�S(u$Ignore all flags, if they are raised(u
_ignore_flagsu_signals(uself((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_ignore_all_flags�suContext._ignore_all_flagscGs |jt|�|_t|�S(u$Ignore the flags, if they are raised(u_ignored_flagsulist(uselfuflags((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
_ignore_flags�suContext._ignore_flagscGsQ|r,t|dttf�r,|d}nx|D]}|jj|�q3WdS(u+Stop ignoring the flags, if they are raisediN(u
isinstanceutupleulistu_ignored_flagsuremove(uselfuflagsuflag((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
_regard_flags�s

uContext._regard_flagscCst|j|jd�S(u!Returns Etiny (= Emin - prec + 1)i(uintuEminuprec(uself((u,/opt/alt/python33/lib64/python3.3/decimal.pyuEtiny�su
Context.EtinycCst|j|jd�S(u,Returns maximum exponent (= Emax - prec + 1)i(uintuEmaxuprec(uself((u,/opt/alt/python33/lib64/python3.3/decimal.pyuEtop�suContext.EtopcCs|j}||_|S(u�Sets the rounding type.

        Sets the rounding type, and returns the current (previous)
        rounding type.  Often used like:

        context = context.copy()
        # so you don't change the calling context
        # if an error occurs in the middle.
        rounding = context._set_rounding(ROUND_UP)
        val = self.__sub__(other, context=context)
        context._set_rounding(rounding)

        This will make it round up for that operation.
        (urounding(uselfutypeurounding((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
_set_rounding�s		uContext._set_roundingu0cCs�t|t�r1||j�kr1|jtd�St|d|�}|j�r~t|j�|j	|j
kr~|jtd�S|j|�S(u�Creates a new Decimal instance but using self as context.

        This method implements the to-number operation of the
        IBM Decimal specification.u/no trailing or leading whitespace is permitted.ucontextudiagnostic info too long in NaN(u
isinstanceustrustripu_raise_erroruConversionSyntaxuDecimalu_isnanulenu_intuprecuclampu_fix(uselfunumud((u,/opt/alt/python33/lib64/python3.3/decimal.pyucreate_decimal�s!	+	uContext.create_decimalcCstj|�}|j|�S(u�Creates a new Decimal instance from a float but rounding using self
        as the context.

        >>> context = Context(prec=5, rounding=ROUND_DOWN)
        >>> context.create_decimal_from_float(3.1415926535897932)
        Decimal('3.1415')
        >>> context = Context(prec=5, traps=[Inexact])
        >>> context.create_decimal_from_float(3.1415926535897932)
        Traceback (most recent call last):
            ...
        decimal.Inexact: None

        (uDecimalu
from_floatu_fix(uselfufud((u,/opt/alt/python33/lib64/python3.3/decimal.pyucreate_decimal_from_floatsu!Context.create_decimal_from_floatcCs"t|dd�}|jd|�S(u[Returns the absolute value of the operand.

        If the operand is negative, the result is the same as using the minus
        operation on the operand.  Otherwise, the result is the same as using
        the plus operation on the operand.

        >>> ExtendedContext.abs(Decimal('2.1'))
        Decimal('2.1')
        >>> ExtendedContext.abs(Decimal('-100'))
        Decimal('100')
        >>> ExtendedContext.abs(Decimal('101.5'))
        Decimal('101.5')
        >>> ExtendedContext.abs(Decimal('-101.5'))
        Decimal('101.5')
        >>> ExtendedContext.abs(-1)
        Decimal('1')
        uraiseitucontextT(u_convert_otheruTrueu__abs__(uselfua((u,/opt/alt/python33/lib64/python3.3/decimal.pyuabs"suContext.abscCsNt|dd�}|j|d|�}|tkrFtd|��n|SdS(u�Return the sum of the two operands.

        >>> ExtendedContext.add(Decimal('12'), Decimal('7.00'))
        Decimal('19.00')
        >>> ExtendedContext.add(Decimal('1E+2'), Decimal('1.01E+4'))
        Decimal('1.02E+4')
        >>> ExtendedContext.add(1, Decimal(2))
        Decimal('3')
        >>> ExtendedContext.add(Decimal(8), 5)
        Decimal('13')
        >>> ExtendedContext.add(5, 5)
        Decimal('10')
        uraiseitucontextuUnable to convert %s to DecimalNT(u_convert_otheruTrueu__add__uNotImplementedu	TypeError(uselfuaubur((u,/opt/alt/python33/lib64/python3.3/decimal.pyuadd7s
uContext.addcCst|j|��S(N(ustru_fix(uselfua((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_applyLsuContext._applycCs(t|t�std��n|j�S(u�Returns the same Decimal object.

        As we do not have different encodings for the same number, the
        received object already is in its canonical form.

        >>> ExtendedContext.canonical(Decimal('2.50'))
        Decimal('2.50')
        u,canonical requires a Decimal as an argument.(u
isinstanceuDecimalu	TypeErroru	canonical(uselfua((u,/opt/alt/python33/lib64/python3.3/decimal.pyu	canonicalOs	uContext.canonicalcCs%t|dd�}|j|d|�S(u�Compares values numerically.

        If the signs of the operands differ, a value representing each operand
        ('-1' if the operand is less than zero, '0' if the operand is zero or
        negative zero, or '1' if the operand is greater than zero) is used in
        place of that operand for the comparison instead of the actual
        operand.

        The comparison is then effected by subtracting the second operand from
        the first and then returning a value according to the result of the
        subtraction: '-1' if the result is less than zero, '0' if the result is
        zero or negative zero, or '1' if the result is greater than zero.

        >>> ExtendedContext.compare(Decimal('2.1'), Decimal('3'))
        Decimal('-1')
        >>> ExtendedContext.compare(Decimal('2.1'), Decimal('2.1'))
        Decimal('0')
        >>> ExtendedContext.compare(Decimal('2.1'), Decimal('2.10'))
        Decimal('0')
        >>> ExtendedContext.compare(Decimal('3'), Decimal('2.1'))
        Decimal('1')
        >>> ExtendedContext.compare(Decimal('2.1'), Decimal('-3'))
        Decimal('1')
        >>> ExtendedContext.compare(Decimal('-3'), Decimal('2.1'))
        Decimal('-1')
        >>> ExtendedContext.compare(1, 2)
        Decimal('-1')
        >>> ExtendedContext.compare(Decimal(1), 2)
        Decimal('-1')
        >>> ExtendedContext.compare(1, Decimal(2))
        Decimal('-1')
        uraiseitucontextT(u_convert_otheruTrueucompare(uselfuaub((u,/opt/alt/python33/lib64/python3.3/decimal.pyucompare\s!uContext.comparecCs%t|dd�}|j|d|�S(uCompares the values of the two operands numerically.

        It's pretty much like compare(), but all NaNs signal, with signaling
        NaNs taking precedence over quiet NaNs.

        >>> c = ExtendedContext
        >>> c.compare_signal(Decimal('2.1'), Decimal('3'))
        Decimal('-1')
        >>> c.compare_signal(Decimal('2.1'), Decimal('2.1'))
        Decimal('0')
        >>> c.flags[InvalidOperation] = 0
        >>> print(c.flags[InvalidOperation])
        0
        >>> c.compare_signal(Decimal('NaN'), Decimal('2.1'))
        Decimal('NaN')
        >>> print(c.flags[InvalidOperation])
        1
        >>> c.flags[InvalidOperation] = 0
        >>> print(c.flags[InvalidOperation])
        0
        >>> c.compare_signal(Decimal('sNaN'), Decimal('2.1'))
        Decimal('NaN')
        >>> print(c.flags[InvalidOperation])
        1
        >>> c.compare_signal(-1, 2)
        Decimal('-1')
        >>> c.compare_signal(Decimal(-1), 2)
        Decimal('-1')
        >>> c.compare_signal(-1, Decimal(2))
        Decimal('-1')
        uraiseitucontextT(u_convert_otheruTrueucompare_signal(uselfuaub((u,/opt/alt/python33/lib64/python3.3/decimal.pyucompare_signal�s uContext.compare_signalcCst|dd�}|j|�S(u+Compares two operands using their abstract representation.

        This is not like the standard compare, which use their numerical
        value. Note that a total ordering is defined for all possible abstract
        representations.

        >>> ExtendedContext.compare_total(Decimal('12.73'), Decimal('127.9'))
        Decimal('-1')
        >>> ExtendedContext.compare_total(Decimal('-127'),  Decimal('12'))
        Decimal('-1')
        >>> ExtendedContext.compare_total(Decimal('12.30'), Decimal('12.3'))
        Decimal('-1')
        >>> ExtendedContext.compare_total(Decimal('12.30'), Decimal('12.30'))
        Decimal('0')
        >>> ExtendedContext.compare_total(Decimal('12.3'),  Decimal('12.300'))
        Decimal('1')
        >>> ExtendedContext.compare_total(Decimal('12.3'),  Decimal('NaN'))
        Decimal('-1')
        >>> ExtendedContext.compare_total(1, 2)
        Decimal('-1')
        >>> ExtendedContext.compare_total(Decimal(1), 2)
        Decimal('-1')
        >>> ExtendedContext.compare_total(1, Decimal(2))
        Decimal('-1')
        uraiseitT(u_convert_otheruTrueu
compare_total(uselfuaub((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
compare_total�suContext.compare_totalcCst|dd�}|j|�S(u�Compares two operands using their abstract representation ignoring sign.

        Like compare_total, but with operand's sign ignored and assumed to be 0.
        uraiseitT(u_convert_otheruTrueucompare_total_mag(uselfuaub((u,/opt/alt/python33/lib64/python3.3/decimal.pyucompare_total_mag�suContext.compare_total_magcCst|dd�}|j�S(uReturns a copy of the operand with the sign set to 0.

        >>> ExtendedContext.copy_abs(Decimal('2.1'))
        Decimal('2.1')
        >>> ExtendedContext.copy_abs(Decimal('-100'))
        Decimal('100')
        >>> ExtendedContext.copy_abs(-1)
        Decimal('1')
        uraiseitT(u_convert_otheruTrueucopy_abs(uselfua((u,/opt/alt/python33/lib64/python3.3/decimal.pyucopy_abs�s
uContext.copy_abscCst|dd�}t|�S(uReturns a copy of the decimal object.

        >>> ExtendedContext.copy_decimal(Decimal('2.1'))
        Decimal('2.1')
        >>> ExtendedContext.copy_decimal(Decimal('-1.00'))
        Decimal('-1.00')
        >>> ExtendedContext.copy_decimal(1)
        Decimal('1')
        uraiseitT(u_convert_otheruTrueuDecimal(uselfua((u,/opt/alt/python33/lib64/python3.3/decimal.pyucopy_decimal�s
uContext.copy_decimalcCst|dd�}|j�S(u(Returns a copy of the operand with the sign inverted.

        >>> ExtendedContext.copy_negate(Decimal('101.5'))
        Decimal('-101.5')
        >>> ExtendedContext.copy_negate(Decimal('-101.5'))
        Decimal('101.5')
        >>> ExtendedContext.copy_negate(1)
        Decimal('-1')
        uraiseitT(u_convert_otheruTrueucopy_negate(uselfua((u,/opt/alt/python33/lib64/python3.3/decimal.pyucopy_negate�s
uContext.copy_negatecCst|dd�}|j|�S(uCopies the second operand's sign to the first one.

        In detail, it returns a copy of the first operand with the sign
        equal to the sign of the second operand.

        >>> ExtendedContext.copy_sign(Decimal( '1.50'), Decimal('7.33'))
        Decimal('1.50')
        >>> ExtendedContext.copy_sign(Decimal('-1.50'), Decimal('7.33'))
        Decimal('1.50')
        >>> ExtendedContext.copy_sign(Decimal( '1.50'), Decimal('-7.33'))
        Decimal('-1.50')
        >>> ExtendedContext.copy_sign(Decimal('-1.50'), Decimal('-7.33'))
        Decimal('-1.50')
        >>> ExtendedContext.copy_sign(1, -2)
        Decimal('-1')
        >>> ExtendedContext.copy_sign(Decimal(1), -2)
        Decimal('-1')
        >>> ExtendedContext.copy_sign(1, Decimal(-2))
        Decimal('-1')
        uraiseitT(u_convert_otheruTrueu	copy_sign(uselfuaub((u,/opt/alt/python33/lib64/python3.3/decimal.pyu	copy_sign�suContext.copy_signcCsNt|dd�}|j|d|�}|tkrFtd|��n|SdS(u�Decimal division in a specified context.

        >>> ExtendedContext.divide(Decimal('1'), Decimal('3'))
        Decimal('0.333333333')
        >>> ExtendedContext.divide(Decimal('2'), Decimal('3'))
        Decimal('0.666666667')
        >>> ExtendedContext.divide(Decimal('5'), Decimal('2'))
        Decimal('2.5')
        >>> ExtendedContext.divide(Decimal('1'), Decimal('10'))
        Decimal('0.1')
        >>> ExtendedContext.divide(Decimal('12'), Decimal('12'))
        Decimal('1')
        >>> ExtendedContext.divide(Decimal('8.00'), Decimal('2'))
        Decimal('4.00')
        >>> ExtendedContext.divide(Decimal('2.400'), Decimal('2.0'))
        Decimal('1.20')
        >>> ExtendedContext.divide(Decimal('1000'), Decimal('100'))
        Decimal('10')
        >>> ExtendedContext.divide(Decimal('1000'), Decimal('1'))
        Decimal('1000')
        >>> ExtendedContext.divide(Decimal('2.40E+6'), Decimal('2'))
        Decimal('1.20E+6')
        >>> ExtendedContext.divide(5, 5)
        Decimal('1')
        >>> ExtendedContext.divide(Decimal(5), 5)
        Decimal('1')
        >>> ExtendedContext.divide(5, Decimal(5))
        Decimal('1')
        uraiseitucontextuUnable to convert %s to DecimalNT(u_convert_otheruTrueu__truediv__uNotImplementedu	TypeError(uselfuaubur((u,/opt/alt/python33/lib64/python3.3/decimal.pyudivides
uContext.dividecCsNt|dd�}|j|d|�}|tkrFtd|��n|SdS(u/Divides two numbers and returns the integer part of the result.

        >>> ExtendedContext.divide_int(Decimal('2'), Decimal('3'))
        Decimal('0')
        >>> ExtendedContext.divide_int(Decimal('10'), Decimal('3'))
        Decimal('3')
        >>> ExtendedContext.divide_int(Decimal('1'), Decimal('0.3'))
        Decimal('3')
        >>> ExtendedContext.divide_int(10, 3)
        Decimal('3')
        >>> ExtendedContext.divide_int(Decimal(10), 3)
        Decimal('3')
        >>> ExtendedContext.divide_int(10, Decimal(3))
        Decimal('3')
        uraiseitucontextuUnable to convert %s to DecimalNT(u_convert_otheruTrueu__floordiv__uNotImplementedu	TypeError(uselfuaubur((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
divide_int,s
uContext.divide_intcCsNt|dd�}|j|d|�}|tkrFtd|��n|SdS(u�Return (a // b, a % b).

        >>> ExtendedContext.divmod(Decimal(8), Decimal(3))
        (Decimal('2'), Decimal('2'))
        >>> ExtendedContext.divmod(Decimal(8), Decimal(4))
        (Decimal('2'), Decimal('0'))
        >>> ExtendedContext.divmod(8, 4)
        (Decimal('2'), Decimal('0'))
        >>> ExtendedContext.divmod(Decimal(8), 4)
        (Decimal('2'), Decimal('0'))
        >>> ExtendedContext.divmod(8, Decimal(4))
        (Decimal('2'), Decimal('0'))
        uraiseitucontextuUnable to convert %s to DecimalNT(u_convert_otheruTrueu
__divmod__uNotImplementedu	TypeError(uselfuaubur((u,/opt/alt/python33/lib64/python3.3/decimal.pyudivmodCs
uContext.divmodcCs"t|dd�}|jd|�S(u#Returns e ** a.

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> c.exp(Decimal('-Infinity'))
        Decimal('0')
        >>> c.exp(Decimal('-1'))
        Decimal('0.367879441')
        >>> c.exp(Decimal('0'))
        Decimal('1')
        >>> c.exp(Decimal('1'))
        Decimal('2.71828183')
        >>> c.exp(Decimal('0.693147181'))
        Decimal('2.00000000')
        >>> c.exp(Decimal('+Infinity'))
        Decimal('Infinity')
        >>> c.exp(10)
        Decimal('22026.4658')
        uraiseitucontextT(u_convert_otheruTrueuexp(uselfua((u,/opt/alt/python33/lib64/python3.3/decimal.pyuexpXsuContext.expcCs(t|dd�}|j||d|�S(uReturns a multiplied by b, plus c.

        The first two operands are multiplied together, using multiply,
        the third operand is then added to the result of that
        multiplication, using add, all with only one final rounding.

        >>> ExtendedContext.fma(Decimal('3'), Decimal('5'), Decimal('7'))
        Decimal('22')
        >>> ExtendedContext.fma(Decimal('3'), Decimal('-5'), Decimal('7'))
        Decimal('-8')
        >>> ExtendedContext.fma(Decimal('888565290'), Decimal('1557.96930'), Decimal('-86087.7578'))
        Decimal('1.38435736E+12')
        >>> ExtendedContext.fma(1, 3, 4)
        Decimal('7')
        >>> ExtendedContext.fma(1, Decimal(3), 4)
        Decimal('7')
        >>> ExtendedContext.fma(1, 3, Decimal(4))
        Decimal('7')
        uraiseitucontextT(u_convert_otheruTrueufma(uselfuaubuc((u,/opt/alt/python33/lib64/python3.3/decimal.pyufmapsuContext.fmacCs(t|t�std��n|j�S(uReturn True if the operand is canonical; otherwise return False.

        Currently, the encoding of a Decimal instance is always
        canonical, so this method returns True for any Decimal.

        >>> ExtendedContext.is_canonical(Decimal('2.50'))
        True
        u/is_canonical requires a Decimal as an argument.(u
isinstanceuDecimalu	TypeErroruis_canonical(uselfua((u,/opt/alt/python33/lib64/python3.3/decimal.pyuis_canonical�s	uContext.is_canonicalcCst|dd�}|j�S(u,Return True if the operand is finite; otherwise return False.

        A Decimal instance is considered finite if it is neither
        infinite nor a NaN.

        >>> ExtendedContext.is_finite(Decimal('2.50'))
        True
        >>> ExtendedContext.is_finite(Decimal('-0.3'))
        True
        >>> ExtendedContext.is_finite(Decimal('0'))
        True
        >>> ExtendedContext.is_finite(Decimal('Inf'))
        False
        >>> ExtendedContext.is_finite(Decimal('NaN'))
        False
        >>> ExtendedContext.is_finite(1)
        True
        uraiseitT(u_convert_otheruTrueu	is_finite(uselfua((u,/opt/alt/python33/lib64/python3.3/decimal.pyu	is_finite�suContext.is_finitecCst|dd�}|j�S(uUReturn True if the operand is infinite; otherwise return False.

        >>> ExtendedContext.is_infinite(Decimal('2.50'))
        False
        >>> ExtendedContext.is_infinite(Decimal('-Inf'))
        True
        >>> ExtendedContext.is_infinite(Decimal('NaN'))
        False
        >>> ExtendedContext.is_infinite(1)
        False
        uraiseitT(u_convert_otheruTrueuis_infinite(uselfua((u,/opt/alt/python33/lib64/python3.3/decimal.pyuis_infinite�suContext.is_infinitecCst|dd�}|j�S(uOReturn True if the operand is a qNaN or sNaN;
        otherwise return False.

        >>> ExtendedContext.is_nan(Decimal('2.50'))
        False
        >>> ExtendedContext.is_nan(Decimal('NaN'))
        True
        >>> ExtendedContext.is_nan(Decimal('-sNaN'))
        True
        >>> ExtendedContext.is_nan(1)
        False
        uraiseitT(u_convert_otheruTrueuis_nan(uselfua((u,/opt/alt/python33/lib64/python3.3/decimal.pyuis_nan�s
uContext.is_nancCs"t|dd�}|jd|�S(u�Return True if the operand is a normal number;
        otherwise return False.

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> c.is_normal(Decimal('2.50'))
        True
        >>> c.is_normal(Decimal('0.1E-999'))
        False
        >>> c.is_normal(Decimal('0.00'))
        False
        >>> c.is_normal(Decimal('-Inf'))
        False
        >>> c.is_normal(Decimal('NaN'))
        False
        >>> c.is_normal(1)
        True
        uraiseitucontextT(u_convert_otheruTrueu	is_normal(uselfua((u,/opt/alt/python33/lib64/python3.3/decimal.pyu	is_normal�suContext.is_normalcCst|dd�}|j�S(uHReturn True if the operand is a quiet NaN; otherwise return False.

        >>> ExtendedContext.is_qnan(Decimal('2.50'))
        False
        >>> ExtendedContext.is_qnan(Decimal('NaN'))
        True
        >>> ExtendedContext.is_qnan(Decimal('sNaN'))
        False
        >>> ExtendedContext.is_qnan(1)
        False
        uraiseitT(u_convert_otheruTrueuis_qnan(uselfua((u,/opt/alt/python33/lib64/python3.3/decimal.pyuis_qnan�suContext.is_qnancCst|dd�}|j�S(u�Return True if the operand is negative; otherwise return False.

        >>> ExtendedContext.is_signed(Decimal('2.50'))
        False
        >>> ExtendedContext.is_signed(Decimal('-12'))
        True
        >>> ExtendedContext.is_signed(Decimal('-0'))
        True
        >>> ExtendedContext.is_signed(8)
        False
        >>> ExtendedContext.is_signed(-8)
        True
        uraiseitT(u_convert_otheruTrueu	is_signed(uselfua((u,/opt/alt/python33/lib64/python3.3/decimal.pyu	is_signed�suContext.is_signedcCst|dd�}|j�S(uTReturn True if the operand is a signaling NaN;
        otherwise return False.

        >>> ExtendedContext.is_snan(Decimal('2.50'))
        False
        >>> ExtendedContext.is_snan(Decimal('NaN'))
        False
        >>> ExtendedContext.is_snan(Decimal('sNaN'))
        True
        >>> ExtendedContext.is_snan(1)
        False
        uraiseitT(u_convert_otheruTrueuis_snan(uselfua((u,/opt/alt/python33/lib64/python3.3/decimal.pyuis_snans
uContext.is_snancCs"t|dd�}|jd|�S(u�Return True if the operand is subnormal; otherwise return False.

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> c.is_subnormal(Decimal('2.50'))
        False
        >>> c.is_subnormal(Decimal('0.1E-999'))
        True
        >>> c.is_subnormal(Decimal('0.00'))
        False
        >>> c.is_subnormal(Decimal('-Inf'))
        False
        >>> c.is_subnormal(Decimal('NaN'))
        False
        >>> c.is_subnormal(1)
        False
        uraiseitucontextT(u_convert_otheruTrueuis_subnormal(uselfua((u,/opt/alt/python33/lib64/python3.3/decimal.pyuis_subnormalsuContext.is_subnormalcCst|dd�}|j�S(uuReturn True if the operand is a zero; otherwise return False.

        >>> ExtendedContext.is_zero(Decimal('0'))
        True
        >>> ExtendedContext.is_zero(Decimal('2.50'))
        False
        >>> ExtendedContext.is_zero(Decimal('-0E+2'))
        True
        >>> ExtendedContext.is_zero(1)
        False
        >>> ExtendedContext.is_zero(0)
        True
        uraiseitT(u_convert_otheruTrueuis_zero(uselfua((u,/opt/alt/python33/lib64/python3.3/decimal.pyuis_zero&suContext.is_zerocCs"t|dd�}|jd|�S(u�Returns the natural (base e) logarithm of the operand.

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> c.ln(Decimal('0'))
        Decimal('-Infinity')
        >>> c.ln(Decimal('1.000'))
        Decimal('0')
        >>> c.ln(Decimal('2.71828183'))
        Decimal('1.00000000')
        >>> c.ln(Decimal('10'))
        Decimal('2.30258509')
        >>> c.ln(Decimal('+Infinity'))
        Decimal('Infinity')
        >>> c.ln(1)
        Decimal('0')
        uraiseitucontextT(u_convert_otheruTrueuln(uselfua((u,/opt/alt/python33/lib64/python3.3/decimal.pyuln7su
Context.lncCs"t|dd�}|jd|�S(u�Returns the base 10 logarithm of the operand.

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> c.log10(Decimal('0'))
        Decimal('-Infinity')
        >>> c.log10(Decimal('0.001'))
        Decimal('-3')
        >>> c.log10(Decimal('1.000'))
        Decimal('0')
        >>> c.log10(Decimal('2'))
        Decimal('0.301029996')
        >>> c.log10(Decimal('10'))
        Decimal('1')
        >>> c.log10(Decimal('70'))
        Decimal('1.84509804')
        >>> c.log10(Decimal('+Infinity'))
        Decimal('Infinity')
        >>> c.log10(0)
        Decimal('-Infinity')
        >>> c.log10(1)
        Decimal('0')
        uraiseitucontextT(u_convert_otheruTrueulog10(uselfua((u,/opt/alt/python33/lib64/python3.3/decimal.pyulog10Msu
Context.log10cCs"t|dd�}|jd|�S(u4 Returns the exponent of the magnitude of the operand's MSD.

        The result is the integer which is the exponent of the magnitude
        of the most significant digit of the operand (as though the
        operand were truncated to a single digit while maintaining the
        value of that digit and without limiting the resulting exponent).

        >>> ExtendedContext.logb(Decimal('250'))
        Decimal('2')
        >>> ExtendedContext.logb(Decimal('2.50'))
        Decimal('0')
        >>> ExtendedContext.logb(Decimal('0.03'))
        Decimal('-2')
        >>> ExtendedContext.logb(Decimal('0'))
        Decimal('-Infinity')
        >>> ExtendedContext.logb(1)
        Decimal('0')
        >>> ExtendedContext.logb(10)
        Decimal('1')
        >>> ExtendedContext.logb(100)
        Decimal('2')
        uraiseitucontextT(u_convert_otheruTrueulogb(uselfua((u,/opt/alt/python33/lib64/python3.3/decimal.pyulogbisuContext.logbcCs%t|dd�}|j|d|�S(u�Applies the logical operation 'and' between each operand's digits.

        The operands must be both logical numbers.

        >>> ExtendedContext.logical_and(Decimal('0'), Decimal('0'))
        Decimal('0')
        >>> ExtendedContext.logical_and(Decimal('0'), Decimal('1'))
        Decimal('0')
        >>> ExtendedContext.logical_and(Decimal('1'), Decimal('0'))
        Decimal('0')
        >>> ExtendedContext.logical_and(Decimal('1'), Decimal('1'))
        Decimal('1')
        >>> ExtendedContext.logical_and(Decimal('1100'), Decimal('1010'))
        Decimal('1000')
        >>> ExtendedContext.logical_and(Decimal('1111'), Decimal('10'))
        Decimal('10')
        >>> ExtendedContext.logical_and(110, 1101)
        Decimal('100')
        >>> ExtendedContext.logical_and(Decimal(110), 1101)
        Decimal('100')
        >>> ExtendedContext.logical_and(110, Decimal(1101))
        Decimal('100')
        uraiseitucontextT(u_convert_otheruTrueulogical_and(uselfuaub((u,/opt/alt/python33/lib64/python3.3/decimal.pyulogical_and�suContext.logical_andcCs"t|dd�}|jd|�S(uInvert all the digits in the operand.

        The operand must be a logical number.

        >>> ExtendedContext.logical_invert(Decimal('0'))
        Decimal('111111111')
        >>> ExtendedContext.logical_invert(Decimal('1'))
        Decimal('111111110')
        >>> ExtendedContext.logical_invert(Decimal('111111111'))
        Decimal('0')
        >>> ExtendedContext.logical_invert(Decimal('101010101'))
        Decimal('10101010')
        >>> ExtendedContext.logical_invert(1101)
        Decimal('111110010')
        uraiseitucontextT(u_convert_otheruTrueulogical_invert(uselfua((u,/opt/alt/python33/lib64/python3.3/decimal.pyulogical_invert�suContext.logical_invertcCs%t|dd�}|j|d|�S(u�Applies the logical operation 'or' between each operand's digits.

        The operands must be both logical numbers.

        >>> ExtendedContext.logical_or(Decimal('0'), Decimal('0'))
        Decimal('0')
        >>> ExtendedContext.logical_or(Decimal('0'), Decimal('1'))
        Decimal('1')
        >>> ExtendedContext.logical_or(Decimal('1'), Decimal('0'))
        Decimal('1')
        >>> ExtendedContext.logical_or(Decimal('1'), Decimal('1'))
        Decimal('1')
        >>> ExtendedContext.logical_or(Decimal('1100'), Decimal('1010'))
        Decimal('1110')
        >>> ExtendedContext.logical_or(Decimal('1110'), Decimal('10'))
        Decimal('1110')
        >>> ExtendedContext.logical_or(110, 1101)
        Decimal('1111')
        >>> ExtendedContext.logical_or(Decimal(110), 1101)
        Decimal('1111')
        >>> ExtendedContext.logical_or(110, Decimal(1101))
        Decimal('1111')
        uraiseitucontextT(u_convert_otheruTrueu
logical_or(uselfuaub((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
logical_or�suContext.logical_orcCs%t|dd�}|j|d|�S(u�Applies the logical operation 'xor' between each operand's digits.

        The operands must be both logical numbers.

        >>> ExtendedContext.logical_xor(Decimal('0'), Decimal('0'))
        Decimal('0')
        >>> ExtendedContext.logical_xor(Decimal('0'), Decimal('1'))
        Decimal('1')
        >>> ExtendedContext.logical_xor(Decimal('1'), Decimal('0'))
        Decimal('1')
        >>> ExtendedContext.logical_xor(Decimal('1'), Decimal('1'))
        Decimal('0')
        >>> ExtendedContext.logical_xor(Decimal('1100'), Decimal('1010'))
        Decimal('110')
        >>> ExtendedContext.logical_xor(Decimal('1111'), Decimal('10'))
        Decimal('1101')
        >>> ExtendedContext.logical_xor(110, 1101)
        Decimal('1011')
        >>> ExtendedContext.logical_xor(Decimal(110), 1101)
        Decimal('1011')
        >>> ExtendedContext.logical_xor(110, Decimal(1101))
        Decimal('1011')
        uraiseitucontextT(u_convert_otheruTrueulogical_xor(uselfuaub((u,/opt/alt/python33/lib64/python3.3/decimal.pyulogical_xor�suContext.logical_xorcCs%t|dd�}|j|d|�S(u�max compares two values numerically and returns the maximum.

        If either operand is a NaN then the general rules apply.
        Otherwise, the operands are compared as though by the compare
        operation.  If they are numerically equal then the left-hand operand
        is chosen as the result.  Otherwise the maximum (closer to positive
        infinity) of the two operands is chosen as the result.

        >>> ExtendedContext.max(Decimal('3'), Decimal('2'))
        Decimal('3')
        >>> ExtendedContext.max(Decimal('-10'), Decimal('3'))
        Decimal('3')
        >>> ExtendedContext.max(Decimal('1.0'), Decimal('1'))
        Decimal('1')
        >>> ExtendedContext.max(Decimal('7'), Decimal('NaN'))
        Decimal('7')
        >>> ExtendedContext.max(1, 2)
        Decimal('2')
        >>> ExtendedContext.max(Decimal(1), 2)
        Decimal('2')
        >>> ExtendedContext.max(1, Decimal(2))
        Decimal('2')
        uraiseitucontextT(u_convert_otheruTrueumax(uselfuaub((u,/opt/alt/python33/lib64/python3.3/decimal.pyumax�suContext.maxcCs%t|dd�}|j|d|�S(u�Compares the values numerically with their sign ignored.

        >>> ExtendedContext.max_mag(Decimal('7'), Decimal('NaN'))
        Decimal('7')
        >>> ExtendedContext.max_mag(Decimal('7'), Decimal('-10'))
        Decimal('-10')
        >>> ExtendedContext.max_mag(1, -2)
        Decimal('-2')
        >>> ExtendedContext.max_mag(Decimal(1), -2)
        Decimal('-2')
        >>> ExtendedContext.max_mag(1, Decimal(-2))
        Decimal('-2')
        uraiseitucontextT(u_convert_otheruTrueumax_mag(uselfuaub((u,/opt/alt/python33/lib64/python3.3/decimal.pyumax_magsuContext.max_magcCs%t|dd�}|j|d|�S(u�min compares two values numerically and returns the minimum.

        If either operand is a NaN then the general rules apply.
        Otherwise, the operands are compared as though by the compare
        operation.  If they are numerically equal then the left-hand operand
        is chosen as the result.  Otherwise the minimum (closer to negative
        infinity) of the two operands is chosen as the result.

        >>> ExtendedContext.min(Decimal('3'), Decimal('2'))
        Decimal('2')
        >>> ExtendedContext.min(Decimal('-10'), Decimal('3'))
        Decimal('-10')
        >>> ExtendedContext.min(Decimal('1.0'), Decimal('1'))
        Decimal('1.0')
        >>> ExtendedContext.min(Decimal('7'), Decimal('NaN'))
        Decimal('7')
        >>> ExtendedContext.min(1, 2)
        Decimal('1')
        >>> ExtendedContext.min(Decimal(1), 2)
        Decimal('1')
        >>> ExtendedContext.min(1, Decimal(29))
        Decimal('1')
        uraiseitucontextT(u_convert_otheruTrueumin(uselfuaub((u,/opt/alt/python33/lib64/python3.3/decimal.pyuminsuContext.mincCs%t|dd�}|j|d|�S(u�Compares the values numerically with their sign ignored.

        >>> ExtendedContext.min_mag(Decimal('3'), Decimal('-2'))
        Decimal('-2')
        >>> ExtendedContext.min_mag(Decimal('-3'), Decimal('NaN'))
        Decimal('-3')
        >>> ExtendedContext.min_mag(1, -2)
        Decimal('1')
        >>> ExtendedContext.min_mag(Decimal(1), -2)
        Decimal('1')
        >>> ExtendedContext.min_mag(1, Decimal(-2))
        Decimal('1')
        uraiseitucontextT(u_convert_otheruTrueumin_mag(uselfuaub((u,/opt/alt/python33/lib64/python3.3/decimal.pyumin_mag.suContext.min_magcCs"t|dd�}|jd|�S(u�Minus corresponds to unary prefix minus in Python.

        The operation is evaluated using the same rules as subtract; the
        operation minus(a) is calculated as subtract('0', a) where the '0'
        has the same exponent as the operand.

        >>> ExtendedContext.minus(Decimal('1.3'))
        Decimal('-1.3')
        >>> ExtendedContext.minus(Decimal('-1.3'))
        Decimal('1.3')
        >>> ExtendedContext.minus(1)
        Decimal('-1')
        uraiseitucontextT(u_convert_otheruTrueu__neg__(uselfua((u,/opt/alt/python33/lib64/python3.3/decimal.pyuminus?su
Context.minuscCsNt|dd�}|j|d|�}|tkrFtd|��n|SdS(u�multiply multiplies two operands.

        If either operand is a special value then the general rules apply.
        Otherwise, the operands are multiplied together
        ('long multiplication'), resulting in a number which may be as long as
        the sum of the lengths of the two operands.

        >>> ExtendedContext.multiply(Decimal('1.20'), Decimal('3'))
        Decimal('3.60')
        >>> ExtendedContext.multiply(Decimal('7'), Decimal('3'))
        Decimal('21')
        >>> ExtendedContext.multiply(Decimal('0.9'), Decimal('0.8'))
        Decimal('0.72')
        >>> ExtendedContext.multiply(Decimal('0.9'), Decimal('-0'))
        Decimal('-0.0')
        >>> ExtendedContext.multiply(Decimal('654321'), Decimal('654321'))
        Decimal('4.28135971E+11')
        >>> ExtendedContext.multiply(7, 7)
        Decimal('49')
        >>> ExtendedContext.multiply(Decimal(7), 7)
        Decimal('49')
        >>> ExtendedContext.multiply(7, Decimal(7))
        Decimal('49')
        uraiseitucontextuUnable to convert %s to DecimalNT(u_convert_otheruTrueu__mul__uNotImplementedu	TypeError(uselfuaubur((u,/opt/alt/python33/lib64/python3.3/decimal.pyumultiplyPs
uContext.multiplycCs"t|dd�}|jd|�S(u"Returns the largest representable number smaller than a.

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> ExtendedContext.next_minus(Decimal('1'))
        Decimal('0.999999999')
        >>> c.next_minus(Decimal('1E-1007'))
        Decimal('0E-1007')
        >>> ExtendedContext.next_minus(Decimal('-1.00000003'))
        Decimal('-1.00000004')
        >>> c.next_minus(Decimal('Infinity'))
        Decimal('9.99999999E+999')
        >>> c.next_minus(1)
        Decimal('0.999999999')
        uraiseitucontextT(u_convert_otheruTrueu
next_minus(uselfua((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
next_minuspsuContext.next_minuscCs"t|dd�}|jd|�S(uReturns the smallest representable number larger than a.

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> ExtendedContext.next_plus(Decimal('1'))
        Decimal('1.00000001')
        >>> c.next_plus(Decimal('-1E-1007'))
        Decimal('-0E-1007')
        >>> ExtendedContext.next_plus(Decimal('-1.00000003'))
        Decimal('-1.00000002')
        >>> c.next_plus(Decimal('-Infinity'))
        Decimal('-9.99999999E+999')
        >>> c.next_plus(1)
        Decimal('1.00000001')
        uraiseitucontextT(u_convert_otheruTrueu	next_plus(uselfua((u,/opt/alt/python33/lib64/python3.3/decimal.pyu	next_plus�suContext.next_pluscCs%t|dd�}|j|d|�S(u�Returns the number closest to a, in direction towards b.

        The result is the closest representable number from the first
        operand (but not the first operand) that is in the direction
        towards the second operand, unless the operands have the same
        value.

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> c.next_toward(Decimal('1'), Decimal('2'))
        Decimal('1.00000001')
        >>> c.next_toward(Decimal('-1E-1007'), Decimal('1'))
        Decimal('-0E-1007')
        >>> c.next_toward(Decimal('-1.00000003'), Decimal('0'))
        Decimal('-1.00000002')
        >>> c.next_toward(Decimal('1'), Decimal('0'))
        Decimal('0.999999999')
        >>> c.next_toward(Decimal('1E-1007'), Decimal('-100'))
        Decimal('0E-1007')
        >>> c.next_toward(Decimal('-1.00000003'), Decimal('-10'))
        Decimal('-1.00000004')
        >>> c.next_toward(Decimal('0.00'), Decimal('-0.0000'))
        Decimal('-0.00')
        >>> c.next_toward(0, 1)
        Decimal('1E-1007')
        >>> c.next_toward(Decimal(0), 1)
        Decimal('1E-1007')
        >>> c.next_toward(0, Decimal(1))
        Decimal('1E-1007')
        uraiseitucontextT(u_convert_otheruTrueunext_toward(uselfuaub((u,/opt/alt/python33/lib64/python3.3/decimal.pyunext_toward�s uContext.next_towardcCs"t|dd�}|jd|�S(u�normalize reduces an operand to its simplest form.

        Essentially a plus operation with all trailing zeros removed from the
        result.

        >>> ExtendedContext.normalize(Decimal('2.1'))
        Decimal('2.1')
        >>> ExtendedContext.normalize(Decimal('-2.0'))
        Decimal('-2')
        >>> ExtendedContext.normalize(Decimal('1.200'))
        Decimal('1.2')
        >>> ExtendedContext.normalize(Decimal('-120'))
        Decimal('-1.2E+2')
        >>> ExtendedContext.normalize(Decimal('120.00'))
        Decimal('1.2E+2')
        >>> ExtendedContext.normalize(Decimal('0.00'))
        Decimal('0')
        >>> ExtendedContext.normalize(6)
        Decimal('6')
        uraiseitucontextT(u_convert_otheruTrueu	normalize(uselfua((u,/opt/alt/python33/lib64/python3.3/decimal.pyu	normalize�suContext.normalizecCs"t|dd�}|jd|�S(u�Returns an indication of the class of the operand.

        The class is one of the following strings:
          -sNaN
          -NaN
          -Infinity
          -Normal
          -Subnormal
          -Zero
          +Zero
          +Subnormal
          +Normal
          +Infinity

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> c.number_class(Decimal('Infinity'))
        '+Infinity'
        >>> c.number_class(Decimal('1E-10'))
        '+Normal'
        >>> c.number_class(Decimal('2.50'))
        '+Normal'
        >>> c.number_class(Decimal('0.1E-999'))
        '+Subnormal'
        >>> c.number_class(Decimal('0'))
        '+Zero'
        >>> c.number_class(Decimal('-0'))
        '-Zero'
        >>> c.number_class(Decimal('-0.1E-999'))
        '-Subnormal'
        >>> c.number_class(Decimal('-1E-10'))
        '-Normal'
        >>> c.number_class(Decimal('-2.50'))
        '-Normal'
        >>> c.number_class(Decimal('-Infinity'))
        '-Infinity'
        >>> c.number_class(Decimal('NaN'))
        'NaN'
        >>> c.number_class(Decimal('-NaN'))
        'NaN'
        >>> c.number_class(Decimal('sNaN'))
        'sNaN'
        >>> c.number_class(123)
        '+Normal'
        uraiseitucontextT(u_convert_otheruTrueunumber_class(uselfua((u,/opt/alt/python33/lib64/python3.3/decimal.pyunumber_class�s/uContext.number_classcCs"t|dd�}|jd|�S(u�Plus corresponds to unary prefix plus in Python.

        The operation is evaluated using the same rules as add; the
        operation plus(a) is calculated as add('0', a) where the '0'
        has the same exponent as the operand.

        >>> ExtendedContext.plus(Decimal('1.3'))
        Decimal('1.3')
        >>> ExtendedContext.plus(Decimal('-1.3'))
        Decimal('-1.3')
        >>> ExtendedContext.plus(-1)
        Decimal('-1')
        uraiseitucontextT(u_convert_otheruTrueu__pos__(uselfua((u,/opt/alt/python33/lib64/python3.3/decimal.pyuplussuContext.pluscCsQt|dd�}|j||d|�}|tkrItd|��n|SdS(uRaises a to the power of b, to modulo if given.

        With two arguments, compute a**b.  If a is negative then b
        must be integral.  The result will be inexact unless b is
        integral and the result is finite and can be expressed exactly
        in 'precision' digits.

        With three arguments, compute (a**b) % modulo.  For the
        three argument form, the following restrictions on the
        arguments hold:

         - all three arguments must be integral
         - b must be nonnegative
         - at least one of a or b must be nonzero
         - modulo must be nonzero and have at most 'precision' digits

        The result of pow(a, b, modulo) is identical to the result
        that would be obtained by computing (a**b) % modulo with
        unbounded precision, but is computed more efficiently.  It is
        always exact.

        >>> c = ExtendedContext.copy()
        >>> c.Emin = -999
        >>> c.Emax = 999
        >>> c.power(Decimal('2'), Decimal('3'))
        Decimal('8')
        >>> c.power(Decimal('-2'), Decimal('3'))
        Decimal('-8')
        >>> c.power(Decimal('2'), Decimal('-3'))
        Decimal('0.125')
        >>> c.power(Decimal('1.7'), Decimal('8'))
        Decimal('69.7575744')
        >>> c.power(Decimal('10'), Decimal('0.301029996'))
        Decimal('2.00000000')
        >>> c.power(Decimal('Infinity'), Decimal('-1'))
        Decimal('0')
        >>> c.power(Decimal('Infinity'), Decimal('0'))
        Decimal('1')
        >>> c.power(Decimal('Infinity'), Decimal('1'))
        Decimal('Infinity')
        >>> c.power(Decimal('-Infinity'), Decimal('-1'))
        Decimal('-0')
        >>> c.power(Decimal('-Infinity'), Decimal('0'))
        Decimal('1')
        >>> c.power(Decimal('-Infinity'), Decimal('1'))
        Decimal('-Infinity')
        >>> c.power(Decimal('-Infinity'), Decimal('2'))
        Decimal('Infinity')
        >>> c.power(Decimal('0'), Decimal('0'))
        Decimal('NaN')

        >>> c.power(Decimal('3'), Decimal('7'), Decimal('16'))
        Decimal('11')
        >>> c.power(Decimal('-3'), Decimal('7'), Decimal('16'))
        Decimal('-11')
        >>> c.power(Decimal('-3'), Decimal('8'), Decimal('16'))
        Decimal('1')
        >>> c.power(Decimal('3'), Decimal('7'), Decimal('-16'))
        Decimal('11')
        >>> c.power(Decimal('23E12345'), Decimal('67E189'), Decimal('123456789'))
        Decimal('11729830')
        >>> c.power(Decimal('-0'), Decimal('17'), Decimal('1729'))
        Decimal('-0')
        >>> c.power(Decimal('-23'), Decimal('0'), Decimal('65537'))
        Decimal('1')
        >>> ExtendedContext.power(7, 7)
        Decimal('823543')
        >>> ExtendedContext.power(Decimal(7), 7)
        Decimal('823543')
        >>> ExtendedContext.power(7, Decimal(7), 2)
        Decimal('1')
        uraiseitucontextuUnable to convert %s to DecimalNT(u_convert_otheruTrueu__pow__uNotImplementedu	TypeError(uselfuaubumodulour((u,/opt/alt/python33/lib64/python3.3/decimal.pyupowers
Iu
Context.powercCs%t|dd�}|j|d|�S(u
Returns a value equal to 'a' (rounded), having the exponent of 'b'.

        The coefficient of the result is derived from that of the left-hand
        operand.  It may be rounded using the current rounding setting (if the
        exponent is being increased), multiplied by a positive power of ten (if
        the exponent is being decreased), or is unchanged (if the exponent is
        already equal to that of the right-hand operand).

        Unlike other operations, if the length of the coefficient after the
        quantize operation would be greater than precision then an Invalid
        operation condition is raised.  This guarantees that, unless there is
        an error condition, the exponent of the result of a quantize is always
        equal to that of the right-hand operand.

        Also unlike other operations, quantize will never raise Underflow, even
        if the result is subnormal and inexact.

        >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('0.001'))
        Decimal('2.170')
        >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('0.01'))
        Decimal('2.17')
        >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('0.1'))
        Decimal('2.2')
        >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('1e+0'))
        Decimal('2')
        >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('1e+1'))
        Decimal('0E+1')
        >>> ExtendedContext.quantize(Decimal('-Inf'), Decimal('Infinity'))
        Decimal('-Infinity')
        >>> ExtendedContext.quantize(Decimal('2'), Decimal('Infinity'))
        Decimal('NaN')
        >>> ExtendedContext.quantize(Decimal('-0.1'), Decimal('1'))
        Decimal('-0')
        >>> ExtendedContext.quantize(Decimal('-0'), Decimal('1e+5'))
        Decimal('-0E+5')
        >>> ExtendedContext.quantize(Decimal('+35236450.6'), Decimal('1e-2'))
        Decimal('NaN')
        >>> ExtendedContext.quantize(Decimal('-35236450.6'), Decimal('1e-2'))
        Decimal('NaN')
        >>> ExtendedContext.quantize(Decimal('217'), Decimal('1e-1'))
        Decimal('217.0')
        >>> ExtendedContext.quantize(Decimal('217'), Decimal('1e-0'))
        Decimal('217')
        >>> ExtendedContext.quantize(Decimal('217'), Decimal('1e+1'))
        Decimal('2.2E+2')
        >>> ExtendedContext.quantize(Decimal('217'), Decimal('1e+2'))
        Decimal('2E+2')
        >>> ExtendedContext.quantize(1, 2)
        Decimal('1')
        >>> ExtendedContext.quantize(Decimal(1), 2)
        Decimal('1')
        >>> ExtendedContext.quantize(1, Decimal(2))
        Decimal('1')
        uraiseitucontextT(u_convert_otheruTrueuquantize(uselfuaub((u,/opt/alt/python33/lib64/python3.3/decimal.pyuquantizefs7uContext.quantizecCs
td�S(ukJust returns 10, as this is Decimal, :)

        >>> ExtendedContext.radix()
        Decimal('10')
        i
(uDecimal(uself((u,/opt/alt/python33/lib64/python3.3/decimal.pyuradix�su
Context.radixcCsNt|dd�}|j|d|�}|tkrFtd|��n|SdS(uReturns the remainder from integer division.

        The result is the residue of the dividend after the operation of
        calculating integer division as described for divide-integer, rounded
        to precision digits if necessary.  The sign of the result, if
        non-zero, is the same as that of the original dividend.

        This operation will fail under the same conditions as integer division
        (that is, if integer division on the same two operands would fail, the
        remainder cannot be calculated).

        >>> ExtendedContext.remainder(Decimal('2.1'), Decimal('3'))
        Decimal('2.1')
        >>> ExtendedContext.remainder(Decimal('10'), Decimal('3'))
        Decimal('1')
        >>> ExtendedContext.remainder(Decimal('-10'), Decimal('3'))
        Decimal('-1')
        >>> ExtendedContext.remainder(Decimal('10.2'), Decimal('1'))
        Decimal('0.2')
        >>> ExtendedContext.remainder(Decimal('10'), Decimal('0.3'))
        Decimal('0.1')
        >>> ExtendedContext.remainder(Decimal('3.6'), Decimal('1.3'))
        Decimal('1.0')
        >>> ExtendedContext.remainder(22, 6)
        Decimal('4')
        >>> ExtendedContext.remainder(Decimal(22), 6)
        Decimal('4')
        >>> ExtendedContext.remainder(22, Decimal(6))
        Decimal('4')
        uraiseitucontextuUnable to convert %s to DecimalNT(u_convert_otheruTrueu__mod__uNotImplementedu	TypeError(uselfuaubur((u,/opt/alt/python33/lib64/python3.3/decimal.pyu	remainder�s
uContext.remaindercCs%t|dd�}|j|d|�S(uGReturns to be "a - b * n", where n is the integer nearest the exact
        value of "x / b" (if two integers are equally near then the even one
        is chosen).  If the result is equal to 0 then its sign will be the
        sign of a.

        This operation will fail under the same conditions as integer division
        (that is, if integer division on the same two operands would fail, the
        remainder cannot be calculated).

        >>> ExtendedContext.remainder_near(Decimal('2.1'), Decimal('3'))
        Decimal('-0.9')
        >>> ExtendedContext.remainder_near(Decimal('10'), Decimal('6'))
        Decimal('-2')
        >>> ExtendedContext.remainder_near(Decimal('10'), Decimal('3'))
        Decimal('1')
        >>> ExtendedContext.remainder_near(Decimal('-10'), Decimal('3'))
        Decimal('-1')
        >>> ExtendedContext.remainder_near(Decimal('10.2'), Decimal('1'))
        Decimal('0.2')
        >>> ExtendedContext.remainder_near(Decimal('10'), Decimal('0.3'))
        Decimal('0.1')
        >>> ExtendedContext.remainder_near(Decimal('3.6'), Decimal('1.3'))
        Decimal('-0.3')
        >>> ExtendedContext.remainder_near(3, 11)
        Decimal('3')
        >>> ExtendedContext.remainder_near(Decimal(3), 11)
        Decimal('3')
        >>> ExtendedContext.remainder_near(3, Decimal(11))
        Decimal('3')
        uraiseitucontextT(u_convert_otheruTrueuremainder_near(uselfuaub((u,/opt/alt/python33/lib64/python3.3/decimal.pyuremainder_near�suContext.remainder_nearcCs%t|dd�}|j|d|�S(uNReturns a rotated copy of a, b times.

        The coefficient of the result is a rotated copy of the digits in
        the coefficient of the first operand.  The number of places of
        rotation is taken from the absolute value of the second operand,
        with the rotation being to the left if the second operand is
        positive or to the right otherwise.

        >>> ExtendedContext.rotate(Decimal('34'), Decimal('8'))
        Decimal('400000003')
        >>> ExtendedContext.rotate(Decimal('12'), Decimal('9'))
        Decimal('12')
        >>> ExtendedContext.rotate(Decimal('123456789'), Decimal('-2'))
        Decimal('891234567')
        >>> ExtendedContext.rotate(Decimal('123456789'), Decimal('0'))
        Decimal('123456789')
        >>> ExtendedContext.rotate(Decimal('123456789'), Decimal('+2'))
        Decimal('345678912')
        >>> ExtendedContext.rotate(1333333, 1)
        Decimal('13333330')
        >>> ExtendedContext.rotate(Decimal(1333333), 1)
        Decimal('13333330')
        >>> ExtendedContext.rotate(1333333, Decimal(1))
        Decimal('13333330')
        uraiseitucontextT(u_convert_otheruTrueurotate(uselfuaub((u,/opt/alt/python33/lib64/python3.3/decimal.pyurotate�suContext.rotatecCst|dd�}|j|�S(u�Returns True if the two operands have the same exponent.

        The result is never affected by either the sign or the coefficient of
        either operand.

        >>> ExtendedContext.same_quantum(Decimal('2.17'), Decimal('0.001'))
        False
        >>> ExtendedContext.same_quantum(Decimal('2.17'), Decimal('0.01'))
        True
        >>> ExtendedContext.same_quantum(Decimal('2.17'), Decimal('1'))
        False
        >>> ExtendedContext.same_quantum(Decimal('Inf'), Decimal('-Inf'))
        True
        >>> ExtendedContext.same_quantum(10000, -1)
        True
        >>> ExtendedContext.same_quantum(Decimal(10000), -1)
        True
        >>> ExtendedContext.same_quantum(10000, Decimal(-1))
        True
        uraiseitT(u_convert_otheruTrueusame_quantum(uselfuaub((u,/opt/alt/python33/lib64/python3.3/decimal.pyusame_quantum
suContext.same_quantumcCs%t|dd�}|j|d|�S(u3Returns the first operand after adding the second value its exp.

        >>> ExtendedContext.scaleb(Decimal('7.50'), Decimal('-2'))
        Decimal('0.0750')
        >>> ExtendedContext.scaleb(Decimal('7.50'), Decimal('0'))
        Decimal('7.50')
        >>> ExtendedContext.scaleb(Decimal('7.50'), Decimal('3'))
        Decimal('7.50E+3')
        >>> ExtendedContext.scaleb(1, 4)
        Decimal('1E+4')
        >>> ExtendedContext.scaleb(Decimal(1), 4)
        Decimal('1E+4')
        >>> ExtendedContext.scaleb(1, Decimal(4))
        Decimal('1E+4')
        uraiseitucontextT(u_convert_otheruTrueuscaleb(uselfuaub((u,/opt/alt/python33/lib64/python3.3/decimal.pyuscaleb%suContext.scalebcCs%t|dd�}|j|d|�S(u{Returns a shifted copy of a, b times.

        The coefficient of the result is a shifted copy of the digits
        in the coefficient of the first operand.  The number of places
        to shift is taken from the absolute value of the second operand,
        with the shift being to the left if the second operand is
        positive or to the right otherwise.  Digits shifted into the
        coefficient are zeros.

        >>> ExtendedContext.shift(Decimal('34'), Decimal('8'))
        Decimal('400000000')
        >>> ExtendedContext.shift(Decimal('12'), Decimal('9'))
        Decimal('0')
        >>> ExtendedContext.shift(Decimal('123456789'), Decimal('-2'))
        Decimal('1234567')
        >>> ExtendedContext.shift(Decimal('123456789'), Decimal('0'))
        Decimal('123456789')
        >>> ExtendedContext.shift(Decimal('123456789'), Decimal('+2'))
        Decimal('345678900')
        >>> ExtendedContext.shift(88888888, 2)
        Decimal('888888800')
        >>> ExtendedContext.shift(Decimal(88888888), 2)
        Decimal('888888800')
        >>> ExtendedContext.shift(88888888, Decimal(2))
        Decimal('888888800')
        uraiseitucontextT(u_convert_otheruTrueushift(uselfuaub((u,/opt/alt/python33/lib64/python3.3/decimal.pyushift8su
Context.shiftcCs"t|dd�}|jd|�S(u�Square root of a non-negative number to context precision.

        If the result must be inexact, it is rounded using the round-half-even
        algorithm.

        >>> ExtendedContext.sqrt(Decimal('0'))
        Decimal('0')
        >>> ExtendedContext.sqrt(Decimal('-0'))
        Decimal('-0')
        >>> ExtendedContext.sqrt(Decimal('0.39'))
        Decimal('0.624499800')
        >>> ExtendedContext.sqrt(Decimal('100'))
        Decimal('10')
        >>> ExtendedContext.sqrt(Decimal('1'))
        Decimal('1')
        >>> ExtendedContext.sqrt(Decimal('1.0'))
        Decimal('1.0')
        >>> ExtendedContext.sqrt(Decimal('1.00'))
        Decimal('1.0')
        >>> ExtendedContext.sqrt(Decimal('7'))
        Decimal('2.64575131')
        >>> ExtendedContext.sqrt(Decimal('10'))
        Decimal('3.16227766')
        >>> ExtendedContext.sqrt(2)
        Decimal('1.41421356')
        >>> ExtendedContext.prec
        9
        uraiseitucontextT(u_convert_otheruTrueusqrt(uselfua((u,/opt/alt/python33/lib64/python3.3/decimal.pyusqrtVsuContext.sqrtcCsNt|dd�}|j|d|�}|tkrFtd|��n|SdS(u&Return the difference between the two operands.

        >>> ExtendedContext.subtract(Decimal('1.3'), Decimal('1.07'))
        Decimal('0.23')
        >>> ExtendedContext.subtract(Decimal('1.3'), Decimal('1.30'))
        Decimal('0.00')
        >>> ExtendedContext.subtract(Decimal('1.3'), Decimal('2.07'))
        Decimal('-0.77')
        >>> ExtendedContext.subtract(8, 5)
        Decimal('3')
        >>> ExtendedContext.subtract(Decimal(8), 5)
        Decimal('3')
        >>> ExtendedContext.subtract(8, Decimal(5))
        Decimal('3')
        uraiseitucontextuUnable to convert %s to DecimalNT(u_convert_otheruTrueu__sub__uNotImplementedu	TypeError(uselfuaubur((u,/opt/alt/python33/lib64/python3.3/decimal.pyusubtractvs
uContext.subtractcCs"t|dd�}|jd|�S(uyConverts a number to a string, using scientific notation.

        The operation is not affected by the context.
        uraiseitucontextT(u_convert_otheruTrueu
to_eng_string(uselfua((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
to_eng_string�suContext.to_eng_stringcCs"t|dd�}|jd|�S(uyConverts a number to a string, using scientific notation.

        The operation is not affected by the context.
        uraiseitucontextT(u_convert_otheruTrueu__str__(uselfua((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
to_sci_string�suContext.to_sci_stringcCs"t|dd�}|jd|�S(ukRounds to an integer.

        When the operand has a negative exponent, the result is the same
        as using the quantize() operation using the given operand as the
        left-hand-operand, 1E+0 as the right-hand-operand, and the precision
        of the operand as the precision setting; Inexact and Rounded flags
        are allowed in this operation.  The rounding mode is taken from the
        context.

        >>> ExtendedContext.to_integral_exact(Decimal('2.1'))
        Decimal('2')
        >>> ExtendedContext.to_integral_exact(Decimal('100'))
        Decimal('100')
        >>> ExtendedContext.to_integral_exact(Decimal('100.0'))
        Decimal('100')
        >>> ExtendedContext.to_integral_exact(Decimal('101.5'))
        Decimal('102')
        >>> ExtendedContext.to_integral_exact(Decimal('-101.5'))
        Decimal('-102')
        >>> ExtendedContext.to_integral_exact(Decimal('10E+5'))
        Decimal('1.0E+6')
        >>> ExtendedContext.to_integral_exact(Decimal('7.89E+77'))
        Decimal('7.89E+77')
        >>> ExtendedContext.to_integral_exact(Decimal('-Inf'))
        Decimal('-Infinity')
        uraiseitucontextT(u_convert_otheruTrueuto_integral_exact(uselfua((u,/opt/alt/python33/lib64/python3.3/decimal.pyuto_integral_exact�suContext.to_integral_exactcCs"t|dd�}|jd|�S(uLRounds to an integer.

        When the operand has a negative exponent, the result is the same
        as using the quantize() operation using the given operand as the
        left-hand-operand, 1E+0 as the right-hand-operand, and the precision
        of the operand as the precision setting, except that no flags will
        be set.  The rounding mode is taken from the context.

        >>> ExtendedContext.to_integral_value(Decimal('2.1'))
        Decimal('2')
        >>> ExtendedContext.to_integral_value(Decimal('100'))
        Decimal('100')
        >>> ExtendedContext.to_integral_value(Decimal('100.0'))
        Decimal('100')
        >>> ExtendedContext.to_integral_value(Decimal('101.5'))
        Decimal('102')
        >>> ExtendedContext.to_integral_value(Decimal('-101.5'))
        Decimal('-102')
        >>> ExtendedContext.to_integral_value(Decimal('10E+5'))
        Decimal('1.0E+6')
        >>> ExtendedContext.to_integral_value(Decimal('7.89E+77'))
        Decimal('7.89E+77')
        >>> ExtendedContext.to_integral_value(Decimal('-Inf'))
        Decimal('-Infinity')
        uraiseitucontextT(u_convert_otheruTrueuto_integral_value(uselfua((u,/opt/alt/python33/lib64/python3.3/decimal.pyuto_integral_value�suContext.to_integral_valueN(Yu__name__u
__module__u__qualname__u__doc__uNoneu__init__u_set_integer_checku_set_signal_dictu__setattr__u__delattr__u
__reduce__u__repr__uclear_flagsuclear_trapsu
_shallow_copyucopyu__copy__u_raise_erroru_ignore_all_flagsu
_ignore_flagsu
_regard_flagsu__hash__uEtinyuEtopu
_set_roundingucreate_decimalucreate_decimal_from_floatuabsuaddu_applyu	canonicalucompareucompare_signalu
compare_totalucompare_total_magucopy_absucopy_decimalucopy_negateu	copy_signudivideu
divide_intudivmoduexpufmauis_canonicalu	is_finiteuis_infiniteuis_nanu	is_normaluis_qnanu	is_signeduis_snanuis_subnormaluis_zeroulnulog10ulogbulogical_andulogical_invertu
logical_orulogical_xorumaxumax_maguminumin_maguminusumultiplyu
next_minusu	next_plusunext_towardu	normalizeunumber_classuplusupoweruquantizeuradixu	remainderuremainder_nearurotateusame_quantumuscalebushiftusqrtusubtractu
to_eng_stringu
to_sci_stringuto_integral_exactuto_integral_valueuto_integral(u
__locals__((u,/opt/alt/python33/lib64/python3.3/decimal.pyuContexts�"

$#


%
 #2P:&" cBs;|EeZdZd	Zddd�Zdd�ZeZdS(
u_WorkRepusignuintuexpcCs�|dkr*d|_d|_d|_nct|t�rf|j|_t|j�|_|j|_n'|d|_|d|_|d|_dS(Niii(	uNoneusignuintuexpu
isinstanceuDecimalu_signu_intu_exp(uselfuvalue((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__init__�s		

u_WorkRep.__init__cCsd|j|j|jfS(Nu(%r, %r, %r)(usignuintuexp(uself((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__repr__�su_WorkRep.__repr__N(usignuintuexp(u__name__u
__module__u__qualname__u	__slots__uNoneu__init__u__repr__u__str__(u
__locals__((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_WorkRep�su_WorkRepcCs�|j|jkr!|}|}n|}|}tt|j��}tt|j��}|jtd||d�}||jd|kr�d|_||_n|jd|j|j9_|j|_||fS(ucNormalizes op1, op2 to have the same exp and length of coefficient.

    Done during addition.
    iii
i����(uexpulenustruintumin(uop1uop2uprecutmpuotherutmp_lenu	other_lenuexp((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
_normalize�s		u
_normalizecCs{|dkrdS|dkr(|d|Stt|��}t|�t|jd��}||krjdS|d|SdS(u Given integers n and e, return n * 10**e if it's an integer, else None.

    The computation is designed to avoid computing large powers of 10
    unnecessarily.

    >>> _decimal_lshift_exact(3, 4)
    30000
    >>> _decimal_lshift_exact(300, -999999999)  # returns None

    ii
u0N(ustruabsulenurstripuNone(unueustr_nuval_n((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_decimal_lshift_exactsu_decimal_lshift_exactcCs^|dks|dkr'td��nd}x*||krY||||d?}}q0W|S(u�Closest integer to the square root of the positive integer n.  a is
    an initial approximation to the square root.  Any positive integer
    will do for a, but the closer a is to the square root of n the
    faster convergence will be.

    iu3Both arguments to _sqrt_nearest should be positive.i(u
ValueError(unuaub((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
_sqrt_nearest,su
_sqrt_nearestcCs7d|>||?}}|d||d@|d@|kS(u�Given an integer x and a nonnegative integer shift, return closest
    integer to x / 2**shift; use round-to-even in case of a tie.

    ii((uxushiftubuq((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_rshift_nearest;su_rshift_nearestcCs/t||�\}}|d||d@|kS(uaClosest integer to a/b, a and b positive integers; rounds to even
    in the case of a tie.

    ii(udivmod(uaubuqur((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_div_nearestCsu_div_nearestic	Cs7||}d}x�||kr9t|�||>|ks_||kr�t|�||?|kr�t||d>|t||t||�|��}|d7}qWtdtt|��d|�}t||�}t||�}x>t|ddd�D]&}t||�t|||�}q�Wt|||�S(u�Integer approximation to M*log(x/M), with absolute error boundable
    in terms only of x/M.

    Given positive integers x and M, return an integer approximation to
    M * log(x/M).  For L = 8 and 0.1 <= x/M <= 10 the difference
    between the approximation and the exact result is at most 22.  For
    L = 8 and 1.0 <= x/M <= 10.0 the difference is at most 15.  In
    both cases these are upper bounds on the error; it will usually be
    much smaller.iii
ii����i����(uabsu_div_nearestu
_sqrt_nearestu_rshift_nearestuintulenustrurange(	uxuMuLuyuRuTuyshiftuwuk((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_ilogKs
)&'%$u_ilogc
Cs�|d7}tt|��}||||dk}|dkr�d|}|||}|dkru|d|9}nt|d|�}t||�}t|�}t|||�}||}	nd}t|d|�}	t|	|d�S(u�Given integers c, e and p with c > 0, p >= 0, compute an integer
    approximation to 10**p * log10(c*10**e), with an absolute error of
    at most 1.  Assumes that c*10**e is not exactly 1.iiii
id(ulenustru_div_nearestu_ilogu
_log10_digits(
ucueupulufuMukulog_dulog_10ulog_tenpower((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_dlog10{s 


u_dlog10c	Cs|d7}tt|��}||||dk}|dkr�|||}|dkrk|d|9}nt|d|�}t|d|�}nd}|r�ttt|���d}||dkr�t|t||�d|�}qd}nd}t||d�S(u�Given integers c, e and p with c > 0, compute an integer
    approximation to 10**p * log(c*10**e), with an absolute error of
    at most 1.  Assumes that c*10**e is not exactly 1.iiii
id(ulenustru_div_nearestu_iloguabsu
_log10_digits(	ucueupulufukulog_duextrau	f_log_ten((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_dlog�s"
$	u_dlogcBs2|EeZdZdZdd�Zdd�ZdS(u
_Log10Memoizeu�Class to compute, store, and allow retrieval of, digits of the
    constant log(10) = 2.302585....  This constant is needed by
    Decimal.ln, Decimal.log10, Decimal.exp and Decimal.__pow__.cCs
d|_dS(Nu/23025850929940456840179914546843642076011014886(udigits(uself((u,/opt/alt/python33/lib64/python3.3/decimal.pyu__init__�su_Log10Memoize.__init__cCs�|dkrtd��n|t|j�kr�d}x`d||d}tttd||�d��}||d�d|kr�Pn|d7}q9|jd�dd
�|_nt|jd|d	��S(utGiven an integer p >= 0, return floor(10**p)*log(10).

        For example, self.getdigits(3) returns 2302.
        iup should be nonnegativeii
iidNu0ii����(u
ValueErrorulenudigitsustru_div_nearestu_ilogurstripuint(uselfupuextrauMudigits((u,/opt/alt/python33/lib64/python3.3/decimal.pyu	getdigits�s	"
u_Log10Memoize.getdigitsN(u__name__u
__module__u__qualname__u__doc__u__init__u	getdigits(u
__locals__((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
_Log10Memoize�su
_Log10Memoizec	Cs�t||>|�}tdtt|��d|�}t||�}||>}x9t|ddd�D]!}t|||||�}qiWxCt|ddd	�D]+}||d>}t||||�}q�W||S(
u�Given integers x and M, M > 0, such that x/M is small in absolute
    value, compute an integer approximation to M*exp(x/M).  For 0 <=
    x/M <= 2.4, the absolute error in the result is bounded by 60 (and
    is usually much smaller).i
iiiii����i����i����i����(u_nbitsuintulenustru_div_nearesturange(	uxuMuLuRuTuyuMshiftuiuk((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_iexp�s%
u_iexpc	Cs�|d7}td|tt|��d�}||}||}|dkr^|d|}n|d|}t|t|��\}}t|d|�}tt|d|�d�||dfS(u�Compute an approximation to exp(c*10**e), with p decimal places of
    precision.

    Returns integers d, f such that:

      10**(p-1) <= d <= 10**p, and
      (d-1)*10**f < exp(c*10**e) < (d+1)*10**f

    In other words, d*10**f is an approximation to exp(c*10**e) with p
    digits of precision, and with an error in d of at most 1.  This is
    almost, but not quite, the same as the error being < 1ulp: when d
    = 10**(p-1) the error could be up to 10 ulp.iiii
i�i(umaxulenustrudivmodu
_log10_digitsu_div_nearestu_iexp(	ucueupuextrauqushiftucshiftuquoturem((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_dexps
#

u_dexpcCs*ttt|���|}t||||d�}||}|dkra||d|}nt||d|�}|dkr�tt|��|dk|dkkr�d|ddd|}	}
q d|d|}	}
n:t||d|d�\}	}
t|	d�}	|
d7}
|	|
fS(u5Given integers xc, xe, yc and ye representing Decimals x = xc*10**xe and
    y = yc*10**ye, compute x**y.  Returns a pair of integers (c, e) such that:

      10**(p-1) <= c <= 10**p, and
      (c-1)*10**e < x**y < (c+1)*10**e

    in other words, c*10**e is an approximation to x**y with p digits
    of precision, and with an error in c of at most 1.  (This is
    almost, but not quite, the same as the error being < 1ulp: when c
    == 10**(p-1) we can only guarantee error < 10ulp.)

    We assume that: x is positive and not equal to 1, and y is nonzero.
    iii
(ulenustruabsu_dlogu_div_nearestu_dexp(uxcuxeuycuyeupubulxcushiftupcucoeffuexp((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_dpower7s
( !
u_dpoweridu1iFu2i5u3i(u4iu5iu6iu7i
u8iu9cCsA|dkrtd��nt|�}dt|�||dS(u@Compute a lower bound for 100*log10(c) for a positive integer c.iu0The argument to _log10_lb should be nonnegative.id(u
ValueErrorustrulen(ucu
correctionustr_c((u,/opt/alt/python33/lib64/python3.3/decimal.pyu	_log10_lbasu	_log10_lbcCskt|t�r|St|t�r,t|�S|rNt|t�rNtj|�S|rgtd|��ntS(u�Convert other to Decimal.

    Verifies that it's ok to use in an implicit construction.
    If allow_float is true, allow conversion from float;  this
    is used in the comparison methods (__eq__ and friends).

    uUnable to convert %s to Decimal(u
isinstanceuDecimaluintufloatu
from_floatu	TypeErroruNotImplemented(uotheruraiseituallow_float((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_convert_otherls

u_convert_othercCst|t�r||fSt|tj�rx|jset|jtt|j	�|j
�|j�}n|t|j�fS|r�t|tj
�r�|jdkr�|j}nt|t�r�t�}|r�d|jt<n|jtd�|tj|�fSttfS(u�Given a Decimal instance self and a Python object other, return
    a pair (s, o) of Decimal instances such that "s op o" is
    equivalent to "self op other" for any of the 6 comparison
    operators "op".

    iiu;strict semantics for mixing floats and Decimals are enabled(u
isinstanceuDecimalu_numbersuRationalu_is_specialu_dec_from_tripleu_signustruintu_intudenominatoru_expu	numeratoruComplexuimagurealufloatu
getcontextuflagsuFloatOperationu_raise_erroru
from_floatuNotImplemented(uselfuotheruequality_opucontext((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_convert_for_comparisons$
		'		u_convert_for_comparisonupreciuroundingutrapsuflagsuEmaxi?BuEminucapitalsuclampi	u�        # A numeric string consists of:
#    \s*
    (?P<sign>[-+])?              # an optional sign, followed by either...
    (
        (?=\d|\.\d)              # ...a number (with at least one digit)
        (?P<int>\d*)             # having a (possibly empty) integer part
        (\.(?P<frac>\d*))?       # followed by an optional fractional part
        (E(?P<exp>[-+]?\d+))?    # followed by an optional exponent, or...
    |
        Inf(inity)?              # ...an infinity, or...
    |
        (?P<signal>s)?           # ...an (optionally signaling)
        NaN                      # NaN
        (?P<diag>\d*)            # with (possibly empty) diagnostic info.
    )
#    \s*
    \Z
u0*$u50*$u�\A
(?:
   (?P<fill>.)?
   (?P<align>[<>=^])
)?
(?P<sign>[-+ ])?
(?P<alt>\#)?
(?P<zeropad>0)?
(?P<minimumwidth>(?!0)\d+)?
(?P<thousands_sep>,)?
(?:\.(?P<precision>0|(?!0)\d+))?
(?P<type>[eEfFgGn%])?
\Z
cCs+tj|�}|dkr.td|��n|j�}|d}|d}|ddk	|d<|dr�|dk	r�td|��n|dk	r�td|��q�n|p�d|d<|p�d|d<|d	dkr�d
|d	<nt|dp�d�|d<|d
dk	r+t|d
�|d
<n|d
dkrk|ddks[|ddkrkd|d
<qkn|ddkr�d|d<|dkr�tj�}n|ddk	r�td|��n|d|d<|d|d<|d|d<n7|ddkr
d|d<nddg|d<d|d<|S(u�Parse and validate a format specifier.

    Turns a standard numeric format specifier into a dict, with the
    following entries:

      fill: fill character to pad field to minimum width
      align: alignment type, either '<', '>', '=' or '^'
      sign: either '+', '-' or ' '
      minimumwidth: nonnegative integer giving minimum width
      zeropad: boolean, indicating whether to pad with zeros
      thousands_sep: string to use as thousands separator, or ''
      grouping: grouping for thousands separators, in format
        used by localeconv
      decimal_point: string to use for decimal point
      precision: nonnegative integer giving precision, or None
      type: one of the characters 'eEfFgG%', or None

    uInvalid format specifier: ufillualignuzeropadu7Fill character conflicts with '0' in format specifier: u2Alignment conflicts with '0' in format specifier: u u>usignu-uminimumwidthu0u	precisioniutypeugGniunugu
thousands_sepuJExplicit thousands separator conflicts with 'n' type in format specifier: ugroupingu
decimal_pointuiu.N(u_parse_format_specifier_regexumatchuNoneu
ValueErroru	groupdictuintu_localeu
localeconv(uformat_specu_localeconvumuformat_dictufillualign((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_parse_format_specifiersN




 



u_parse_format_specifierc	Cs�|d}|d}||t|�t|�}|d}|dkrY|||}n�|dkrv|||}nn|dkr�|||}nQ|dkr�t|�d}|d	|�||||d	�}ntd
��|S(u�Given an unpadded, non-aligned numeric string 'body' and sign
    string 'sign', add padding and alignment conforming to the given
    format specifier dictionary 'spec' (as produced by
    parse_format_specifier).

    uminimumwidthufillualignu<u>u=u^iNuUnrecognised alignment field(ulenu
ValueError(	usignubodyuspecuminimumwidthufillupaddingualignuresultuhalf((u,/opt/alt/python33/lib64/python3.3/decimal.pyu
_format_align\s


)u
_format_aligncCs�ddlm}m}|s gS|ddkrct|�dkrc||dd�||d	��S|d
tjkr�|dd�Std��dS(uyConvert a localeconv-style grouping into a (possibly infinite)
    iterable of integers representing group lengths.

    i(uchainurepeatiiNu unrecognised format for groupingi����i����i����i����i����(u	itertoolsuchainurepeatulenu_localeuCHAR_MAXu
ValueError(ugroupinguchainurepeat((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_group_lengthsws
"!u_group_lengthscCs.|d}|d}g}x�t|�D]�}|dkrHtd��nttt|�|d�|�}|jd|t|�||d��|d|�}||8}|r�|dkr�Pn|t|�8}q'Wtt|�|d�}|jd|t|�||d��|jt|��S(unInsert thousands separators into a digit string.

    spec is a dictionary whose keys should include 'thousands_sep' and
    'grouping'; typically it's the result of parsing the format
    specifier using _parse_format_specifier.

    The min_width keyword argument gives the minimum length of the
    result, which will be padded on the left with zeros if necessary.

    If necessary, the zero padding adds an extra '0' on the left to
    avoid a leading thousands separator.  For example, inserting
    commas every three digits in '123456', with min_width=8, gives
    '0,123,456', even though that has length 9.

    u
thousands_sepugroupingiugroup length should be positiveiu0N(u_group_lengthsu
ValueErroruminumaxulenuappendujoinureversed(udigitsuspecu	min_widthusepugroupingugroupsul((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_insert_thousands_sep�s 

!*
*u_insert_thousands_sepcCs*|r
dS|ddkr"|dSdSdS(uDetermine sign character.u-usignu +uN((uis_negativeuspec((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_format_sign�s
u_format_signcCst||�}|s|dr0|d|}n|dksL|ddkr�idd6dd6dd6dd	6|d}|d
j||�7}n|ddkr�|d7}n|dr�|d
t|�t|�}nd}t|||�}t||||�S(ucFormat a number, given the following data:

    is_negative: true if the number is negative, else false
    intpart: string of digits that must appear before the decimal point
    fracpart: string of digits that must come after the point
    exp: exponent, as an integer
    spec: dictionary resulting from parsing the format specifier

    This function uses the information in spec to:
      insert separators (decimal separator and thousands separators)
      format the sign
      format the exponent
      add trailing '%' for the '%' type
      zero-pad if necessary
      fill and align if necessary
    ualtu
decimal_pointiutypeueEuEueuGugu{0}{1:+}u%uzeropaduminimumwidth(u_format_signuformatulenu_insert_thousands_sepu
_format_align(uis_negativeuintpartufracpartuexpuspecusignuecharu	min_width((u,/opt/alt/python33/lib64/python3.3/decimal.pyu_format_number�s*

!u_format_numberuInfu-InfuNaN(u*u__main__(�u__doc__u__all__u__version__u__libmpdec_version__ucopyu_copyumathu_mathunumbersu_numbersusysucollectionsu
namedtupleu_namedtupleuDecimalTupleuImportErroru
ROUND_DOWNu
ROUND_HALF_UPuROUND_HALF_EVENu
ROUND_CEILINGuROUND_FLOORuROUND_UPuROUND_HALF_DOWNu
ROUND_05UPuTrueuHAVE_THREADSumaxsizeuMAX_PRECuMAX_EMAXuMIN_EMINu	MIN_ETINYuArithmeticErroruDecimalExceptionuClampeduInvalidOperationuConversionSyntaxuZeroDivisionErroruDivisionByZerouDivisionImpossibleuDivisionUndefineduInexactuInvalidContextuRoundedu	SubnormaluOverflowu	Underflowu	TypeErroruFloatOperationu_signalsu_condition_mapu_rounding_modesu	threadinguobjectu
MockThreadingulocaluAttributeErroruhasattrucurrent_threadu__decimal_context__u
setcontextu
getcontextuNoneulocalcontextuDecimaluFalseu_dec_from_tripleuNumberuregisteru_ContextManageruContextu_WorkRepu
_normalizeuintu
bit_lengthu_nbitsu_decimal_lshift_exactu
_sqrt_nearestu_rshift_nearestu_div_nearestu_ilogu_dlog10u_dlogu
_Log10Memoizeu	getdigitsu
_log10_digitsu_iexpu_dexpu_dpoweru	_log10_lbu_convert_otheru_convert_for_comparisonuDefaultContextuBasicContextuExtendedContextureucompileuVERBOSEu
IGNORECASEumatchu_parseru
_all_zerosu_exact_halfuDOTALLu_parse_format_specifier_regexulocaleu_localeu_parse_format_specifieru
_format_alignu_group_lengthsu_insert_thousands_sepu_format_signu_format_numberu	_Infinityu_NegativeInfinityu_NaNu_Zerou_Oneu_NegativeOneu_SignedInfinityu	hash_infoumodulusu_PyHASH_MODULUSuinfu_PyHASH_INFunanu_PyHASH_NANupowu
_PyHASH_10INVu_decimalusetudirus1us2unameuglobalsu__name__udoctestudecimalutestmod(((u,/opt/alt/python33/lib64/python3.3/decimal.pyu<module>qsl			


&



	
	.��������������������	0",#%$*#(	*			

P%
)