Hacked By AnonymousFox
U
i�f:} � % @ s� d Z ddddddddd d
ddd
ddddddddddddddddddd d!d"d#d$d%g%ZeZd&Zd'Zd(Zd)d*lZd)d*lZ d)d*l
Z
zd)d+lmZ
e
dd,�ZW n ek
r� d-d.� ZY nX dZdZdZdZdZdZdZdZd/Zd/Ze
jd0kr�d1Zd1Zd2Znd3Zd3Zd4Zeed5 ZG d6d� de�Z G d7d� de �Z!G d8d � d e �Z"G d9d� de"�Z#G d:d
� d
e e$�Z%G d;d� de"�Z&G d<d� de"e$�Z'G d=d� de �Z(G d>d� de"�Z)G d?d� de �Z*G d@d
� d
e �Z+G dAd� de(e*�Z,G dBd� de(e*e+�Z-G dCd� de e.�Z/e!e%e(e,e*e-e"e+e/g Z0e#e"e&e"e'e"e)e"iZ1eeeeeeeefZ2d)d*l3Z3e3�4dD�Z5dEd� Z6dFd� Z7[3d�dGd�Z8G dHd� de9�Z:d�dJdK�Z;e j<�=e:� G dLdM� dMe9�Z>G dNd� de9�Z?G dOdP� dPe9�Z@d�dQdR�ZAeBjCZDdSdT� ZEdUdV� ZFdWdX� ZGdYdZ� ZHd�d\d]�ZId^d_� ZJd`da� ZKG dbdc� dce9�ZLeL� jMZNd�ddde�ZOdfdg� ZPdhdi� ZQdjdkdldmdndodpdqdrds� fdtdu�ZRd�dvdw�ZSd�dxdy�ZTe?dzee%e,e"gg d{d|d5d)d}�ZUe?d~ee%e,e"e!e-gg d�ZVe?d~eg g d�ZWd)d*lXZXeX�Yd�eXjZeXj[B �j\Z]eX�Yd��j\Z^eX�Yd��j\Z_eX�Yd�eXjZeXj`B �Za[Xzd)d*lbZcW n ek
�r Y nX d�d�d��Zdd�d�� Zed�d�� Zfd�d�d��Zgd�d�� Zhd�d�� Zie:d��Zje:d��Zke:d��Zle:d)�Zme:d5�Zne:d��ZoejekfZpe
jqjrZse
jqjtZue
jqjvZwexdqesd� es�Zy[
d*S )�a�
This is an implementation of decimal floating point arithmetic based on
the General Decimal Arithmetic Specification:
http://speleotrove.com/decimal/decarith.html
and IEEE standard 854-1987:
http://en.wikipedia.org/wiki/IEEE_854-1987
Decimal floating point has finite precision with arbitrarily large bounds.
The purpose of this module is to support arithmetic using familiar
"schoolhouse" rules and to avoid some of the tricky representation
issues associated with binary floating point. The package is especially
useful for financial applications or for contexts where users have
expectations that are at odds with binary floating point (for instance,
in binary floating point, 1.00 % 0.1 gives 0.09999999999999995 instead
of 0.0; Decimal('1.00') % Decimal('0.1') returns the expected
Decimal('0.00')).
Here are some examples of using the decimal module:
>>> from decimal import *
>>> setcontext(ExtendedContext)
>>> Decimal(0)
Decimal('0')
>>> Decimal('1')
Decimal('1')
>>> Decimal('-.0123')
Decimal('-0.0123')
>>> Decimal(123456)
Decimal('123456')
>>> Decimal('123.45e12345678')
Decimal('1.2345E+12345680')
>>> Decimal('1.33') + Decimal('1.27')
Decimal('2.60')
>>> Decimal('12.34') + Decimal('3.87') - Decimal('18.41')
Decimal('-2.20')
>>> dig = Decimal(1)
>>> print(dig / Decimal(3))
0.333333333
>>> getcontext().prec = 18
>>> print(dig / Decimal(3))
0.333333333333333333
>>> print(dig.sqrt())
1
>>> print(Decimal(3).sqrt())
1.73205080756887729
>>> print(Decimal(3) ** 123)
4.85192780976896427E+58
>>> inf = Decimal(1) / Decimal(0)
>>> print(inf)
Infinity
>>> neginf = Decimal(-1) / Decimal(0)
>>> print(neginf)
-Infinity
>>> print(neginf + inf)
NaN
>>> print(neginf * inf)
-Infinity
>>> print(dig / 0)
Infinity
>>> getcontext().traps[DivisionByZero] = 1
>>> print(dig / 0)
Traceback (most recent call last):
...
...
...
decimal.DivisionByZero: x / 0
>>> c = Context()
>>> c.traps[InvalidOperation] = 0
>>> print(c.flags[InvalidOperation])
0
>>> c.divide(Decimal(0), Decimal(0))
Decimal('NaN')
>>> c.traps[InvalidOperation] = 1
>>> print(c.flags[InvalidOperation])
1
>>> c.flags[InvalidOperation] = 0
>>> print(c.flags[InvalidOperation])
0
>>> print(c.divide(Decimal(0), Decimal(0)))
Traceback (most recent call last):
...
...
...
decimal.InvalidOperation: 0 / 0
>>> print(c.flags[InvalidOperation])
1
>>> c.flags[InvalidOperation] = 0
>>> c.traps[InvalidOperation] = 0
>>> print(c.divide(Decimal(0), Decimal(0)))
NaN
>>> print(c.flags[InvalidOperation])
1
>>>
�Decimal�Context�DecimalTuple�DefaultContext�BasicContext�ExtendedContext�DecimalException�Clamped�InvalidOperation�DivisionByZero�Inexact�Rounded� Subnormal�Overflow� Underflow�FloatOperation�DivisionImpossible�InvalidContext�ConversionSyntax�DivisionUndefined�
ROUND_DOWN�
ROUND_HALF_UP�ROUND_HALF_EVEN�
ROUND_CEILING�ROUND_FLOOR�ROUND_UP�ROUND_HALF_DOWN�
ROUND_05UP�
setcontext�
getcontext�localcontext�MAX_PREC�MAX_EMAX�MIN_EMIN� MIN_ETINY�HAVE_THREADS�HAVE_CONTEXTVARZdecimalz1.70z2.4.2� N)�
namedtuplezsign digits exponentc G s | S �N� )�argsr) r) �//opt/alt/python38/lib64/python3.8/_pydecimal.py�<lambda>� � r, Tl ���� l ��N�Zol������N�Zoi@�Ti���� c @ s e Zd ZdZdd� ZdS )r a1 Base 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.
c G s d S r( r) ��self�contextr* r) r) r+ �handle� s zDecimalException.handleN��__name__�
__module__�__qualname__�__doc__r2 r) r) r) r+ r � s c @ s e Zd ZdZdS )r a) Exponent of a 0 changed to fit bounds.
This occurs and signals clamped if the exponent of a result has been
altered in order to fit the constraints of a specific concrete
representation. This may occur when the exponent of a zero result would
be outside the bounds of a representation, or when a large normal
number would have an encoded exponent that cannot be represented. In
this latter case, the exponent is reduced to fit and the corresponding
number of zero digits are appended to the coefficient ("fold-down").
N�r4 r5 r6 r7 r) r) r) r+ r � s c @ s e Zd ZdZdd� ZdS )r a0 An 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.
c G s, |r(t |d j|d jdd�}|�|�S tS )Nr&