uawdijnntqw1x1x1
IP : 18.118.166.45
Hostname : host45.registrar-servers.com
Kernel : Linux host45.registrar-servers.com 4.18.0-513.18.1.lve.2.el8.x86_64 #1 SMP Sat Mar 30 15:36:11 UTC 2024 x86_64
Disable Function : None :)
OS : Linux
PATH:
/
home
/
..
/
lib64
/
sasl2
/
..
/
nss
/
..
/
xtables
/
..
/
krb5
/
..
/
python2.7
/
decimal.pyo
/
/
� zfc@sdZddddddddd d ddd ddddddddddddgZdZddlZddlZy#ddlmZ e dd�Z Wnek r�d �Z nXdZdZ dZdZdZdZdZdZdefd!��YZdefd"��YZdefd#��YZd$efd%��YZd eefd&��YZd'efd(��YZd)eefd*��YZd efd+��YZd,efd-��YZdefd.��YZdefd/��YZ d eefd0��YZ!deee fd1��YZ"eeee!ee"ee gZ#iee6ee6ee6ee6Z$yddl%Z%WnBek r�ddl&Z&d2e'fd3��YZ(e(�Z%[&[(nXye%j)WnGe*k r�e+e%j,�d4�r�e%j,�`-nd5�Z.d6�Z/nCXe%j)�Z)e+e)d4�r e)`-ne)d7�Z/e)d8�Z.[%[)e0d9�Z1de'fd:��YZ2e3d;�Z4ej5j6e2�d<e'fd=��YZ7de'fd>��YZ8d?e'fd@��YZ9dAdB�Z:idCdD6dEdF6dGdH6dGdI6dJdK6dJdL6dJdM6dJdN6dAdO6dAdP6dAdQ6dAdR6dAdS6dAdT6dAdU6dAdV6dW�Z;dX�Z<dY�Z=dZ�Z>d[�Z?d\d]�Z@d^�ZAd_�ZBd`e'fda��YZCeC�jDZEd\db�ZFdc�ZGdd�ZHi dedF6dfdH6dgdI6dhdK6didL6djdM6dkdN6dldO6dmdP6dn�ZIe3e3do�ZJe8dpdqdredsee!egdtgdudvdwdxdydJ�ZKe8dpdzdre dsee!eee"gdtg�ZLe8dpdzdredsgdtg�ZMddlNZNeNjOd{eNjPeNjQBeNjRB�jSZTeNjOd|�jSZUeNjOd}�jSZVeNjOd~eNjP�ZW[NyddlXZYWnek r@nXe0d�ZZd��Z[d��Z\dJd��Z]d��Z^d��Z_e2d��Z`e2d��Zae2d��Zbe2dA�Zce2dJ�Zde2d�Zee`eafZfegd�krddlhZhddl&Z&ehjie&jjeg�ndS(�s� This is a Py2.3 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 the expected Decimal('0.00') returned by decimal floating point). 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.45e12345678901234567890') Decimal('1.2345E+12345678901234567892') >>> 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): ... ... ... 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): ... ... ... 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 >>> tDecimaltContexttDefaultContexttBasicContexttExtendedContexttDecimalExceptiontClampedtInvalidOperationtDivisionByZerotInexacttRoundedt SubnormaltOverflowt Underflowt ROUND_DOWNt ROUND_HALF_UPtROUND_HALF_EVENt ROUND_CEILINGtROUND_FLOORtROUND_UPtROUND_HALF_DOWNt ROUND_05UPt setcontextt getcontexttlocalcontexts1.70i����N(t namedtupletDecimalTuplessign digits exponentcGs|S(N((targs((s/usr/lib64/python2.7/decimal.pyt<lambda>�tcBseZdZd�ZRS(s1Base 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((tselftcontextR((s/usr/lib64/python2.7/decimal.pythandle�s(t__name__t __module__t__doc__R (((s/usr/lib64/python2.7/decimal.pyR�scBseZdZRS(s)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"). (R!R"R#(((s/usr/lib64/python2.7/decimal.pyR�s cBseZdZd�ZRS(s0An 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|djdt�}|j|�StS(Nitn(t_dec_from_triplet_signt_inttTruet_fix_nant_NaN(RRRtans((s/usr/lib64/python2.7/decimal.pyR �s# (R!R"R#R (((s/usr/lib64/python2.7/decimal.pyR�stConversionSyntaxcBseZdZd�ZRS(s�Trying to convert badly formed string. This occurs and signals invalid-operation if a string is being converted to a number and it does not conform to the numeric string syntax. The result is [0,qNaN]. cGstS(N(R*(RRR((s/usr/lib64/python2.7/decimal.pyR �s(R!R"R#R (((s/usr/lib64/python2.7/decimal.pyR,�scBseZdZd�ZRS(s�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(t_SignedInfinity(RRtsignR((s/usr/lib64/python2.7/decimal.pyR �s(R!R"R#R (((s/usr/lib64/python2.7/decimal.pyR�stDivisionImpossiblecBseZdZd�ZRS(s�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(R*(RRR((s/usr/lib64/python2.7/decimal.pyR s(R!R"R#R (((s/usr/lib64/python2.7/decimal.pyR/�stDivisionUndefinedcBseZdZd�ZRS(s�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(R*(RRR((s/usr/lib64/python2.7/decimal.pyR s(R!R"R#R (((s/usr/lib64/python2.7/decimal.pyR0scBseZdZRS(s�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. (R!R"R#(((s/usr/lib64/python2.7/decimal.pyR s tInvalidContextcBseZdZd�ZRS(s�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(R*(RRR((s/usr/lib64/python2.7/decimal.pyR 's(R!R"R#R (((s/usr/lib64/python2.7/decimal.pyR1s cBseZdZRS(s�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. (R!R"R#(((s/usr/lib64/python2.7/decimal.pyR *s cBseZdZRS(s�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. (R!R"R#(((s/usr/lib64/python2.7/decimal.pyR6s cBseZdZd�ZRS(sNumerical 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(Nit9i(troundingRRRRR-RR%tprectEmaxR(RRR.R((s/usr/lib64/python2.7/decimal.pyR Ws(R!R"R#R (((s/usr/lib64/python2.7/decimal.pyRAscBseZdZRS(sxNumerical 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. (R!R"R#(((s/usr/lib64/python2.7/decimal.pyR gs t MockThreadingcBseZed�ZRS(cCs|jtS(N(tmodulesR!(Rtsys((s/usr/lib64/python2.7/decimal.pytlocal�s(R!R"R8R9(((s/usr/lib64/python2.7/decimal.pyR6�st__decimal_context__cCsA|tttfkr.|j�}|j�n|tj�_dS(s%Set this thread's context to context.N(RRRtcopytclear_flagst threadingt currentThreadR:(R((s/usr/lib64/python2.7/decimal.pyR�s cCsBytj�jSWn*tk r=t�}|tj�_|SXdS(s�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(R=R>R:tAttributeErrorR(R((s/usr/lib64/python2.7/decimal.pyR�s cCs6y|jSWn$tk r1t�}||_|SXdS(s�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(R:R?R(t_localR((s/usr/lib64/python2.7/decimal.pyR�s cCs;|tttfkr.|j�}|j�n||_dS(s%Set this thread's context to context.N(RRRR;R<R:(RR@((s/usr/lib64/python2.7/decimal.pyR�s cCs"|dkrt�}nt|�S(s^Return 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(tNoneRt_ContextManager(tctx((s/usr/lib64/python2.7/decimal.pyR�s$cBsreZdZd�Zdd�d�Zd�Zee�Zd�Zd �Z d�d�d �Z d�Zd�Zd �Z d�d�Zd�d�Zd�d�Zd�d�Zd�d�Zd�d�Zd�d�Zd�Zd�Zd�Zed�d�Zd�d�Zd�d�Zd�d�Zed�d�Zd�d�ZeZ d�d�Z!d�d�Z"d�d �Z#e#Z$d�d!�Z%d"�Z&d�d#�Z'e%Z(e'Z)d�d$�Z*d�d%�Z+d�d&�Z,d�d'�Z-d�d(�Z.d�d)�Z/d�d*�Z0d+�Z1d,�Z2e2Z3d-�Z4e5e4�Z4d.�Z6e5e6�Z6d/�Z7d0�Z8d1�Z9d2�Z:d3�Z;d4�Z<d5�Z=d6�Z>d7�Z?d8�Z@d9�ZAd:�ZBd;�ZCeDd<e<d=e=d>e>d?e?d@e@dAeAdBeBdCeC�ZEd�dD�ZFd�dE�ZGdF�ZHd�d�dG�ZId�dH�ZJd�dI�ZKd�d�edJ�ZLdK�ZMdL�ZNdM�ZOd�d�dN�ZPd�d�dO�ZQeQZRd�dP�ZSd�dQ�ZTd�dR�ZUdS�ZVdT�ZWdU�ZXd�dV�ZYd�dW�ZZdX�Z[dY�Z\dZ�Z]d[�Z^d\�Z_d�d]�Z`d^�Zad_�Zbd`�Zcda�Zdd�db�Zedc�Zfdd�Zgde�Zhd�df�Zidg�Zjdh�Zkd�di�Zldj�Zmd�dk�Znd�dl�Zodm�Zpdn�Zqd�do�Zrd�dp�Zsd�dq�Ztd�dr�Zud�ds�Zvd�dt�Zwd�du�Zxd�dv�Zyd�dw�Zzd�dx�Z{dy�Z|d�dz�Z}d�d{�Z~d�d|�Zd}�Z�d~�Z�d�Z�d�d�d��Z�RS(�s,Floating point class for decimal arithmetic.t_expR'R&t_is_specialt0cCs�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 �}t t||��|_|t|�|_t|_n�|j d�}|dk r{t t|p?d ��jd �|_|j d�rod |_q�d|_nd |_d|_t|_|St|ttf�r�|dkr�d|_n d|_d|_t t|��|_t|_|St|t�r>|j|_|j|_|j|_|j|_|St|t�r�|j|_t |j�|_t|j�|_t|_|St|ttf�r^t|�dkr�td��nt|dttf�o�|ddks�td��n|d|_|ddkr7d |_|d|_t|_n#g} xt|dD]h} t| ttf�r�d| kozdknr�| s�| dkr�| j| �q�qHtd��qHW|ddkr�djt t | ��|_|d|_t|_nbt|dttf�rNdjt t | p)dg��|_|d|_t|_ntd��|St|t!�r�tj"|�}|j|_|j|_|j|_|j|_|St#d|��dS(s�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 or long Decimal('314') >>> Decimal(Decimal(314)) # another decimal instance Decimal('314') >>> Decimal(' 3.14 \n') # leading and trailing whitespace okay Decimal('3.14') sInvalid literal for Decimal: %rR.t-iitinttfracRtexpRFtdiagtsignaltNR$tFistInvalid tuple size in creation of Decimal from list or tuple. The list or tuple should have exactly three elements.s|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 sTThe second value in the tuple must be composed of integers in the range 0 through 9.sUThe third value in the tuple must be an integer, or one of the strings 'F', 'n', 'N'.sCannot convert %r to DecimalN(ii(R$RM($tobjectt__new__t isinstancet basestringt_parsertstripRARt_raise_errorR,tgroupR&RHtstrR'tlenRDtFalseREtlstripR(tlongtabsRt_WorkRepR.RJtlistttuplet ValueErrortappendtjointmaptfloatt from_floatt TypeError(tclstvalueRRtmtintparttfracpartRJRKtdigitstdigit((s/usr/lib64/python2.7/decimal.pyRPs� $ ) 1 $ cCs�t|ttf�r||�Stj|�s=tj|�rM|t|��Stjd|�dkrnd}nd}t|�j �\}}|j �d}t|t|d|�|�}|t kr�|S||�SdS(s.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') g�?iiiN(RQRHR[t_mathtisinftisnantreprtcopysignR\tas_integer_ratiot bit_lengthR%RWR(RgtfR.R$tdtktresult((s/usr/lib64/python2.7/decimal.pyRe�s !cCs9|jr5|j}|dkr"dS|dkr5dSndS(srReturns whether the number is not actually one. 0 if a number 1 if NaN 2 if sNaN R$iRMii(RERD(RRJ((s/usr/lib64/python2.7/decimal.pyt_isnan�s cCs$|jdkr |jrdSdSdS(syReturns whether the number is infinite 0 if finite or not a number 1 if +INF -1 if -INF RNi����ii(RDR&(R((s/usr/lib64/python2.7/decimal.pyt_isinfinity�s cCs�|j�}|dkr!t}n|j�}|s9|r�|dkrQt�}n|dkrp|jtd|�S|dkr�|jtd|�S|r�|j|�S|j|�SdS(s�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. itsNaNiN(RyRARYRRURR)(RtotherRtself_is_nantother_is_nan((s/usr/lib64/python2.7/decimal.pyt_check_nans�s" cCs�|dkrt�}n|js*|jr�|j�rI|jtd|�S|j�rh|jtd|�S|j�r�|jtd|�S|j�r�|jtd|�SndS(sCVersion 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. scomparison involving sNaNscomparison involving NaNiN(RARREtis_snanRURtis_qnan(RR|R((s/usr/lib64/python2.7/decimal.pyt_compare_check_nans�s( cCs|jp|jdkS(suReturn True if self is nonzero; otherwise return False. NaNs and infinities are considered nonzero. RF(RER'(R((s/usr/lib64/python2.7/decimal.pyt__nonzero__scCsd|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(s�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.ii����iRFN(RERzR&tadjustedR'RD(RR|tself_inft other_inft self_adjustedtother_adjustedtself_paddedtother_padded((s/usr/lib64/python2.7/decimal.pyt_cmps>cCsKt|dt�}|tkr"|S|j||�r8tS|j|�dkS(Ntallow_floati(t_convert_otherR(tNotImplementedRRYR�(RR|R((s/usr/lib64/python2.7/decimal.pyt__eq___scCsKt|dt�}|tkr"|S|j||�r8tS|j|�dkS(NR�i(R�R(R�RR�(RR|R((s/usr/lib64/python2.7/decimal.pyt__ne__gscCsQt|dt�}|tkr"|S|j||�}|r>tS|j|�dkS(NR�i(R�R(R�R�RYR�(RR|RR+((s/usr/lib64/python2.7/decimal.pyt__lt__oscCsQt|dt�}|tkr"|S|j||�}|r>tS|j|�dkS(NR�i(R�R(R�R�RYR�(RR|RR+((s/usr/lib64/python2.7/decimal.pyt__le__xscCsQt|dt�}|tkr"|S|j||�}|r>tS|j|�dkS(NR�i(R�R(R�R�RYR�(RR|RR+((s/usr/lib64/python2.7/decimal.pyt__gt__�scCsQt|dt�}|tkr"|S|j||�}|r>tS|j|�dkS(NR�i(R�R(R�R�RYR�(RR|RR+((s/usr/lib64/python2.7/decimal.pyt__ge__�scCs\t|dt�}|js*|rI|jrI|j||�}|rI|Snt|j|��S(s�Compares one to another. -1 => a < b 0 => a = b 1 => a > b NaN => one is NaN Like __cmp__, but returns Decimal instances. traiseit(R�R(RERRR�(RR|RR+((s/usr/lib64/python2.7/decimal.pytcompare�s cCs�|jrH|j�r$td��qH|j�r4dS|jrAdSdSnt|�}tj|�|krst|�S|j �r�t |j��}td|j|j td|jd��St|j|jt|j�|jjd �f�S( sx.__hash__() <==> hash(x)s"Cannot hash a signaling NaN value.ii,��i/�i����i ii@iRFll����(RER�Rftis_nanR&RdRRethasht _isintegerR]tto_integral_valueR.RHtpowRJRDRXR'trstrip(Rt self_as_floattop((s/usr/lib64/python2.7/decimal.pyt__hash__�s" + cCs(t|jttt|j��|j�S(seRepresents the number as a triple tuple. To show the internals exactly as they are. (RR&R_RcRHR'RD(R((s/usr/lib64/python2.7/decimal.pytas_tuple�scCsdt|�S(s0Represents the number as an instance of Decimal.s Decimal('%s')(RW(R((s/usr/lib64/python2.7/decimal.pyt__repr__�sc Cs�ddg|j}|jrc|jdkr3|dS|jdkrQ|d|jS|d|jSn|jt|j�}|jdkr�|d kr�|}nE|s�d }n6|jdkr�|d dd }n|d dd }|dkr d}d d||j}nZ|t|j�krI|jd|t|j�}d}n|j| }d |j|}||kr|d}n7|dkr�t�}nddg|jd||}||||S(s�Return string representation of the number in scientific notation. Captures all of the information in the underlying representation. RRGRNtInfinityR$tNaNR{ii����iRFit.tetEs%+dN(R&RERDR'RXRARtcapitals( RtengRR.t leftdigitstdotplaceRjRkRJ((s/usr/lib64/python2.7/decimal.pyt__str__�s: cCs|jdtd|�S(s,Convert to a string, using engineering notation if an exponent is needed. Engineering notation has an exponent which is a multiple of 3. This can leave up to 3 digits to the left of the decimal place and may require the addition of either one or two trailing zeros. R�R(R�R((RR((s/usr/lib64/python2.7/decimal.pyt to_eng_stringscCs~|jr(|jd|�}|r(|Sn|dkr@t�}n|re|jtkre|j�}n|j�}|j|�S(sRReturns a copy with the sign switched. Rounds, if it has reason. RN( RERRARR3Rtcopy_abstcopy_negatet_fix(RRR+((s/usr/lib64/python2.7/decimal.pyt__neg__#s cCs~|jr(|jd|�}|r(|Sn|dkr@t�}n|re|jtkre|j�}nt|�}|j|�S(shReturns a copy, unless it is a sNaN. Rounds the number (if more than precision digits) RN( RERRARR3RR�RR�(RRR+((s/usr/lib64/python2.7/decimal.pyt__pos__9s cCsl|s|j�S|jr8|jd|�}|r8|Sn|jrV|jd|�}n|jd|�}|S(s�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(). R(R�RERR&R�R�(RtroundRR+((s/usr/lib64/python2.7/decimal.pyt__abs__Ns 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(sbReturns self + other. -INF + INF (or the reverse) cause InvalidOperation errors. s -INF + INFiiRFN(ii(R�R�RARRERRzR&RURRtminRDR3RR%R�tmaxR4t_rescaleR]t _normalizeR.RHRJ( RR|RR+RJtnegativezeroR.top1top2Rx((s/usr/lib64/python2.7/decimal.pyt__add__ds| ! cCsit|�}|tkr|S|js.|jrP|j|d|�}|rP|Sn|j|j�d|�S(sReturn self - otherR(R�R�RERR�R�(RR|RR+((s/usr/lib64/python2.7/decimal.pyt__sub__�scCs/t|�}|tkr|S|j|d|�S(sReturn other - selfR(R�R�R�(RR|R((s/usr/lib64/python2.7/decimal.pyt__rsub__�scCs�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�|rt|d|�}|j |�}|S|jdkrCt||j|�}|j |�}|S|jdkrzt||j|�}|j |�}|St|�}t|�}t|t|j|j�|�}|j |�}|S(s\Return self * other. (+-) INF * 0 (or its reverse) raise InvalidOperation. s(+-)INF * 0s0 * (+-)INFRFt1N(R�R�RARR&RERRzRURR-RDR%R�R'R]RWRH(RR|Rt resultsignR+t resultexpR�R�((s/usr/lib64/python2.7/decimal.pyt__mul__�sH"cCslt|�}|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(sReturn self / other.s(+-)INF/(+-)INFsDivision by infinityRFs0 / 0sx / 0iii iN(R�R�RARR&RERRzRURR-RR%tEtinyR0RRDRXR'R4R]tdivmodRHRWR�(RR|RR.R+RJtcoefftshiftR�R�t remaindert ideal_exp((s/usr/lib64/python2.7/decimal.pyt__truediv__sP '&$ 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(s�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. i����RFii s%quotient too large in //, % or divmod(R&RzRDR�R�R%R�R3R4R]RJRHR�RWRUR/(RR|RR.R�texpdiffR�R�tqtrR+((s/usr/lib64/python2.7/decimal.pyt_divideFs* cCs/t|�}|tkr|S|j|d|�S(s)Swaps self/other and returns __truediv__.R(R�R�R�(RR|R((s/usr/lib64/python2.7/decimal.pyt__rtruediv__gscCs8t|�}|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(s6 Return (self // other, self % other) sdivmod(INF, INF)sINF % xsdivmod(0, 0)sx // 0sx % 0N(R�R�RARRR&RzRURR-R0RR�R�(RR|RR+R.tquotientR�((s/usr/lib64/python2.7/decimal.pyt __divmod__qs0 cCs/t|�}|tkr|S|j|d|�S(s(Swaps self/other and returns __divmod__.R(R�R�R�(RR|R((s/usr/lib64/python2.7/decimal.pyt__rdivmod__�scCs�t|�}|tkr|S|dkr4t�}n|j||�}|rP|S|j�rl|jtd�S|s�|r�|jtd�S|jtd�Sn|j ||�d}|j |�}|S(s self % other sINF % xsx % 0s0 % 0iN(R�R�RARRRzRURR0R�R�(RR|RR+R�((s/usr/lib64/python2.7/decimal.pyt__mod__�s"cCs/t|�}|tkr|S|j|d|�S(s%Swaps self/other and returns __mod__.R(R�R�R�(RR|R((s/usr/lib64/python2.7/decimal.pyt__rmod__�scCs||dkrt�}nt|dt�}|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|dkrW|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(sI Remainder nearest to 0- abs(remainder-near) <= other/2 R�sremainder_near(infinity, x)sremainder_near(x, 0)sremainder_near(0, 0)RFii����i iiN(RARR�R(RRzRURR0RR�R�RDR%R&R�R4R/R�R3R]RJRHR�RW(RR|RR+tideal_exponentR�R�R�R�R�R.((s/usr/lib64/python2.7/decimal.pytremainder_near�sZ cCs�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(s self // others INF // INFsx // 0s0 // 0iN( R�R�RARRRzRURR-R&RR0R�(RR|RR+((s/usr/lib64/python2.7/decimal.pyt__floordiv__ s$cCs/t|�}|tkr|S|j|d|�S(s*Swaps self/other and returns __floordiv__.R(R�R�R�(RR|R((s/usr/lib64/python2.7/decimal.pyt __rfloordiv__%scCsU|j�r?|j�r'td��n|jr6dnd}nt|�}t|�S(sFloat representation.s%Cannot convert signaling NaN to floats-nantnan(RyR�R`R&RWRd(Rts((s/usr/lib64/python2.7/decimal.pyt __float__,scCs�|jrB|j�r$td��qB|j�rBtd��qBnd|j}|jdkrz|t|j�d|jS|t|j|j p�d�SdS(s1Converts self to an int, truncating if necessary.sCannot convert NaN to integers"Cannot convert infinity to integeri����ii RFN( RERyR`Rzt OverflowErrorR&RDRHR'(RR�((s/usr/lib64/python2.7/decimal.pyt__int__6s cCs|S(N((R((s/usr/lib64/python2.7/decimal.pytrealEscCs td�S(Ni(R(R((s/usr/lib64/python2.7/decimal.pytimagIscCs|S(N((R((s/usr/lib64/python2.7/decimal.pyt conjugateMscCstt|��S(N(tcomplexRd(R((s/usr/lib64/python2.7/decimal.pyt__complex__PscCst|j��S(sCConverts to a long. Equivalent to long(int(self)) (R[R�(R((s/usr/lib64/python2.7/decimal.pyt__long__SscCsk|j}|j|j}t|�|kra|t|�|jd�}t|j||jt�St |�S(s2Decapitate the payload of a NaN to fit the contextRF( R'R4t_clampRXRZR%R&RDR(R(RRtpayloadtmax_payload_len((s/usr/lib64/python2.7/decimal.pyR)Zs cCs/|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} | || �}|j| p�d}|dkrtt|�d�}t|�|jkr|d }|d7}qn||kr5|jtd|j�}nt |j||�}|rf|rf|jt�n|r||jt�n|r�|jt�n|jt�|s�|jt�n|S|r�|jt�n|jdkr%|j |kr%|jt�|jd|j |} t |j| |�St|�S(s�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. RFs above EmaxiR�ii����(RERyR)RR�tEtopR5R�R�R�RDRURR%R&RXR'R4RR R t_pick_rounding_functionR3RWRHR R(RRR�R�texp_maxtnew_exptexp_minR+tself_is_subnormalRltrounding_methodtchangedR�R�((s/usr/lib64/python2.7/decimal.pyR�fsn cCst|j|�rdSdSdS(s(Also known as round-towards-0, truncate.ii����N(t _all_zerosR'(RR4((s/usr/lib64/python2.7/decimal.pyt_round_down�scCs|j|�S(sRounds away from 0.(R�(RR4((s/usr/lib64/python2.7/decimal.pyt _round_up�scCs5|j|dkrdSt|j|�r-dSdSdS(sRounds 5 up (away from 0)t56789iii����N(R'R�(RR4((s/usr/lib64/python2.7/decimal.pyt_round_half_up�s cCs't|j|�rdS|j|�SdS(sRound 5 downi����N(t_exact_halfR'R�(RR4((s/usr/lib64/python2.7/decimal.pyt_round_half_down�scCsJt|j|�r9|dks5|j|ddkr9dS|j|�SdS(s!Round 5 to even, rest to nearest.iit02468i����N(R�R'R�(RR4((s/usr/lib64/python2.7/decimal.pyt_round_half_even�s#cCs(|jr|j|�S|j|�SdS(s(Rounds up (not away from 0 if negative.)N(R&R�(RR4((s/usr/lib64/python2.7/decimal.pyt_round_ceiling�s cCs(|js|j|�S|j|�SdS(s'Rounds down (not towards 0 if negative)N(R&R�(RR4((s/usr/lib64/python2.7/decimal.pyt_round_floor�s cCs<|r*|j|ddkr*|j|�S|j|�SdS(s)Round down unless digit prec-1 is 0 or 5.it05N(R'R�(RR4((s/usr/lib64/python2.7/decimal.pyt_round_05up�s RRRRRRRRcCs�t|dt�}|js$|jr+|dkr<t�}n|jdkr^|jtd|�S|jdkr�|jtd|�S|jdkr�|}qm|jdkr�|}qm|jdkr�|s�|jtd�St|j |j A}qm|jdkrm|s|jtd�St|j |j A}qmnBt |j |j Att|j �t|j ��|j|j�}t|dt�}|j||�S( s: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. R�RMR{R$RNsINF * 0 in fmas0 * INF in fmaN(R�R(RERARRDRURR-R&R%RWRHR'R�(RR|tthirdRtproduct((s/usr/lib64/python2.7/decimal.pytfmas6 cCszt|dt�}t|dt�}|dkr<t�}n|j�}|j�}|j�}|sr|sr|r|dkr�|jtd|�S|dkr�|jtd|�S|dkr�|jtd|�S|r�|j|�S|r�|j|�S|j|�S|j�o#|j�o#|j�s6|jtd�S|dkrR|jtd�S|sh|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 |�}q3Wt|| j|�}t|t|�d�S(s!Three argument version of __pow__R�iR{s@pow() 3rd argument not allowed unless all arguments are integersisApow() 2nd argument cannot be negative when 3rd argument specifiedspow() 3rd argument cannot be 0sSinsufficient precision: pow() 3rd argument must not have more than precision digitssXat least one of pow() 1st argument and 2nd argument must be nonzero; 0**0 is not definedi N(R�R(RARRyRURR)R�R�R4t_isevenR&R\RHR]R�R�RJtxrangeR%RW(RR|tmoduloRR}R~t modulo_is_nanR.tbasetexponentti((s/usr/lib64/python2.7/decimal.pyt _power_modulo;sd $cCsEt|�}|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�|dkr@t |�d d} td| |�\}}|r�dSx(|ddkr�|d}| d8} q�W|dd}|tt|��kr�dSt | ||�} t |||�}| dks|dkr#dS| |kr3dSd| }ndS|d|krXdS| |}t dt|�|�S|dkr�|d|d}}n|dkr�ttt||���|kr�dSt |�}|dkrttt|�|��|krdS|d|}}x<|d|dkoCdknr_|d}|d}q$Wx<|d|dko�dknr�|d}|d}qcW|dkrw|dkr�||kr�dSt||�\}}|dkr�dSdt |�|>}xMtrQt|||d�\}}||kr8Pq||d||}qW||kog|dksndS|}n|dkr�||dt|�kr�dS||}||9}|d|kr�dSt|�}|j�r#|jdkr#|jt|�} t|| |t|��}nd}t d|d|||�S(shAttempt 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 iiR�RFiiiii]iAiiilidN(iiii(R]RHRJRAR.R�R&RDR�R%t_nbitsRXRWt_decimal_lshift_exactR�R\R(t _log10_lb(RR|tptxtxctxetytyctyeRR�tzerost last_digitR�temaxR�RiR$txc_bitstremtaR�R�tstr_xc((s/usr/lib64/python2.7/decimal.pyt_power_exact�s�: //' ' & cCs�|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}nt|�}|j|}|d|jkrd|j}|jt�qn'|jt�|jt�d|j}t |dd||�S|j�}|j�r{|j dk|dkkrpt |dd�St|Snd}t} |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�}nt} q�n|dkr�|j}t|�} | j| j }}t|�}|j|j }}|j!dkr|}nd}x`trht"||||||�\}}|dd tt|��|dr[Pn|d7}q Wt |t|�|�}n| r�|j �r�t|j�|jkr�|jdt|j�}t |j |jd||j|�}n|j#�}|j$�xt%D]}d|j&|<qW|j'|�}|jt�|j(t)r`|jt*�n|j(t+r�|jt+d |j �nxLt*t)ttt,fD]#}|j(|r�|j|�q�q�Wn|j'|�}|S(sHReturn 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. s0 ** 0iis+x ** y with x negative and y not an integerRFR�iii s above EmaxN(-RARR�R�RRRURt_OneR&R�R�R�R%R-RzR4RHRDR R R�RYt_log10_exp_boundRXRWR5R�RR'R(R]RJR.t_dpowerR;R<t_signalsttrapsR�tflagsRR RR(RR|R�RR+tresult_signt multiplierRJtself_adjtexacttboundR�RR R RRR RtextraR�R�t newcontextt exception((s/usr/lib64/python2.7/decimal.pyt__pow__|s� "& cCs/t|�}|tkr|S|j|d|�S(s%Swaps self/other and returns __pow__.R(R�R�R%(RR|R((s/usr/lib64/python2.7/decimal.pyt__rpow__T scCs|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| |�S(s?Normalize- strip trailing 0s, change anything equal to 0 to 0e0RRFiiN(RARRERR�RzR%R&R5R�R�RXR'RD(RRR+tdupR�tendRJ((s/usr/lib64/python2.7/decimal.pyt normalize[ s$ & cCs�t|dt�}|dkr*t�}n|dkrB|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|jkr|j t �||kr|j t�qn|S|j�|jko=|jknsR|j t d�S|s}t|jd|j�}|j|�S|j�}||jkr�|j t d�S||jd|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|jkr�||kr�|j t�n|j t �n|j|�}|S( s�Quantize self so its exponent is the same as that of exp. Similar to self._rescale(exp._exp) but with error checking. R�squantize with one INFs)target exponent out of bounds in quantizeRFs9exponent of quantize result too large for current contextis7quantize result has too many digits for current contextN(R�R(RARR3RERRzRRURR�RDR R R�R5R%R&R�R�R4RXR'tEminR(RRJR3RtwatchexpR+R�((s/usr/lib64/python2.7/decimal.pytquantizet sb ( cCsbt|dt�}|js$|jrR|j�r<|j�pQ|j�oQ|j�S|j|jkS(s=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. R�(R�R(RER�tis_infiniteRD(RR|((s/usr/lib64/python2.7/decimal.pytsame_quantum� s cCs|jrt|�S|s,t|jd|�S|j|kr`t|j|jd|j||�St|j�|j|}|dkr�t|jd|d�}d}n|j|}|||�}|j| p�d}|dkr�tt |�d�}nt|j||�S(ssRescale 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 RFiR�i( RERR%R&RDR'RXR�RWRH(RRJR3Rlt this_functionR�R�((s/usr/lib64/python2.7/decimal.pyR�� s" cCs�|dkrtd��n|js+|r5t|�S|j|j�d||�}|j�|j�kr�|j|j�d||�}n|S(s"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. is'argument should be at least 1 in _roundi(R`RERR�R�(RtplacesR3R+((s/usr/lib64/python2.7/decimal.pyt_round� s #cCs�|jr/|jd|�}|r%|St|�S|jdkrHt|�S|sat|jdd�S|dkryt�}n|dkr�|j}n|j d|�}||kr�|j t�n|j t�|S(sVRounds 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. RiRFN( RERRRDR%R&RARR3R�RUR R (RR3RR+((s/usr/lib64/python2.7/decimal.pytto_integral_exact s$ cCs�|dkrt�}n|dkr0|j}n|jr_|jd|�}|rU|St|�S|jdkrxt|�S|jd|�SdS(s@Rounds to the nearest integer, without raising inexact, rounded.RiN(RARR3RERRRDR�(RR3RR+((s/usr/lib64/python2.7/decimal.pyR� s cCs�|d krt�}n|jre|jd|�}|r=|S|j�re|jdkret|�Sn|s�t|jd|jd�}|j |�S|jdkr�|j td�S|jd}t |�}|jd?}|jd@r |jd}t|j�d?d}n |j}t|j�dd?}||}|dkrZ|d|9}t} n!t|d|�\}} | } ||8}d|}x2tr�||}||kr�Pq�||d?}q�W| o�|||k} | r|dkr�|d|}n|d|9}||7}n|d dkr6|d7}ntdt|�|�}|j�}|jt�} |j |�}| |_|S(sReturn the square root of self.RiRFiissqrt(-x), x > 0i idiN(RARRERRzR&RR%RDR�RURR4R]RJRHRXR'R(R�RWt _shallow_copyt _set_roundingRR3(RRR+R4R�R�tctlR�R R�R$R�R3((s/usr/lib64/python2.7/decimal.pytsqrt3 s` cCst|dt�}|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(s�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. R�iii����N( R�R(RARRERyR�RR�t compare_total(RR|RtsntonR5R+((s/usr/lib64/python2.7/decimal.pyR�� s& cCst|dt�}|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(s�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. R�iii����N( R�R(RARRERyR�RR�R8(RR|RR9R:R5R+((s/usr/lib64/python2.7/decimal.pyR�� s& cCsD|jr tS|jdkr tS|j|j}|dt|�kS(s"Returns whether self is an integeriRF(RERYRDR(R'RX(Rtrest((s/usr/lib64/python2.7/decimal.pyR�� s cCs2|s|jdkrtS|jd|jdkS(s:Returns True if self is even. Assumes self is an integer.ii����R�(RDR(R'(R((s/usr/lib64/python2.7/decimal.pyR�� scCs5y|jt|j�dSWntk r0dSXdS(s$Return the adjusted exponent of selfiiN(RDRXR'Rf(R((s/usr/lib64/python2.7/decimal.pyR�� s cCs|S(s�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. ((RR((s/usr/lib64/python2.7/decimal.pyt canonical� scCsAt|dt�}|j||�}|r.|S|j|d|�S(s�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. R�R(R�R(R�R�(RR|RR+((s/usr/lib64/python2.7/decimal.pytcompare_signals cCs�t|dt�}|jr)|jr)tS|jr@|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(s�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. R�ii( R�R(R&t_NegativeOneRRyRXR't_ZeroRD(RR|R.tself_nant other_nantself_keyt other_key((s/usr/lib64/python2.7/decimal.pyR8 sf cCs7t|dt�}|j�}|j�}|j|�S(s�Compares self to other using abstract repr., ignoring sign. Like compare_total, but with operand's sign ignored and assumed to be 0. R�(R�R(R�R8(RR|R�to((s/usr/lib64/python2.7/decimal.pytcompare_total_magVscCstd|j|j|j�S(s'Returns a copy with the sign set to 0. i(R%R'RDRE(R((s/usr/lib64/python2.7/decimal.pyR�ascCsE|jr%td|j|j|j�Std|j|j|j�SdS(s&Returns a copy with the sign inverted.iiN(R&R%R'RDRE(R((s/usr/lib64/python2.7/decimal.pyR�es cCs1t|dt�}t|j|j|j|j�S(s$Returns self with the sign of other.R�(R�R(R%R&R'RDRE(RR|((s/usr/lib64/python2.7/decimal.pyt copy_signlscCs�|dkrt�}n|jd|�}|r4|S|j�dkrJtS|sTtS|j�dkrpt|�S|j}|j�}|j dkr�|t t|jdd��kr�t dd|jd�}n�|j dkr(|t t|j�dd��kr(t dd|j�d�}n7|j dkrj||krjt ddd|dd|�}n�|j dkr�||dkr�t dd|d|d�}n�t|�}|j|j}}|jdkr�|}nd}xZtrFt||||�\} } | d d t t| ��|dr9Pn|d7}q�Wt dt| �| �}|j�}|jt�}|j|�}||_|S(sReturns e ** self.Ri����iiiR�RFR2ii N(RARRRzR?RRR4R�R&RXRWR5R%R�R]RHRJR.R(t_dexpR3R4RR�R3(RRR+RtadjR�R5R�R"R�RJR3((s/usr/lib64/python2.7/decimal.pyRJrsJ 26& " & cCstS(s�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. (R((R((s/usr/lib64/python2.7/decimal.pytis_canonical�scCs|jS(s�Return True if self is finite; otherwise return False. A Decimal instance is considered finite if it is neither infinite nor a NaN. (RE(R((s/usr/lib64/python2.7/decimal.pyt is_finite�scCs |jdkS(s8Return True if self is infinite; otherwise return False.RN(RD(R((s/usr/lib64/python2.7/decimal.pyR-�scCs |jdkS(s>Return True if self is a qNaN or sNaN; otherwise return False.R$RM(R$RM(RD(R((s/usr/lib64/python2.7/decimal.pyR��scCs?|js|rtS|dkr,t�}n|j|j�kS(s?Return True if self is a normal number; otherwise return False.N(RERYRARR*R�(RR((s/usr/lib64/python2.7/decimal.pyt is_normal�s cCs |jdkS(s;Return True if self is a quiet NaN; otherwise return False.R$(RD(R((s/usr/lib64/python2.7/decimal.pyR��scCs |jdkS(s8Return True if self is negative; otherwise return False.i(R&(R((s/usr/lib64/python2.7/decimal.pyt is_signed�scCs |jdkS(s?Return True if self is a signaling NaN; otherwise return False.RM(RD(R((s/usr/lib64/python2.7/decimal.pyR��scCs?|js|rtS|dkr,t�}n|j�|jkS(s9Return True if self is subnormal; otherwise return False.N(RERYRARR�R*(RR((s/usr/lib64/python2.7/decimal.pytis_subnormal�s cCs|jo|jdkS(s6Return True if self is a zero; otherwise return False.RF(RER'(R((s/usr/lib64/python2.7/decimal.pytis_zero�scCs�|jt|j�d}|dkrBtt|dd��dS|dkrnttd|dd��dSt|�}|j|j}}|dkr�t|d|�}t|�}t|�t|�||kS|ttd||��dS(s�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 i����i����i(RDRXR'RWR]RHRJ(RRHR�R5R�tnumtden((s/usr/lib64/python2.7/decimal.pyt _ln_exp_bound�s c Csz|d krt�}n|jd|�}|r4|S|s>tS|j�dkrTtS|tkrdtS|jdkr�|j t d�St|�}|j|j }}|j}||j�d}xVtrt|||�}|ddttt|���|dr Pn|d7}q�Wtt|dk�tt|��|�}|j�}|jt�} |j|�}| |_|S( s/Returns the natural (base e) logarithm of self.Risln of a negative valueiii iiN(RARRt_NegativeInfinityRzt _InfinityRR?R&RURR]RHRJR4RQR(t_dlogRXRWR\R%R3R4RR�R3( RRR+R�R5R�RR0R�R3((s/usr/lib64/python2.7/decimal.pytlns: ,+ cCs|jt|j�d}|dkr:tt|��dS|dkr^ttd|��dSt|�}|j|j}}|dkr�t|d|�}td|�}t|�t|�||kdStd||�}t|�||dkdS( s�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. ii����i����ii i�it231(RDRXR'RWR]RHRJ(RRHR�R5R�RORP((s/usr/lib64/python2.7/decimal.pyR@s"c Cs�|dkrt�}n|jd|�}|r4|S|s>tS|j�dkrTtS|jdkrs|jtd�S|j ddkr�|j ddt |j �dkr�t|jt |j �d�}n�t |�}|j|j}}|j}||j�d}xVtrat|||�}|dd t tt|���|drTPn|d 7}qWtt|dk�tt|��|�}|j�}|jt�} |j|�}| |_|S(s&Returns the base 10 logarithm of self.Rislog10 of a negative valueiR�RFiii iN(RARRRRRzRSR&RURR'RXRRDR]RHRJR4RR(t_dlog10RWR\R%R3R4RR�R3( RRR+R�R5R�RR0R�R3((s/usr/lib64/python2.7/decimal.pytlog10^s: 7# ,+ cCs||jd|�}|r|S|dkr4t�}n|j�rDtS|s]|jtdd�St|j��}|j |�S(sM 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). Rslogb(0)iN( RRARRzRSRURRR�R�(RRR+((s/usr/lib64/python2.7/decimal.pytlogb�s cCsJ|jdks|jdkr"tSx!|jD]}|dkr,tSq,WtS(s�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. it01(R&RDRYR'R((Rtdig((s/usr/lib64/python2.7/decimal.pyt _islogical�scCs�|jt|�}|dkr0d||}n|dkrM||j}n|jt|�}|dkr}d||}n|dkr�||j}n||fS(NiRF(R4RX(RRtopatopbtdif((s/usr/lib64/python2.7/decimal.pyt _fill_logical�scCs�|dkrt�}nt|dt�}|j�sD|j�rQ|jt�S|j||j|j�\}}dj gt ||�D](\}}tt|�t|�@�^q��}t d|jd�p�dd�S(s;Applies an 'and' operation between self and other's digits.R�RiRFN(RARR�R(R\RURR`R'RbtzipRWRHR%RZ(RR|RR]R^RtbRx((s/usr/lib64/python2.7/decimal.pytlogical_and�s !GcCs;|dkrt�}n|jtdd|jd�|�S(sInvert all its digits.iR�N(RARtlogical_xorR%R4(RR((s/usr/lib64/python2.7/decimal.pytlogical_invert�scCs�|dkrt�}nt|dt�}|j�sD|j�rQ|jt�S|j||j|j�\}}dj gt ||�D](\}}tt|�t|�B�^q��}t d|jd�p�dd�S(s:Applies an 'or' operation between self and other's digits.R�RiRFN(RARR�R(R\RURR`R'RbRaRWRHR%RZ(RR|RR]R^RRbRx((s/usr/lib64/python2.7/decimal.pyt logical_or�s !GcCs�|dkrt�}nt|dt�}|j�sD|j�rQ|jt�S|j||j|j�\}}dj gt ||�D](\}}tt|�t|�A�^q��}t d|jd�p�dd�S(s;Applies an 'xor' operation between self and other's digits.R�RiRFN(RARR�R(R\RURR`R'RbRaRWRHR%RZ(RR|RR]R^RRbRx((s/usr/lib64/python2.7/decimal.pyRd�s !GcCst|dt�}|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(s8Compares the values numerically with their sign ignored.R�iii����N(R�R(RARRERyR�RR�R�R8(RR|RR9R:R5R+((s/usr/lib64/python2.7/decimal.pytmax_mag s& cCst|dt�}|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(s8Compares the values numerically with their sign ignored.R�iii����N(R�R(RARRERyR�RR�R�R8(RR|RR9R:R5R+((s/usr/lib64/python2.7/decimal.pytmin_mag" s& cCs�|dkrt�}n|jd|�}|r4|S|j�dkrJtS|j�dkrytdd|j|j��S|j�}|j t �|j�|j|�}||kr�|S|j tdd|j�d�|�S(s=Returns the largest representable number smaller than itself.Ri����iiR2R�N(RARRRzRRR%R4R�R;R4Rt_ignore_all_flagsR�R�R�(RRR+tnew_self((s/usr/lib64/python2.7/decimal.pyt next_minus@ s" cCs�|dkrt�}n|jd|�}|r4|S|j�dkrJtS|j�dkrytdd|j|j��S|j�}|j t �|j�|j|�}||kr�|S|j tdd|j�d�|�S(s=Returns the smallest representable number larger than itself.Rii����R2iR�N(RARRRzRSR%R4R�R;R4RRiR�R�R�(RRR+Rj((s/usr/lib64/python2.7/decimal.pyt next_plusW s" cCs@t|dt�}|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(s�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. R�ii����s Infinite result from next_towardN(R�R(RARRR�RFRlRkRzRURR&R R R�R*R RR(RR|RR+t comparison((s/usr/lib64/python2.7/decimal.pytnext_towardn s4 cCs�|j�rdS|j�r dS|j�}|dkr<dS|dkrLdS|j�rl|jredSdSn|dkr�t�}n|jd |�r�|jr�d SdSn|jr�dSd SdS(sReturns 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 R{R�is +Infinityi����s -Infinitys-Zeros+ZeroRs -Subnormals +Subnormals-Normals+NormalN(R�R�RzRNR&RARRM(RRtinf((s/usr/lib64/python2.7/decimal.pytnumber_class� s, cCs td�S(s'Just returns 10, as this is Decimal, :)i (R(R((s/usr/lib64/python2.7/decimal.pytradix� scCsD|dkrt�}nt|dt�}|j||�}|rF|S|jdkrb|jt�S|jt |�ko�|jkns�|jt�S|j �r�t|�St |�}|j}|jt |�}|dkr�d||}n|dkr ||}n|||| }t|j|jd�p:d|j�S(s5Returns a rotated copy of self, value-of-other times.R�iRFN(RARR�R(RRDRURR4RHRzRR'RXR%R&RZ(RR|RR+ttorottrotdigttopadtrotated((s/usr/lib64/python2.7/decimal.pytrotate� s, ) cCs|dkrt�}nt|dt�}|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(s>Returns self operand after adding the second value to its exp.R�ii����iN(RARR�R(RRDRURR5R4RHRzRR%R&R'R�(RR|RR+tliminftlimsupRv((s/usr/lib64/python2.7/decimal.pytscaleb� s" " %cCsg|dkrt�}nt|dt�}|j||�}|rF|S|jdkrb|jt�S|jt |�ko�|jkns�|jt�S|j �r�t|�St |�}|j}|jt |�}|dkr�d||}n|dkr ||}n|dkr&|| }n|d|}||j}t|j|jd�p]d|j�S(s5Returns a shifted copy of self, value-of-other times.R�iRFN(RARR�R(RRDRURR4RHRzRR'RXR%R&RZ(RR|RR+RrRsRttshifted((s/usr/lib64/python2.7/decimal.pyR�s2 ) cCs|jt|�ffS(N(t __class__RW(R((s/usr/lib64/python2.7/decimal.pyt __reduce__+scCs)t|�tkr|S|jt|��S(N(ttypeRR{RW(R((s/usr/lib64/python2.7/decimal.pyt__copy__.scCs)t|�tkr|S|jt|��S(N(R}RR{RW(Rtmemo((s/usr/lib64/python2.7/decimal.pyt__deepcopy__3scCs|dkrt�}nt|d|�}|jr�t|j|�}t|j��}|ddkrt|d7}nt|||�S|ddkr�ddg|j |d<n|ddkr�t |j|j|jd�}n|j }|d}|dk r�|ddkr(|j|d |�}q�|dd krN|j||�}q�|ddkr�t|j�|kr�|j||�}q�n|r�|jdkr�|dd kr�|jd|�}n|jt|j�} |ddkr|r|dk rd |} qkd } nV|dd kr.| } n=|ddkrk|jdkrb| d krb| } qkd } n| dkr�d}d| |j}n\| t|j�kr�|jd| t|j�}d}n |j| p�d}|j| }| | } t|j||| |�S(s|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. t_localeconvR}t%tgtGit precisionteEisfF%tgGii����RFRN(RARt_parse_format_specifierREt_format_signR&RWR�t _format_alignR�R%R'RDR3R1R�RXt_format_number(Rt specifierRR�tspecR.tbodyR3R�R�R�RjRkRJ((s/usr/lib64/python2.7/decimal.pyt __format__:sZ " %& (RDR'R&REN(�R!R"R#t __slots__RARPRetclassmethodRyRzRR�R�R�R�R�R�R�R�R�R�R�R�R�RYR�R�R�R�R(R�R�t__radd__R�R�R�t__rmul__R�R�R�t__div__t__rdiv__R�R�R�R�R�R�R�R�R�t __trunc__R�tpropertyR�R�R�R�R)R�R�R�R�R�R�R�R�R�tdictR�R�RRR%R&R)R,R.R�R1R2R�tto_integralR7R�R�R�R�R�R<R=R8RER�R�RFRJRIRJR-R�RKR�RLR�RMRNRQRURRXRYR\R`RcReRfRdRgRhRkRlRnRpRqRvRyR�R|R~R�R�(((s/usr/lib64/python2.7/decimal.pyR�s� $ ! @ 4 4 V7; !$K f ,T ��G " c*" I K 2 3 .* !' cCs7tjt�}||_||_||_||_|S(s�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*. (RORPRR&R'RDRE(R.tcoefficientRtspecialR((s/usr/lib64/python2.7/decimal.pyR%�s RBcBs)eZdZd�Zd�Zd�ZRS(s�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(R;tnew_context(RR�((s/usr/lib64/python2.7/decimal.pyt__init__�scCs t�|_t|j�|jS(N(Rt saved_contextRR�(R((s/usr/lib64/python2.7/decimal.pyt __enter__�s cCst|j�dS(N(RR�(Rtttvttb((s/usr/lib64/python2.7/decimal.pyt__exit__�s(R!R"R#R�R�R�(((s/usr/lib64/python2.7/decimal.pyRB�s c Bs�eZdZdNdNdNdNdNdNdNddNd� Zd�Zd�Zd�Zd�ZeZ dNd�Z d�Zd �Zd �Z dNZd�Zd�Zd �Zdd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d�Z"d �Z#d!�Z$d"�Z%d#�Z&d$�Z'd%�Z(d&�Z)d'�Z*d(�Z+d)�Z,d*�Z-d+�Z.d,�Z/d-�Z0d.�Z1d/�Z2d0�Z3d1�Z4d2�Z5d3�Z6d4�Z7d5�Z8d6�Z9d7�Z:d8�Z;d9�Z<d:�Z=d;�Z>d<�Z?d=�Z@d>�ZAdNd?�ZBd@�ZCdA�ZDdB�ZEdC�ZFdD�ZGdE�ZHdF�ZIdG�ZJdH�ZKdI�ZLdJ�ZMdK�ZNdL�ZOdM�ZPePZQRS(Os�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) ic s�y t} Wntk rnX|dk r0|n| j|_|dk rN|n| j|_|dk rl|n| j|_|dk r�|n| j|_|dk r�|n| j|_|dk r�|n| j|_| dkr�g|_ n | |_ �dkr| j j�|_ n:t�t �sEt �fd�tD��|_ n �|_ �dkrrt jtd�|_n:t�t �s�t �fd�tD��|_n �|_dS(Nc3s'|]}|t|�k�fVqdS(N(RH(t.0R�(R(s/usr/lib64/python2.7/decimal.pys <genexpr>�sic3s'|]}|t|�k�fVqdS(N(RH(R�R�(R(s/usr/lib64/python2.7/decimal.pys <genexpr>�s(Rt NameErrorRAR4R3R*R5R�R�t_ignored_flagsRR;RQR�RtfromkeysR(RR4R3RRR*R5R�R�R�tdc((RRs/usr/lib64/python2.7/decimal.pyR��s. " "cCs�g}|jdt|��g|jj�D]\}}|r-|j^q-}|jddj|�d�g|jj�D]\}}|r||j^q|}|jddj|�d�dj|�dS(sShow the current context.saContext(prec=%(prec)d, rounding=%(rounding)s, Emin=%(Emin)d, Emax=%(Emax)d, capitals=%(capitals)dsflags=[s, t]straps=[t)(RatvarsRtitemsR!RbR(RR�RuR�tnamesR�((s/usr/lib64/python2.7/decimal.pyR��s 11cCs%x|jD]}d|j|<q WdS(sReset all flags to zeroiN(R(Rtflag((s/usr/lib64/python2.7/decimal.pyR<�sc CsCt|j|j|j|j|j|j|j|j|j � }|S(s!Returns a shallow copy from self.( RR4R3RRR*R5R�R�R�(Rtnc((s/usr/lib64/python2.7/decimal.pyR3�sc CsOt|j|j|jj�|jj�|j|j|j|j |j � }|S(sReturns a deep copy from self.(RR4R3RR;RR*R5R�R�R�(RR�((s/usr/lib64/python2.7/decimal.pyR;scGsqtj||�}||jkr4|�j||�Sd|j|<|j|sa|�j||�S||��dS(s#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(t_condition_maptgetR�R RR(Rt conditiontexplanationRterror((s/usr/lib64/python2.7/decimal.pyRUs cCs |jt�S(s$Ignore all flags, if they are raised(t _ignore_flagsR(R((s/usr/lib64/python2.7/decimal.pyRi"scGs |jt|�|_t|�S(s$Ignore the flags, if they are raised(R�R^(RR((s/usr/lib64/python2.7/decimal.pyR�&scGsQ|r,t|dttf�r,|d}nx|D]}|jj|�q3WdS(s+Stop ignoring the flags, if they are raisediN(RQR_R^R�tremove(RRR�((s/usr/lib64/python2.7/decimal.pyt _regard_flags-s cCst|j|jd�S(s!Returns Etiny (= Emin - prec + 1)i(RHR*R4(R((s/usr/lib64/python2.7/decimal.pyR�7scCst|j|jd�S(s,Returns maximum exponent (= Emax - prec + 1)i(RHR5R4(R((s/usr/lib64/python2.7/decimal.pyR�;scCs|j}||_|S(s�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. (R3(RR}R3((s/usr/lib64/python2.7/decimal.pyR4?s RFcCs�t|t�r1||j�kr1|jtd�St|d|�}|j�r~t|j�|j |j kr~|jtd�S|j|�S(s�Creates a new Decimal instance but using self as context. This method implements the to-number operation of the IBM Decimal specification.s/no trailing or leading whitespace is permitted.Rsdiagnostic info too long in NaN(RQRRRTRUR,RRyRXR'R4R�R�(RRORv((s/usr/lib64/python2.7/decimal.pytcreate_decimalRs! + cCstj|�}|j|�S(s�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): ... Inexact: None (RReR�(RRuRv((s/usr/lib64/python2.7/decimal.pytcreate_decimal_from_floatcscCs"t|dt�}|jd|�S(s[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') R�R(R�R(R�(RR((s/usr/lib64/python2.7/decimal.pyR\uscCsNt|dt�}|j|d|�}|tkrFtd|��n|SdS(s�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') R�RsUnable to convert %s to DecimalN(R�R(R�R�Rf(RRRbR�((s/usr/lib64/python2.7/decimal.pytadd�s cCst|j|��S(N(RWR�(RR((s/usr/lib64/python2.7/decimal.pyt_apply�scCs|jd|�S(s�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') R(R<(RR((s/usr/lib64/python2.7/decimal.pyR<�s cCs%t|dt�}|j|d|�S(s�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') R�R(R�R(R�(RRRb((s/usr/lib64/python2.7/decimal.pyR��s!cCs%t|dt�}|j|d|�S(sCompares 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') R�R(R�R(R=(RRRb((s/usr/lib64/python2.7/decimal.pyR=�s cCst|dt�}|j|�S(s+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') R�(R�R(R8(RRRb((s/usr/lib64/python2.7/decimal.pyR8�scCst|dt�}|j|�S(s�Compares two operands using their abstract representation ignoring sign. Like compare_total, but with operand's sign ignored and assumed to be 0. R�(R�R(RE(RRRb((s/usr/lib64/python2.7/decimal.pyREscCst|dt�}|j�S(sReturns 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') R�(R�R(R�(RR((s/usr/lib64/python2.7/decimal.pyR�s cCst|dt�}t|�S(sReturns 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') R�(R�R(R(RR((s/usr/lib64/python2.7/decimal.pytcopy_decimal&s cCst|dt�}|j�S(s(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') R�(R�R(R�(RR((s/usr/lib64/python2.7/decimal.pyR�3s cCst|dt�}|j|�S(sCopies 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') R�(R�R(RF(RRRb((s/usr/lib64/python2.7/decimal.pyRF@scCsNt|dt�}|j|d|�}|tkrFtd|��n|SdS(s�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') R�RsUnable to convert %s to DecimalN(R�R(R�R�Rf(RRRbR�((s/usr/lib64/python2.7/decimal.pytdivideXs cCsNt|dt�}|j|d|�}|tkrFtd|��n|SdS(s/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') R�RsUnable to convert %s to DecimalN(R�R(R�R�Rf(RRRbR�((s/usr/lib64/python2.7/decimal.pyt divide_int}s cCsNt|dt�}|j|d|�}|tkrFtd|��n|SdS(s�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')) R�RsUnable to convert %s to DecimalN(R�R(R�R�Rf(RRRbR�((s/usr/lib64/python2.7/decimal.pyR��s cCs"t|dt�}|jd|�S(s#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') R�R(R�R(RJ(RR((s/usr/lib64/python2.7/decimal.pyRJ�scCs(t|dt�}|j||d|�S(sReturns 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') R�R(R�R(R�(RRRbR5((s/usr/lib64/python2.7/decimal.pyR��scCs |j�S(sReturn 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 (RI(RR((s/usr/lib64/python2.7/decimal.pyRI�s cCst|dt�}|j�S(s,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 R�(R�R(RJ(RR((s/usr/lib64/python2.7/decimal.pyRJ�scCst|dt�}|j�S(sUReturn 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 R�(R�R(R-(RR((s/usr/lib64/python2.7/decimal.pyR-�scCst|dt�}|j�S(sOReturn 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 R�(R�R(R�(RR((s/usr/lib64/python2.7/decimal.pyR�s cCs"t|dt�}|jd|�S(s�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 R�R(R�R(RK(RR((s/usr/lib64/python2.7/decimal.pyRKscCst|dt�}|j�S(sHReturn 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 R�(R�R(R�(RR((s/usr/lib64/python2.7/decimal.pyR�/scCst|dt�}|j�S(s�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 R�(R�R(RL(RR((s/usr/lib64/python2.7/decimal.pyRL>scCst|dt�}|j�S(sTReturn 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 R�(R�R(R�(RR((s/usr/lib64/python2.7/decimal.pyR�Os cCs"t|dt�}|jd|�S(s�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 R�R(R�R(RM(RR((s/usr/lib64/python2.7/decimal.pyRM_scCst|dt�}|j�S(suReturn 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 R�(R�R(RN(RR((s/usr/lib64/python2.7/decimal.pyRNuscCs"t|dt�}|jd|�S(s�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') R�R(R�R(RU(RR((s/usr/lib64/python2.7/decimal.pyRU�scCs"t|dt�}|jd|�S(s�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') R�R(R�R(RX(RR((s/usr/lib64/python2.7/decimal.pyRX�scCs"t|dt�}|jd|�S(s4 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') R�R(R�R(RY(RR((s/usr/lib64/python2.7/decimal.pyRY�scCs%t|dt�}|j|d|�S(s�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') R�R(R�R(Rc(RRRb((s/usr/lib64/python2.7/decimal.pyRc�scCs"t|dt�}|jd|�S(sInvert 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') R�R(R�R(Re(RR((s/usr/lib64/python2.7/decimal.pyRe�scCs%t|dt�}|j|d|�S(s�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') R�R(R�R(Rf(RRRb((s/usr/lib64/python2.7/decimal.pyRfscCs%t|dt�}|j|d|�S(s�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') R�R(R�R(Rd(RRRb((s/usr/lib64/python2.7/decimal.pyRdscCs%t|dt�}|j|d|�S(s�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') R�R(R�R(R�(RRRb((s/usr/lib64/python2.7/decimal.pyR�6scCs%t|dt�}|j|d|�S(s�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') R�R(R�R(Rg(RRRb((s/usr/lib64/python2.7/decimal.pyRgQscCs%t|dt�}|j|d|�S(s�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') R�R(R�R(R�(RRRb((s/usr/lib64/python2.7/decimal.pyR�bscCs%t|dt�}|j|d|�S(s�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') R�R(R�R(Rh(RRRb((s/usr/lib64/python2.7/decimal.pyRh}scCs"t|dt�}|jd|�S(s�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') R�R(R�R(R�(RR((s/usr/lib64/python2.7/decimal.pytminus�scCsNt|dt�}|j|d|�}|tkrFtd|��n|SdS(s�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') R�RsUnable to convert %s to DecimalN(R�R(R�R�Rf(RRRbR�((s/usr/lib64/python2.7/decimal.pytmultiply�s cCs"t|dt�}|jd|�S(s"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') R�R(R�R(Rk(RR((s/usr/lib64/python2.7/decimal.pyRk�scCs"t|dt�}|jd|�S(sReturns 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') R�R(R�R(Rl(RR((s/usr/lib64/python2.7/decimal.pyRl�scCs%t|dt�}|j|d|�S(s�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') R�R(R�R(Rn(RRRb((s/usr/lib64/python2.7/decimal.pyRn�s cCs"t|dt�}|jd|�S(s�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') R�R(R�R(R)(RR((s/usr/lib64/python2.7/decimal.pyR) scCs"t|dt�}|jd|�S(s�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 = Context(ExtendedContext) >>> 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' R�R(R�R(Rp(RR((s/usr/lib64/python2.7/decimal.pyRp"s/cCs"t|dt�}|jd|�S(s�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') R�R(R�R(R�(RR((s/usr/lib64/python2.7/decimal.pytplusTscCsQt|dt�}|j||d|�}|tkrItd|��n|SdS(sRaises 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') R�RsUnable to convert %s to DecimalN(R�R(R%R�Rf(RRRbR�R�((s/usr/lib64/python2.7/decimal.pytpoweres IcCs%t|dt�}|j|d|�S(s 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') R�R(R�R(R,(RRRb((s/usr/lib64/python2.7/decimal.pyR,�s7cCs td�S(skJust returns 10, as this is Decimal, :) >>> ExtendedContext.radix() Decimal('10') i (R(R((s/usr/lib64/python2.7/decimal.pyRq�scCsNt|dt�}|j|d|�}|tkrFtd|��n|SdS(sReturns 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') R�RsUnable to convert %s to DecimalN(R�R(R�R�Rf(RRRbR�((s/usr/lib64/python2.7/decimal.pyR��s cCs%t|dt�}|j|d|�S(sGReturns 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') R�R(R�R(R�(RRRb((s/usr/lib64/python2.7/decimal.pyR�scCs%t|dt�}|j|d|�S(sNReturns 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') R�R(R�R(Rv(RRRb((s/usr/lib64/python2.7/decimal.pyRv?scCst|dt�}|j|�S(s�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 R�(R�R(R.(RRRb((s/usr/lib64/python2.7/decimal.pyR.\scCs%t|dt�}|j|d|�S(s3Returns 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') R�R(R�R(Ry(RRRb((s/usr/lib64/python2.7/decimal.pyRytscCs%t|dt�}|j|d|�S(s{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') R�R(R�R(R�(RRRb((s/usr/lib64/python2.7/decimal.pyR��scCs"t|dt�}|jd|�S(s�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 R�R(R�R(R7(RR((s/usr/lib64/python2.7/decimal.pyR7�scCsNt|dt�}|j|d|�}|tkrFtd|��n|SdS(s&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') R�RsUnable to convert %s to DecimalN(R�R(R�R�Rf(RRRbR�((s/usr/lib64/python2.7/decimal.pytsubtract�s cCs"t|dt�}|jd|�S(s�Convert to a string, using engineering notation if an exponent is needed. Engineering notation has an exponent which is a multiple of 3. This can leave up to 3 digits to the left of the decimal place and may require the addition of either one or two trailing zeros. The operation is not affected by the context. >>> ExtendedContext.to_eng_string(Decimal('123E+1')) '1.23E+3' >>> ExtendedContext.to_eng_string(Decimal('123E+3')) '123E+3' >>> ExtendedContext.to_eng_string(Decimal('123E-10')) '12.3E-9' >>> ExtendedContext.to_eng_string(Decimal('-123E-12')) '-123E-12' >>> ExtendedContext.to_eng_string(Decimal('7E-7')) '700E-9' >>> ExtendedContext.to_eng_string(Decimal('7E+1')) '70' >>> ExtendedContext.to_eng_string(Decimal('0E+1')) '0.00E+3' R�R(R�R(R�(RR((s/usr/lib64/python2.7/decimal.pyR��scCs"t|dt�}|jd|�S(syConverts a number to a string, using scientific notation. The operation is not affected by the context. R�R(R�R(R�(RR((s/usr/lib64/python2.7/decimal.pyt to_sci_string�scCs"t|dt�}|jd|�S(skRounds 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') R�R(R�R(R2(RR((s/usr/lib64/python2.7/decimal.pyR2scCs"t|dt�}|jd|�S(sLRounds 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') R�R(R�R(R�(RR((s/usr/lib64/python2.7/decimal.pyR�sN(RR!R"R#RAR�R�R<R3R;R~RURiR�R�R�R�R�R4R�R�R\R�R�R<R�R=R8RER�R�R�RFR�R�R�RJR�RIRJR-R�RKR�RLR�RMRNRURXRYRcReRfRdR�RgR�RhR�R�RkRlRnR)RpR�R�R,RqR�R�RvR.RyR�R7R�R�R�R2R�R�(((s/usr/lib64/python2.7/decimal.pyR�s�" $ # % # 2 P : & " R]cBs)eZdZdd�Zd�ZeZRS(R.RHRJcCs�|dkr*d|_d|_d|_nct|t�rf|j|_t|j�|_|j|_n'|d|_|d|_|d|_dS(Niii( RAR.RHRJRQRR&R'RD(RRh((s/usr/lib64/python2.7/decimal.pyR�Ds cCsd|j|j|jfS(Ns(%r, %r, %r)(R.RHRJ(R((s/usr/lib64/python2.7/decimal.pyR�Ss(R.RHRJN(R!R"R�RAR�R�R�(((s/usr/lib64/python2.7/decimal.pyR]>s icCs�|j|jkr!|}|}n|}|}tt|j��}tt|j��}|jtd||d�}||jd|kr�d|_||_n|jd|j|j9_|j|_||fS(scNormalizes op1, op2 to have the same exp and length of coefficient. Done during addition. i����iii (RJRXRWRHR�(R�R�R4ttmpR|ttmp_lent other_lenRJ((s/usr/lib64/python2.7/decimal.pyR�Zs iRFiR�it2t3it4t5t6t7t8R2RRbR5RvR�RucCs?|dkrtd��nd|}dt|�||dS(s[Number of bits in binary representation of the positive integer n, or 0 if n == 0. is-The argument to _nbits should be nonnegative.s%xi(R`RX(R$t correctionthex_n((s/usr/lib64/python2.7/decimal.pyR}s cCs{|dkrdS|dkr(|d|Stt|��}t|�t|jd��}||krjdS|d|SdS(s 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 RFN(RWR\RXR�RA(R$R�tstr_ntval_n((s/usr/lib64/python2.7/decimal.pyR�scCs^|dks|dkr'td��nd}x*||krY||||d?}}q0W|S(s�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. is3Both arguments to _sqrt_nearest should be positive.i(R`(R$RRb((s/usr/lib64/python2.7/decimal.pyt _sqrt_nearest�scCs7d|>||?}}|d||d@|d@|kS(s�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. lii((R R�RbR�((s/usr/lib64/python2.7/decimal.pyt_rshift_nearest�scCs/t||�\}}|d||d@|kS(saClosest integer to a/b, a and b positive integers; rounds to even in the case of a tie. ii(R�(RRbR�R�((s/usr/lib64/python2.7/decimal.pyt_div_nearest�sic CsC||}d}x�||kr?tt|��||>|kse||kr�t|�||?|kr�tt||�d>|t||t||�|��}|d7}qWtdtt|��d|�}t||�}t||�}x>t|ddd�D]&}t||�t|||�}qWt|||�S(s�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����( R[R\R�R�R�RHRXRWR�( R tMtLRtRtTtyshifttwRw((s/usr/lib64/python2.7/decimal.pyt_ilog�s /&'%$c Cs�|d7}tt|��}||||dk}|dkr�d|}|||}|dkru|d|9}nt|d|�}t||�}t|�}t|||�}||} nd}t|d|�} t| |d�S(s�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(RXRWR�R�t _log10_digits( R5R�RR6RuR�Rwtlog_dtlog_10tlog_tenpower((s/usr/lib64/python2.7/decimal.pyRW�s c 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(s�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(RXRWR�R�R\R�( R5R�RR6RuRwR�R"t f_log_ten((s/usr/lib64/python2.7/decimal.pyRTs" $ t _Log10MemoizecBs eZdZd�Zd�ZRS(s�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(Nt/23025850929940456840179914546843642076011014886(Rl(R((s/usr/lib64/python2.7/decimal.pyR�@scCs�|dkrtd��n|t|j�kr�d}xatr�d||d}tttd||�d��}||d|kr�Pn|d7}q9W|jd�d |_nt|j|d �S( stGiven an integer p >= 0, return floor(10**p)*log(10). For example, self.getdigits(3) returns 2302. isp should be nonnegativeii iidRFi����i( R`RXRlR(RWR�R�R�RH(RRR"R�Rl((s/usr/lib64/python2.7/decimal.pyt getdigitsCs "(R!R"R#R�R�(((s/usr/lib64/python2.7/decimal.pyR�<s c Cs�tt|�|>|�}tdtt|��d|�}t||�}t|�|>}x9t|ddd�D]!}t|||||�}quWxIt|ddd�D]1}t|�|d>}t||||�}q�W||S(s�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����iiii����i(RR[RHRXRWR�R�( R R�R�R�R�RtMshiftRRw((s/usr/lib64/python2.7/decimal.pyt_iexpas%c Cs�|d7}td|tt|��d�}||}||}|dkr^|d|}n|d|}t|t|��\}}t|d|�}tt|d|�d�||dfS(s�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(R�RXRWR�R�R�R�( R5R�RR"R�R�tcshifttquotR((s/usr/lib64/python2.7/decimal.pyRG�s # cCs*ttt|���|}t||||d�}||}|dkra||d|}nt||d|�}|dkr�tt|��|dk|dkkr�d|ddd|} } q d|d|} } n:t||d|d�\} } t| d�} | d7} | | fS(s5Given 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 (RXRWR\RTR�RG(R RR RRRbtlxcR�tpcR�RJ((s/usr/lib64/python2.7/decimal.pyR�s ( ! idiFi5i(iiii icCsA|dkrtd��nt|�}dt|�||dS(s@Compute a lower bound for 100*log10(c) for a positive integer c.is0The argument to _log10_lb should be nonnegative.id(R`RWRX(R5R�tstr_c((s/usr/lib64/python2.7/decimal.pyR�scCsqt|t�r|St|ttf�r2t|�S|rTt|t�rTtj|�S|rmtd|��ntS(s�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). sUnable to convert %s to Decimal(RQRRHR[RdReRfR�(R|R�R�((s/usr/lib64/python2.7/decimal.pyR��s R4iR3RRR5i�ɚ;R*i6e�R�i s� # 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 s0*$s50*$s�\A (?: (?P<fill>.)? (?P<align>[<>=^]) )? (?P<sign>[-+ ])? (?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<yt|t �|d<Wnt k r[t|d<nX|S(sParse 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 unicode: boolean (always True for Python 3.x) sInvalid format specifier: tfilltaligntzeropads7Fill character conflicts with '0' in format specifier: s2Alignment conflicts with '0' in format specifier: t t>R.RGtminimumwidthRFR�iR}R�iR$R�t thousands_sepsJExplicit thousands separator conflicts with 'n' type in format specifier: tgroupingt decimal_pointRiR�tunicodeN(t_parse_format_specifier_regextmatchRAR`t groupdictRHt_localet localeconvRQR�R�RY(tformat_specR�Ritformat_dictR�R�((s/usr/lib64/python2.7/decimal.pyR�XsV c Cs�|d}|d}||t|�t|�}|d}|dkrY|||}n|dkrv|||}nb|dkr�|||}nE|dkr�t|�d}|| ||||}ntd ��|d r�t|�}n|S(sGiven 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). Also converts result to unicode if necessary. R�R�R�t<R�t=t^isUnrecognised alignment fieldR�(RXR`R�( R.R�R�R�R�tpaddingR�Rxthalf((s/usr/lib64/python2.7/decimal.pyR��s" cCs�ddlm}m}|s gS|ddkr]t|�dkr]||d ||d��S|dtjkrx|d Std��dS(syConvert a localeconv-style grouping into a (possibly infinite) iterable of integers representing group lengths. i����(tchaintrepeatiii����s unrecognised format for groupingN(t itertoolsRRRXR�tCHAR_MAXR`(R�RR((s/usr/lib64/python2.7/decimal.pyt_group_lengths�s "cCs|d}|d}g}x�t|�D]�}|dkrHtd��nttt|�|d�|�}|jd|t|�||�|| }||8}|r�|dkr�Pn|t|�8}q'Wtt|�|d�}|jd|t|�||�|jt|��S(snInsert 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. R�R�isgroup length should be positiveiRF(RR`R�R�RXRaRbtreversed(RlR�t min_widthtsepR�tgroupsR6((s/usr/lib64/python2.7/decimal.pyt_insert_thousands_sep�s !$ $cCs*|r dS|ddkr"|dSdSdS(sDetermine sign character.RGR.s +RN((tis_negativeR�((s/usr/lib64/python2.7/decimal.pyR�s cCs�t||�}|r&|d|}n|dksB|ddkr�idd6dd6dd6dd6|d}|d j||�7}n|dd kr�|d 7}n|dr�|dt|�t|�}nd}t|||�}t||||�S( scFormat 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 R�iR}R�R�R�R�R�s{0}{1:+}R�R�R�(R�tformatRXRR�(RRjRkRJR�R.techarR((s/usr/lib64/python2.7/decimal.pyR�s* !tInfs-InfR�t__main__(kR#t__all__t__version__tmathRntnumberst_numberstcollectionsRt_namedtupleRtImportErrorRRRRRRRRtArithmeticErrorRRRR,tZeroDivisionErrorRR/R0R R1R RRR RR�R=R8ROR6R9R?thasattrR>R:RRRARRRYR%tNumbertregisterRBRR]R�RRR�R�R�R�RWRTR�R�R�R�RGRRR�RRRtretcompiletVERBOSEt IGNORECASEtUNICODER�RSR�R�R�tlocaleR�R�R�RRR�R�RSRRR*R?RR>R-R!tdoctestttestmodR7(((s/usr/lib64/python2.7/decimal.pyt<module>ts0 & *��������������������#% 0 " ,#% $ *#% W ! % )
/home/../lib64/sasl2/../nss/../xtables/../krb5/../python2.7/decimal.pyo