File: //usr/lib64/python3.8/__pycache__/_pydecimal.cpython-38.opt-1.pyc
U
e5d:} % @ 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
jd0krd1Zd1Zd2Znd3Zd3Zd4Zeed5 ZG d6d deZ 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*l3Z3e34dDZ5dEd Z6dFd Z7[3ddGdZ8G dHd de9Z:ddJdKZ;e j<=e: G dLdM dMe9Z>G dNd de9Z?G dOdP dPe9Z@ddQdRZAeBjCZDdSdT ZEdUdV ZFdWdX ZGdYdZ ZHdd\d]ZId^d_ ZJd`da ZKG dbdc dce9ZLeL jMZNddddeZOdfdg ZPdhdi ZQdjdkdldmdndodpdqdrds fdtduZRddvdwZSddxdyZTe?dzee%e,e"gg d{d|d5d)d}ZUe?d~ee%e,e"e!e-gg dZVe?d~eg g dZWd)d*lXZXeXYdeXjZeXj[B j\Z]eXYdj\Z^eXYdj\Z_eXYdeXjZeXj`B Za[Xzd)d*lbZcW n ek
r Y nX dddZddd Zedd ZfdddZgdd Zhdd Zie:dZje:dZke:dZle:d)Zme:d5Zne:dZoejekfZpe
jqjrZse
jqjtZue
jqjvZwexdqesd esZy[
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
>>>
DecimalContextDecimalTupleDefaultContextBasicContextExtendedContextDecimalExceptionClampedInvalidOperationDivisionByZeroInexactRounded SubnormalOverflow UnderflowFloatOperationDivisionImpossibleInvalidContextConversionSyntaxDivisionUndefined
ROUND_DOWN
ROUND_HALF_UPROUND_HALF_EVEN
ROUND_CEILINGROUND_FLOORROUND_UPROUND_HALF_DOWN
ROUND_05UP
setcontext
getcontextlocalcontextMAX_PRECMAX_EMAXMIN_EMIN MIN_ETINYHAVE_THREADSHAVE_CONTEXTVARZdecimalz1.70z2.4.2 N)
namedtuplezsign digits exponentc G s | S N )argsr) r) "/usr/lib64/python3.8/_pydecimal.py<lambda>