ok

Mini Shell

Direktori : /opt/alt/python311/lib64/python3.11/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/__pycache__/_pydecimal.cpython-311.opt-2.pyc

�

�fR�
�
�	gd�ZeZdZdZdZddlZddlZddl	Z		ddl
mZedd��Z
n#e$rd	�Z
YnwxYwd
ZdZdZd
ZdZdZdZdZdZdZe	jdkrdZdZdZndZdZdZeedz
z
ZGd�de��ZGd�de��Z Gd�de��Z!Gd�d e!��Z"Gd!�d"ee#��Z$Gd#�d$e!��Z%Gd%�d&e!e#��Z&Gd'�d(e��Z'Gd)�d*e!��Z(Gd+�d,e��Z)Gd-�d.e��Z*Gd/�d0e'e)��Z+Gd1�d2e'e)e*��Z,Gd3�d4ee-��Z.e e$e'e+e)e,e!e*e.g	Z/e"e!e%e!e&e!e(e!iZ0eeeeeeeefZ1ddl2Z2e2j3d5��Z4e5gd6���Z6d7�Z7d8�Z8[2dtd9�Z9Gd:�d;e:��Z;dud=�Z<ej=�>e;��Gd>�d?e:��Z?Gd@�dAe:��Z@GdB�dCe:��ZAdvdD�ZBeCjDZEdE�ZFdF�ZGdG�ZHdH�ZIdwdJ�ZJdK�ZKdL�ZLGdM�dNe:��ZMeM��jNZOdwdO�ZPdP�ZQdQ�ZRdRdSdTdUdVdWdXdYdZd[�	fd\�ZSdxd]�ZTdud^�ZUe@d_ee$e+e!ggd`dadd�b��ZVe@dcee$e+e!e e,gg�d��ZWe@dcegg�d��ZXddlYZYeYjZdeeYj[eYj\z��j]Z^eYjZdf��j]Z_eYjZdg��j]Z`eYjZdheYj[eYjaz��Zb[Y	ddlcZdn#e$rYnwxYwdtdi�Zedj�Zfdk�Zgdydl�Zhdm�Zidn�Zje;do��Zke;dp��Zle;dq��Zme;d��Zne;d��Zoe;dr��ZpekelfZqe	jrjsZte	jrjuZve	jrjwZxeydYetdsz
et��Zz[	dS)z)%�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_CONTEXTVAR�decimalz1.70z2.4.2�N)�
namedtuplerzsign digits exponentc��|S�N�)�argss �1/opt/alt/python311/lib64/python3.11/_pydecimal.py�<lambda>r/�s����rrrrrrrrTl����l��N�Zol������N�Zoi@�Ti����c��eZdZ	d�ZdS)rc��dSr+r,��self�contextr-s   r.�handlezDecimalException.handle�s���r0N��__name__�
__module__�__qualname__r7r,r0r.rr�s(�������$
�
�
�
�
r0rc��eZdZdS)r	N�r9r:r;r,r0r.r	r	��������	�	r0r	c��eZdZ	d�ZdS)r
c��|r=t|dj|djdd��}|�|��StS)Nr(�nT)�_dec_from_triple�_sign�_int�_fix_nan�_NaN)r5r6r-�anss    r.r7zInvalidOperation.handle�s@���	)�"�4��7�=�$�q�'�,��T�J�J�C��<�<��(�(�(��r0Nr8r,r0r.r
r
�s(�������,����r0r
c��eZdZ	d�ZdS)rc��tSr+�rFr4s   r.r7zConversionSyntax.handle����r0Nr8r,r0r.rrs(�����������r0rc��eZdZ	d�ZdS)rc��t|Sr+)�_SignedInfinity�r5r6�signr-s    r.r7zDivisionByZero.handles
���t�$�$r0Nr8r,r0r.rr
s(������
�%�%�%�%�%r0rc��eZdZ	d�ZdS)rc��tSr+rJr4s   r.r7zDivisionImpossible.handle"rKr0Nr8r,r0r.rr�(�����������r0rc��eZdZ	d�ZdS)rc��tSr+rJr4s   r.r7zDivisionUndefined.handle-rKr0Nr8r,r0r.rr%rSr0rc��eZdZdS)rNr=r,r0r.rr0r>r0rc��eZdZ	d�ZdS)rc��tSr+rJr4s   r.r7zInvalidContext.handleGrKr0Nr8r,r0r.rr<s(�����������r0rc��eZdZdS)r
Nr=r,r0r.r
r
Jr>r0r
c��eZdZdS)rNr=r,r0r.rrVs�������r0rc��eZdZ	d�ZdS)rc��|jttttfvr
t
|S|dkrF|jtkr
t
|St|d|jz|j	|jz
dz��S|dkrF|jtkr
t
|St|d|jz|j	|jz
dz��SdS)Nr(�9r1)�roundingrrrrrNrrB�prec�EmaxrrOs    r.r7zOverflow.handlews�����
�� /�� ;�;�;�"�4�(�(��1�9�9���=�0�0�&�t�,�,�#�D�#�g�l�*:�#�L���5�a�7�9�9�
9��1�9�9���;�.�.�&�t�,�,�#�D�#�g�l�*:�$�\�'�,�6�q�8�:�:�
:��9r0Nr8r,r0r.rras(�������*
:�
:�
:�
:�
:r0rc��eZdZdS)rNr=r,r0r.rr���������r0rc��eZdZdS)rNr=r,r0r.rr�rbr0r�decimal_context)r_�Eminr`�capitals�clampr^�flags�trapsc��		t���S#t$r-t��}t�|��|cYSwxYwr+)�_current_context_var�get�LookupErrorr�set�r6s r.rr�s_����#�'�'�)�)�)�������)�)��� � ��)�)�)��������s��4A�Ac��	|tttfvr(|���}|���t
�|��dSr+)rrr�copy�clear_flagsrkrnros r.rr�sP��/��>�<��A�A�A��,�,�.�.�����������W�%�%�%�%�%r0c���	|�t��}t|��}|���D]7\}}|tvrt	d|�d����t|j||���8|S)N�'z2' is an invalid keyword argument for this function)r�_ContextManager�items�_context_attributes�	TypeError�setattr�new_context)�ctx�kwargs�ctx_manager�key�values     r.r r �s���"�F�{��l�l��!�#�&�&�K��l�l�n�n�5�5�
��U��)�)�)��W��W�W�W�X�X�X���'��e�4�4�4�4��r0c
��eZdZ	dZd|d�Zed���Zd�Zd�Zd}d�Z	d	�Z
d
�Zd�Zd~d�Z
d~d
�Zd~d�Zd~d�Zd~d�Zd~d�Zd�Zd�Zd�Zd�Zdd�Zd~d�Zd~d�Zd~d�Zd�d�Zd~d�ZeZd~d�Zd~d�Zd~d �Z e Z!d~d!�Z"d"�Z#d~d#�Z$d~d$�Z%d~d%�Z&d~d&�Z'd~d'�Z(d~d(�Z)d~d)�Z*d~d*�Z+d+�Z,d,�Z-e-Z.e/d-���Z0e/d.���Z1d/�Z2d0�Z3d1�Z4d2�Z5d3�Z6d4�Z7d5�Z8d6�Z9d7�Z:d8�Z;d9�Z<d:�Z=e>e6e7e8e9e:e;e<e=�;��Z?d~d<�Z@d=�ZAd>�ZBd~d?�ZCd~d@�ZDdA�ZEd}dB�ZFd~dC�ZGd~dD�ZHd}dE�ZId~dF�ZJdG�ZKdH�ZLd}dI�ZMd}dJ�ZNeNZOd~dK�ZPd~dL�ZQd~dM�ZRdN�ZSdO�ZTdP�ZUdQ�ZVd~dR�ZWd~dS�ZXd~dT�ZYdU�ZZdV�Z[d~dW�Z\d~dX�Z]dY�Z^dZ�Z_d[�Z`d\�Zad~d]�Zbd^�Zcd_�Zdd`�Zed~da�Zfdb�Zgdc�Zhd~dd�Zide�Zjd~df�Zkd~dg�Zldh�Zmdi�Znd~dj�Zod~dk�Zpd~dl�Zqd~dm�Zrd~dn�Zsd~do�Ztd~dp�Zud~dq�Zvd~dr�Zwd~ds�Zxdt�Zyd~du�Zzd~dv�Z{d~dw�Z|dx�Z}dy�Z~dz�Zd}d{�Z�dS)�r)�_exprDrC�_is_special�0Nc�z
�	t�|��}t|t���r�t	|����dd����}|�.|�t��}|�td|z��S|�
d��dkrd|_nd|_|�
d��}|�~|�
d	��pd}t|�
d
��pd��}tt||z����|_
|t|��z
|_d|_n�|�
d
��}|�[tt|pd�����d��|_
|�
d��rd|_nd|_nd|_
d|_d|_|St|t��rF|dkrd|_nd|_d|_tt%|����|_
d|_|St|t&��r2|j|_|j|_|j
|_
|j|_|St|t(��rG|j|_t|j��|_
t|j��|_d|_|St|t.t0f���r�t|��dkrt3d���t|dt��r
|ddvst3d���|d|_|ddkrd|_
|d|_d|_�ng}	|dD]S}
t|
t��r.d|
cxkrdkr!nn|	s|
dkr|	�|
���Et3d���|ddvrBd�t9t|	����|_
|d|_d|_not|dt��rEd�t9t|	pdg����|_
|d|_d|_nt3d���|St|t:��rw|�t��}|�t<d��t&�|��}|j|_|j|_|j
|_
|j|_|StAd|z���)N�_�zInvalid literal for Decimal: %rrP�-r1r(�int�frac�expr�F�diag�signal�NrA�FT�ztInvalid tuple size in creation of Decimal from list or tuple.  The list or tuple should have exactly three elements.�r(r1z|Invalid sign.  The first value in the tuple should be an integer; either 0 for a positive number or 1 for a negative number.��	zTThe second value in the tuple must be composed of integers in the range 0 through 9.�rAr�zUThe third value in the tuple must be an integer, or one of the strings 'F', 'n', 'N'.�;strict semantics for mixing floats and Decimals are enabledzCannot convert %r to Decimal)!�object�__new__�
isinstance�str�_parser�strip�replacer�_raise_errorr�grouprCr�rD�lenr�r��lstrip�absr�_WorkReprPr��list�tuple�
ValueError�append�join�map�floatr�
from_floatrx)�clsrr6r5�m�intpart�fracpartr�r��digits�digits           r.r�zDecimal.__new__s
��	�,�~�~�c�"�"���e�S�!�!�"	�����
�
�-�-�c�2�6�6�7�7�A��y��?�(�l�l�G��+�+�,<� A�E� I�K�K�K��w�w�v���#�%�%���
�
���
��g�g�e�n�n�G��"��7�7�6�?�?�0�b���!�'�'�%�.�.�/�C�0�0����G�H�$4� 5� 5�6�6��	��#�h�-�-�/��	�#(�� � ��w�w�v�����#� #�C����$4�$4� 5� 5� <� <�S� A� A�D�I��w�w�x�(�(�(�$'��	�	�$'��	�	�!$�D�I� #�D�I�#'�� ��K��e�S�!�!�	���z�z���
�
���
��D�I��C��J�J���D�I�$�D���K��e�W�%�%�	���D�I���D�J���D�I� %� 1�D���K��e�X�&�&�	���D�J��E�I���D�I��E�I���D�I�$�D���K��e�d�5�\�*�*�*	��5�z�z�Q��� �"G�H�H�H��u�Q�x��-�-�
P�%��(�e�2C�2C� �"O�P�P�P��q��D�J��Q�x�3�����	�!�!�H��	�#'�� � ���"�1�X�9�9�E�!�%��-�-�9�!�u�/�/�/�/��/�/�/�/�/�!�1�U�a�Z�Z�"�M�M�%�0�0�0��(�*8�9�9�9���8�z�)�)� "����C��(8�(8� 9� 9�D�I� %�a��D�I�'+�D�$�$���a��#�.�.�?� "����C���A�3�(?�(?� @� @�D�I� %�a��D�I�',�D�$�$�$�&>�?�?�?��K��e�U�#�#�	���$�,�,��� � ���
�
�
��&�&�u�-�-�E���D�I���D�J���D�I� %� 1�D���K��6��>�?�?�?r0c�v�	t|t��r)|dkrdnd}d}tt|����}n�t|t��r�tj|��stj|��r|t|����Stj	d|��dkrd}nd}t|���
��\}}|���dz
}t|d|zz��}ntd���t|||��}|tur|S||��S)Nr(r1g�?�zargument must be int or float.)r�r�r�r�r��_math�isinf�isnan�repr�copysign�as_integer_ratio�
bit_lengthrxrBr)r��frP�k�coeffrA�d�results        r.r�zDecimal.from_float�s,��	�(�a����	>��Q���1�1�A�D��A���A���K�K�E�E�
��5�
!�
!�	>��{�1�~�~�
$���Q���
$��s�4��7�7�|�|�#��~�c�1�%�%��,�,�������q�6�6�*�*�,�,�D�A�q�������"�A���!�Q�$��K�K�E�E��<�=�=�=�!�$���r�2�2���'�>�>��M��3�v�;�;�r0c�D�	|jr|j}|dkrdS|dkrdSdS)NrAr1r�r�r()r�r�)r5r�s  r.�_isnanzDecimal._isnan�s<��	���	��)�C��c�z�z��q������q��qr0c�4�	|jdkr|jrdSdSdS)Nr����r1r()r�rC�r5s r.�_isinfinityzDecimal._isinfinity�s/��	��9�����z�
��r��1��qr0c�j�	|���}|�d}n|���}|s|r�|�t��}|dkr|�td|��S|dkr|�td|��S|r|�|��S|�|��SdS)NFr��sNaNr()r�rr�r
rE)r5�otherr6�self_is_nan�other_is_nans     r.�_check_nanszDecimal._check_nans�s���	��k�k�m�m���=� �L�L� �<�<�>�>�L��
	+�,�
	+���$�,�,���a����+�+�,<�f�(,�.�.�.��q� � ��+�+�,<�f�(-�/�/�/��
.��}�}�W�-�-�-��>�>�'�*�*�*��qr0c���	|�t��}|js|jr�|���r|�td|��S|���r|�td|��S|���r|�td|��S|���r|�td|��SdS)Nzcomparison involving sNaNzcomparison involving NaNr()rr��is_snanr�r
�is_qnan�r5r�r6s   r.�_compare_check_nanszDecimal._compare_check_nanss���		��?� �l�l�G���	3�u�0�	3��|�|�~�~�
3��+�+�,<�,G�,0�2�2�2������
3��+�+�,<�,G�,1�3�3�3������
3��+�+�,<�,F�,0�2�2�2������
3��+�+�,<�,F�,1�3�3�3��qr0c�(�	|jp
|jdkS�Nr��r�rDr�s r.�__bool__zDecimal.__bool__4s��	���3�4�9��#3�3r0c�V�	|js|jr:|���}|���}||krdS||krdSdS|s|sdSd|jzS|s
d|jzS|j|jkrdS|j|jkrdS|���}|���}||krW|jd|j|jz
zz}|jd|j|jz
zz}||krdS||krd|jzSd|jzS||kr
d|jzSd|jzS)Nr(r�r1r�)r�r�rC�adjustedrDr�)r5r��self_inf�	other_inf�
self_adjusted�other_adjusted�self_padded�other_paddeds        r.�_cmpzDecimal._cmp;s���	D�
��	�u�0�	��'�'�)�)�H��)�)�+�+�I��9�$�$��q��I�%�%��r��q��	,��
,��q��u�{�*�+�+��	$����#�#��;���#�#��2��:���#�#��1��
�
���
����)�)���N�*�*��)�c�4�9�u�z�+A�&B�B�K� �:��U�Z�$�)�-C�(D�D�L��l�*�*��q��|�+�+��d�j�(�(�(��T�Z�'�'�
�^�
+�
+����#�#��4�:�%�&�&r0c��t||d���\}}|tur|S|�||��rdS|�|��dkS)NT)�equality_opFr()�_convert_for_comparison�NotImplementedr�r�r�s   r.�__eq__zDecimal.__eq__{s^��-�d�E�t�L�L�L���e��N�"�"��L����E�7�+�+�	��5��y�y����1�$�$r0c��t||��\}}|tur|S|�||��}|rdS|�|��dkS�NFr(�r�r�r�r��r5r�r6rGs    r.�__lt__zDecimal.__lt__��^��-�d�E�:�:���e��N�"�"��L��&�&�u�g�6�6���	��5��y�y����!�#�#r0c��t||��\}}|tur|S|�||��}|rdS|�|��dkSr�r�r�s    r.�__le__zDecimal.__le__��^��-�d�E�:�:���e��N�"�"��L��&�&�u�g�6�6���	��5��y�y����1�$�$r0c��t||��\}}|tur|S|�||��}|rdS|�|��dkSr�r�r�s    r.�__gt__zDecimal.__gt__�r�r0c��t||��\}}|tur|S|�||��}|rdS|�|��dkSr�r�r�s    r.�__ge__zDecimal.__ge__�r�r0c��	t|d���}|js	|r!|jr|�||��}|r|St|�|����S�NT��raiseit)�_convert_otherr�r�rr�r�s    r.�comparezDecimal.compare�su��	��u�d�3�3�3��
��	��	�%�*;�	��"�"�5�'�2�2�C��
��
��t�y�y��'�'�(�(�(r0c���	|jrg|���rtd���|���rt�|��S|jrtStS|jdkrtd|jt��}n!tt|jt��}t|j
��|ztz}|dkr|n|}|dkrdn|S)Nz"Cannot hash a signaling NaN value.r(�
r����)r�r�rx�is_nanr��__hash__rC�_PyHASH_INFr��pow�_PyHASH_MODULUS�
_PyHASH_10INVr�rD)r5�exp_hash�hash_rGs    r.r�zDecimal.__hash__�s���'���		'��|�|�~�~�
'�� D�E�E�E������
'����t�,�,�,��:�'�'�<�'�&�&��9��>�>��2�t�y�/�:�:�H�H��=�4�9�*�o�F�F�H��D�I����)�O�;���q�y�y�e�e�u�f���B�Y�Y�r�r�C�'r0c	��	t|jttt|j����|j��Sr+)rrCr�r�r�rDr�r�s r.�as_tuplezDecimal.as_tuple�s3��	��D�J��c�#�t�y�.A�.A�(B�(B�D�I�N�N�Nr0c���	|jr2|���rtd���td���|sdSt	|j��}|jdkr|d|jzzd}}nu|j}|dkr"|dzdkr|dz}|dz}|dkr	|dzdk�|j}t||z���dz
|��}|r
||z}||z}d|z|z}|j	r|}||fS)Nz#cannot convert NaN to integer ratioz(cannot convert Infinity to integer ratior�r(r�r1r�)
r�r�r��
OverflowErrorr�rDr��minr�rC)r5rAr��d5�d2�shift2s      r.r�zDecimal.as_integer_ratio�s<��	���	P��{�{�}�}�
P� �!F�G�G�G�#�$N�O�O�O��	��4�
��	�N�N���9��>�>��r�4�9�}�$�a�q�A�A��)��B��q�&�&�Q��U�a�Z�Z��a����a����q�&�&�Q��U�a�Z�Z��)��B��!�q�b�&�,�,�.�.��2�B�7�7�F��
��f����f����2����A��:�	���A��!�t�r0c�(�	dt|��zS)Nz
Decimal('%s'))r�r�s r.�__repr__zDecimal.__repr__s��>���T���*�*r0Fc��	ddg|j}|jr5|jdkr|dzS|jdkr
|dz|jzS|dz|jzS|jt	|j��z}|jdkr	|d	kr|}n'|sd
}n"|jdkr|d
zdzd
z
}n|d
z
dzd
z}|dkrd}d
d|zz|jz}n^|t	|j��kr%|jd|t	|j��z
zz}d}n!|jd|�}d
|j|d�z}||krd}n(|�t��}ddg|jd||z
zz}||z|z|zS)Nr�r�r��InfinityrA�NaNr�r(���r1r�r��.�e�Ez%+d)rCr�r�rDr�rrf)	r5�engr6rP�
leftdigits�dotplacer�r�r�s	         r.�__str__zDecimal.__str__s���	�
�C�y���$����	1��y�C����j�(�(���c�!�!��e�|�d�i�/�/��f�}�t�y�0�0��Y��T�Y���/�
�
�9��>�>�j�2�o�o�!�H�H��	0��H�H�
�Y�#�
�
�"�Q��!�+�a�/�H�H�#�Q��!�+�a�/�H��q�=�=��G��S�8�)�_�,�t�y�8�H�H�
��T�Y���
'�
'��i��X�c�$�)�n�n�%<� =�=�G��H�H��i�	��	�*�G��T�Y�x�y�y�1�1�H���!�!��C�C���$�,�,����*�W�-�.��*�X�:M�1N�N�C��g�~��(�3�.�.r0c�2�	|�d|���S)NT)rr6)r�r5r6s  r.�
to_eng_stringzDecimal.to_eng_stringEs��	��|�|��g�|�6�6�6r0c��	|jr|�|���}|r|S|�t��}|s%|jtkr|���}n|���}|�|��S�Nro)r�r�rr^r�copy_abs�copy_negate�_fix�r5r6rGs   r.�__neg__zDecimal.__neg__Ns���	���	��"�"�7�"�3�3�C��
��
��?� �l�l�G��	%��(�K�7�7��-�-�/�/�C�C��"�"�$�$�C��x�x�� � � r0c��	|jr|�|���}|r|S|�t��}|s%|jtkr|���}nt
|��}|�|��Sr)r�r�rr^rrrrrs   r.�__pos__zDecimal.__pos__ds���	���	��"�"�7�"�3�3�C��
��
��?� �l�l�G��	 ��(�K�7�7��-�-�/�/�C�C��$�-�-�C��x�x�� � � r0Tc���	|s|���S|jr|�|���}|r|S|jr|�|���}n|�|���}|Sr)rr�r�rCrr)r5�roundr6rGs    r.�__abs__zDecimal.__abs__ys���	��	#��=�=�?�?�"���	��"�"�7�"�3�3�C��
��
��:�	0��,�,�w�,�/�/�C�C��,�,�w�,�/�/�C��
r0c���	t|��}|tur|S|�t��}|js|jr�|�||��}|r|S|���rN|j|jkr/|���r|�td��St|��S|���rt|��St|j|j��}d}|jtkr|j|jkrd}|sH|sFt|j|j��}|rd}t|d|��}|�|��}|S|sRt!||j|jz
dz
��}|�||j��}|�|��}|S|sRt!||j|jz
dz
��}|�||j��}|�|��}|St'|��}t'|��}t)|||j��\}}t'��}	|j|jkr�|j|jkr(t|d|��}|�|��}|S|j|jkr||}}|jdkr!d|	_|j|jc|_|_n1d|	_n)|jdkrd|	_d\|_|_nd|	_|jdkr|j|jz|	_n|j|jz
|	_|j|	_t|	��}|�|��}|S)Nz
-INF + INFr(r1r�)r(r()r�r�rr�r�r�rCr�r
rrr�r^rrBr�maxr_�_rescaler��
_normalizerPr�r�)
r5r�r6rGr��negativezerorP�op1�op2r�s
          r.�__add__zDecimal.__add__�sY��	��u�%�%���N�"�"��L��?� �l�l�G���	&�u�0�	&��"�"�5�'�2�2�C��
��
����!�!�
%��:���,�,��1B�1B�1D�1D�,�"�/�/�0@�,�O�O�O��t�}�}�$�� � �"�"�
&��u�~�~�%��$�)�U�Z�(�(������{�*�*�t�z�U�[�/H�/H��L��	�E�	��t�z�5�;�/�/�D��
���"�4��c�2�2�C��(�(�7�#�#�C��J��	��c�5�:���4�Q�6�7�7�C��.�.��g�&6�7�7�C��(�(�7�#�#�C��J��	��c�4�9�w�|�3�A�5�6�6�C��-�-��W�%5�6�6�C��(�(�7�#�#�C��J��t�n�n���u�o�o���c�3���5�5���S������8�s�x����w�#�'�!�!�&�|�S�#�>�>���h�h�w�'�'���
��w��� � ���S���x�1�}�}����%(�X�s�x�"���#�(�(�����
�X��]�]��F�K�!'��C�H�c�h�h��F�K��8�q�=�=���3�7�*�F�J�J���3�7�*�F�J��W��
��f�o�o���h�h�w�����
r0c���	t|��}|tur|S|js|jr|�||���}|r|S|�|���|���Sr)r�r�r�r�r*rr�s    r.�__sub__zDecimal.__sub__�s���!��u�%�%���N�"�"��L���	�u�0�	��"�"�5�'�"�:�:�C��
��
��|�|�E�-�-�/�/��|�A�A�Ar0c�f�	t|��}|tur|S|�||���Sr)r�r�r,r�s   r.�__rsub__zDecimal.__rsub__�s8��!��u�%�%���N�"�"��L��}�}�T�7�}�3�3�3r0c���	t|��}|tur|S|�t��}|j|jz}|js|jr�|�||��}|r|S|���r*|s|�td��St|S|���r*|s|�td��St|S|j
|j
z}|r|s(t|d|��}|�|��}|S|j
dkr-t||j
|��}|�|��}|S|j
dkr-t||j
|��}|�|��}|St|��}t|��}t|t|j|jz��|��}|�|��}|S)Nz(+-)INF * 0z0 * (+-)INFr��1)r�r�rrCr�r�r�r�r
rNr�rBrrDr�r�r�)r5r�r6�
resultsignrG�	resultexpr(r)s        r.�__mul__zDecimal.__mul__�s���	��u�%�%���N�"�"��L��?� �l�l�G��Z�%�+�-�
���
	3�u�0�
	3��"�"�5�'�2�2�C��
��
����!�!�
3��Q�"�/�/�0@�-�P�P�P�&�z�2�2�� � �"�"�
3��Q�"�/�/�0@�-�P�P�P�&�z�2�2��I��
�*�	��	�5�	�"�:�s�I�>�>�C��(�(�7�#�#�C��J��9����"�:�u�z�9�E�E�C��(�(�7�#�#�C��J��:����"�:�t�y�)�D�D�C��(�(�7�#�#�C��J��t�n�n���u�o�o���z�3�s�w���/@�+A�+A�9�M�M���h�h�w�����
r0c�4�	t|��}|turtS|�t��}|j|jz}|js|jr�|�||��}|r|S|���r/|���r|�td��S|���r
t|S|���r>|�td��t|d|�����S|s9|s|�td��S|�td|��S|s|j|jz
}d}n�t!|j��t!|j��z
|jzdz}|j|jz
|z
}t'|��}t'|��}	|dkr$t)|jd|zz|	j��\}}
n$t)|j|	jd|zz��\}}
|
r|d	zdkr|dz
}n7|j|jz
}||kr"|dzdkr|dz}|dz
}||kr	|dzdk�t|t-|��|��}|�|��S)
Nz(+-)INF/(+-)INFzDivision by infinityr�z0 / 0zx / 0r(r1r�r�)r�r�rrCr�r�r�r�r
rNr	rB�Etinyrrr�r�rDr_r��divmodr�r�r)r5r�r6rPrGr�r��shiftr(r)�	remainder�	ideal_exps            r.�__truediv__zDecimal.__truediv__6s���"��u�%�%���N�"�"�!�!��?� �l�l�G��z�E�K�'����
	D�u�0�
	D��"�"�5�'�2�2�C��
��
����!�!�
Q�e�&7�&7�&9�&9�
Q��+�+�,<�>O�P�P�P����!�!�
-�&�t�,�,�� � �"�"�
D��$�$�W�.D�E�E�E�'��c�7�=�=�?�?�C�C�C��	G��
H��+�+�,=�w�G�G�G��'�'����F�F�F��	��)�e�j�(�C��E�E���
�O�O�c�$�)�n�n�4�w�|�C�a�G�E��)�e�j�(�5�0�C��4�.�.�C��5�/�/�C���z�z�#)�#�'�B��I�*=�s�w�#G�#G� ��y�y�#)�#�'�3�7�R�%��Z�3G�#H�#H� ��y��	
��1�9��>�>��Q�J�E��!�I��
�2�	��I�o�o�%�"�*��/�/��b�L�E��1�H�C��I�o�o�%�"�*��/�/��t�S��Z�Z��5�5���x�x�� � � r0c�z�	|j|jz}|���r|j}nt|j|j��}|���|���z
}|r|���s|dkr,t|dd��|�||j��fS||jkr�t|��}t|��}|j
|j
kr!|xjd|j
|j
z
zzc_n |xjd|j
|j
z
zzc_t|j|j��\}}	|d|jzkrAt|t|��d��t|jt|	��|��fS|�td��}
|
|
fS)Nr�r�r(r�z%quotient too large in //, % or divmod)rCr�r�rr�rBr%r^r_r�r�r�r6r�r�r)r5r�r6rPr9�expdiffr(r)�q�rrGs           r.�_dividezDecimal._divideqs���	�
�z�E�K�'�������	3��	�I�I��D�I�u�z�2�2�I��-�-�/�/�E�N�N�$4�$4�4���	@�u�(�(�*�*�	@�g��m�m�$�T�3��2�2��M�M�)�W�-=�>�>�@�
@��g�l�"�"��4�.�.�C��5�/�/�C��w�#�'�!�!����2���#�'� 1�2�2�������2���#�'� 1�2�2����#�'�3�7�+�+�D�A�q��2�w�|�#�#�#�(��s�1�v�v�q�9�9�(���S��V�V�Y�G�G�I�I��"�"�#5�#J�L�L���C�x�r0c�f�	t|��}|tur|S|�||���Sr)r�r�r:r�s   r.�__rtruediv__zDecimal.__rtruediv__�s;��7��u�%�%���N�"�"��L�� � ��w� �7�7�7r0c��	t|��}|tur|S|�t��}|�||��}|r||fS|j|jz}|���r[|���r|�td��}||fSt||�td��fS|sX|s|�td��}||fS|�td|��|�td��fS|�||��\}}|�|��}||fS)Nzdivmod(INF, INF)�INF % xzdivmod(0, 0)�x // 0�x % 0)
r�r�rr�rCr�r�r
rNrrr?r)r5r�r6rGrP�quotientr8s       r.�
__divmod__zDecimal.__divmod__�sy��	��u�%�%���N�"�"��L��?� �l�l�G����u�g�.�.���	���:���z�E�K�'�������	K�� � �"�"�
K��*�*�+;�=O�P�P���C�x��'��-��,�,�-=�y�I�I�K�K��	I��
I��*�*�+<�n�M�M���C�x���,�,�^�X�t�L�L��,�,�-=�w�G�G�I�I�#�l�l�5�'�:�:���)��N�N�7�+�+�	���"�"r0c�f�	t|��}|tur|S|�||���Sr)r�r�rGr�s   r.�__rdivmod__zDecimal.__rdivmod__�s;��6��u�%�%���N�"�"��L�����g��6�6�6r0c���	t|��}|tur|S|�t��}|�||��}|r|S|���r|�td��S|s8|r|�td��S|�td��S|�||��d}|�	|��}|S)NrCrEz0 % 0r1)
r�r�rr�r�r�r
rr?r)r5r�r6rGr8s     r.�__mod__zDecimal.__mod__�s���	��u�%�%���N�"�"��L��?� �l�l�G����u�g�.�.���	��J������	H��'�'�(8�)�D�D�D��	H��
H��+�+�,<�g�F�F�F��+�+�,=�w�G�G�G��L�L���0�0��3�	��N�N�7�+�+�	��r0c�f�	t|��}|tur|S|�||���Sr)r�r�rKr�s   r.�__rmod__zDecimal.__rmod__��8��3��u�%�%���N�"�"��L��}�}�T�7�}�3�3�3r0c��	|�t��}t|d���}|�||��}|r|S|���r|�t
d��S|s8|r|�t
d��S|�td��S|���r$t|��}|�|��St|j
|j
��}|s+t|jd|��}|�|��S|�
��|�
��z
}||jdzkr|�t��S|dkr0|�||j��}|�|��St%|��}t%|��}|j|jkr!|xjd	|j|jz
zzc_n |xjd	|j|jz
zzc_t+|j|j��\}}	d
|	z|dzz|jkr|	|jz}	|dz
}|d	|jzkr|�t��S|j}
|	dkrd|
z
}
|	}	t|
t-|	��|��}|�|��S)NTr�zremainder_near(infinity, x)zremainder_near(x, 0)zremainder_near(0, 0)r�r1r�r�r�r()rr�r�r�r�r
rrrrr�rBrCr�r_rr%r^r�r�r�r6r�)r5r�r6rG�ideal_exponentr<r(r)r=r>rPs           r.�remainder_nearzDecimal.remainder_near�s���	��?� �l�l�G��u�d�3�3�3�����u�g�.�.���	��J������	G��'�'�(8�(E�G�G�
G��	D��
D��+�+�,<�,B�D�D�D��+�+�,=�,B�D�D�D������	%��$�-�-�C��8�8�G�$�$�$��T�Y��
�3�3���	%�"�4�:�s�N�C�C�C��8�8�G�$�$�$��-�-�/�/�E�N�N�$4�$4�4���g�l�Q�&�&�&��'�'�(:�;�;�;��b�=�=��-�-���0@�A�A�C��8�8�G�$�$�$��t�n�n���u�o�o���7�c�g����G�G�r�C�G�c�g�-�.�.�G�G�G��G�G�r�C�G�c�g�-�.�.�G�G��c�g�s�w�'�'���1�
�Q�3�!�A�#�;��� � �
���L�A�
��F�A���G�L� � � ��'�'�(:�;�;�;��z���q�5�5��T�6�D���A��t�S��V�V�^�<�<���x�x�� � � r0c��	t|��}|tur|S|�t��}|�||��}|r|S|���rI|���r|�td��St|j|jzS|sF|r)|�td|j|jz��S|�td��S|�||��dS)Nz
INF // INFrDz0 // 0r()r�r�rr�r�r�r
rNrCrrr?r�s    r.�__floordiv__zDecimal.__floordiv__1s����u�%�%���N�"�"��L��?� �l�l�G����u�g�.�.���	��J������	A�� � �"�"�
A��+�+�,<�l�K�K�K�&�t�z�E�K�'?�@�@��	I��
I��+�+�N�H�,0�J���,D�F�F�F��+�+�,=�x�H�H�H��|�|�E�7�+�+�A�.�.r0c�f�	t|��}|tur|S|�||���Sr)r�r�rSr�s   r.�
__rfloordiv__zDecimal.__rfloordiv__Ms;��8��u�%�%���N�"�"��L��!�!�$��!�8�8�8r0c���	|���r/|���rtd���|jrdnd}nt	|��}t|��S)Nz%Cannot convert signaling NaN to floatz-nan�nan)r�r�r�rCr�r��r5�ss  r.�	__float__zDecimal.__float__Ts]��#��;�;�=�=�	��|�|�~�~�
J� �!H�I�I�I��*�/���%�A�A��D�	�	�A��Q�x�x�r0c�X�	|jrF|���rtd���|���rt	d���d|jz}|jdkr"|t|j��zd|jzzS|t|jd|j�pd��zS)NzCannot convert NaN to integerz"Cannot convert infinity to integerr�r(r�r�)	r�r�r�r�rrCr�r�rDrXs  r.�__int__zDecimal.__int__^s���?���	J��{�{�}�}�
J� �!@�A�A�A��!�!�#�#�
J�#�$H�I�I�I�
�$�*����9��>�>��S���^�^�#�B��	�M�1�1��S���:�D�I�:�.�5�#�6�6�6�6r0c��|Sr+r,r�s r.�realzDecimal.realms���r0c� �td��S�Nr(�rr�s r.�imagzDecimal.imagqs���q�z�z�r0c��|Sr+r,r�s r.�	conjugatezDecimal.conjugateus���r0c�:�tt|����Sr+)�complexr�r�s r.�__complex__zDecimal.__complex__xs���u�T�{�{�#�#�#r0c��	|j}|j|jz
}t|��|krI|t|��|z
d��d��}t|j||jd��St|��S)Nr�T)	rDr_rgr�r�rBrCr�r)r5r6�payload�max_payload_lens    r.rEzDecimal._fix_nan{sz��@��)��"�,���6���w�<�<�/�)�)��c�'�l�l�?�:�;�;�<�C�C�C�H�H�G�#�D�J����D�I�I�I��t�}�}�r0c� �	|jr8|���r|�|��St|��S|���}|���}|s�|j|g|j}tt|j
|��|��}||j
kr0|�t��t|jd|��St|��St|j��|j
z|jz
}||krW|�t$d|j��}|�t&��|�t(��|S||k}|r|}|j
|k�r�t|j��|j
z|z
}	|	dkrt|jd|dz
��}d}	|j|j}
|
||	��}|jd|	�pd}|dkrFt/t1|��dz��}t|��|jkr|dd�}|dz
}||kr"|�t$d|j��}nt|j||��}|r|r|�t2��|r|�t4��|r|�t&��|�t(��|s|�t��|S|r|�t4��|jdkrP|j
|krE|�t��|jd|j
|z
zz}
t|j|
|��St|��S)Nr��
above Emaxr(r0r1r�)r�r�rErr5�Etopr`rgrr$r�r�r	rBrCr�rDr_rrr
�_pick_rounding_functionr^r�r�rr)r5r6r5rm�exp_max�new_exp�exp_minrG�self_is_subnormalr��rounding_method�changedr�r�s              r.rzDecimal._fix�sw��	���	%��{�{�}�}�
%��}�}�W�-�-�-��t�}�}�$��
�
�����|�|�~�~���	%��|�T�*�7�=�9�G��#�d�i��/�/��9�9�G��$�)�#�#��$�$�W�-�-�-�'��
�C��A�A�A��t�}�}�$��d�i�.�.�4�9�,�w�|�;���T�>�>��&�&�x��t�z�J�J�C�� � ��)�)�)�� � ��)�)�)��J�#�e�O���	��G��9�w������^�^�d�i�/�'�9�F���z�z�'��
�C����C�C����"�:�7�;K�L�O�%�o�d�F�3�3�G��I�g�v�g�&�-�#�E���{�{��C��J�J�q�L�)�)���u�:�:���,�,�!�#�2�#�J�E��q�L�G���~�~��*�*�8�\�4�:�N�N���&�t�z�5�'�B�B���
0�,�
0��$�$�Y�/�/�/� �
0��$�$�Y�/�/�/��
.��$�$�W�-�-�-�� � ��)�)�)��
.��$�$�W�-�-�-��J��	,�� � ��+�+�+��=�A���$�)�d�"2�"2�� � ��)�)�)��)�c�4�9�t�+;�&<�<�K�#�D�J��T�B�B�B��t�}�}�r0c�6�	t|j|��rdSdS)Nr(r�)�
_all_zerosrD�r5r_s  r.�_round_downzDecimal._round_down�s#��6��d�i��&�&�	��1��2r0c�0�	|�|��Sr+)rxrws  r.�	_round_upzDecimal._round_up�s��!�� � ��&�&�&�&r0c�X�	|j|dvrdSt|j|��rdSdS)N�56789r1r(r�)rDrvrws  r.�_round_half_upzDecimal._round_half_up�s9��'��9�T�?�g�%�%��1�
��	�4�
(�
(�	��1��2r0c�\�	t|j|��rdS|�|��S)Nr���_exact_halfrDr}rws  r.�_round_half_downzDecimal._round_half_downs2����t�y�$�'�'�	-��2��&�&�t�,�,�,r0c��	t|j|��r|dks|j|dz
dvrdS|�|��S)Nr(r1�02468r�rrws  r.�_round_half_evenzDecimal._round_half_evensP��/��t�y�$�'�'�	-�����d�i��Q��/�7�:�:��2��&�&�t�,�,�,r0c�h�	|jr|�|��S|�|��Sr+�rCrxrws  r.�_round_ceilingzDecimal._round_ceilings:��6��:�	+��#�#�D�)�)�)��$�$�T�*�*�*�*r0c�h�	|js|�|��S|�|��Sr+r�rws  r.�_round_floorzDecimal._round_floors:��5��z�	+��#�#�D�)�)�)��$�$�T�*�*�*�*r0c��	|r'|j|dz
dvr|�|��S|�|��S)Nr1�05)rDrxrws  r.�_round_05upzDecimal._round_05upsM��7��	+�D�I�d�1�f�%�T�1�1��#�#�D�)�)�)��$�$�T�*�*�*�*r0)rrrrrrrrc�`�	|�Kt|t��std���tdd|��}|�|��S|jr2|���rtd���td���t|�	dt����S)Nz+Second argument to round should be integralr(r0�cannot round a NaN�cannot round an infinity)r�r�rxrB�quantizer�r�r�rr%r)r5rAr�s   r.�	__round__zDecimal.__round__0s���-	�\
�=��a��%�%�
O�� M�N�N�N�"�1�c�A�2�.�.�C��=�=��%�%�%���	@��{�{�}�}�
@� �!5�6�6�6�#�$>�?�?�?��4�=�=��O�4�4�5�5�5r0c���	|jr2|���rtd���td���t	|�dt����S�Nr�r�r()r�r�r�rr�r%rr�s r.�	__floor__zDecimal.__floor__ns`��	���	@��{�{�}�}�
@� �!5�6�6�6�#�$>�?�?�?��4�=�=��K�0�0�1�1�1r0c���	|jr2|���rtd���td���t	|�dt����Sr�)r�r�r�rr�r%rr�s r.�__ceil__zDecimal.__ceil__}s`��	���	@��{�{�}�}�
@� �!5�6�6�6�#�$>�?�?�?��4�=�=��M�2�2�3�3�3r0c	�P�	t|d���}t|d���}|js|j�r|�t��}|jdkr|�t
d|��S|jdkr|�t
d|��S|jdkr|}n�|jdkr|}n�|jdkr8|s|�t
d��St|j|jz}n�|jdkr7|s|�t
d��St|j|jz}n_t|j|jztt|j��t|j��z��|j|jz��}|�||��S)	NTr�r�r�rAr�zINF * 0 in fmaz0 * INF in fma)
r�r�rr�r�r
rNrCrBr�r�rDr*)r5r��thirdr6�products     r.�fmazDecimal.fma�s���	��u�d�3�3�3���u�d�3�3�3����	?�u�0�	?���$�,�,���y�C����+�+�,<�f�d�K�K�K��z�S� � ��+�+�,<�f�e�L�L�L��y�C��������s�"�"������c�!�!��B�"�/�/�0@�0@�B�B�B�)�$�*�u�{�*B�C�����s�"�"��B�"�/�/�0@�0@�B�B�B�)�$�*�u�{�*B�C���&�t�z�E�K�'?�'*�3�t�y�>�>�C��
�O�O�+K�'L�'L�'+�y�5�:�'=�?�?�G����u�g�.�.�.r0c�2�	t|��}|tur|St|��}|tur|S|�t��}|���}|���}|���}|s|s|r�|dkr|�t
d|��S|dkr|�t
d|��S|dkr|�t
d|��S|r|�|��S|r|�|��S|�|��S|���r(|���r|���s|�t
d��S|dkr|�t
d��S|s|�t
d��S|���|j	kr|�t
d��S|s|s|�t
d��S|�
��rd}n|j}tt|����}t|�����}t|�����}	|j
|zt!d	|j|��z|z}t%|	j��D]}
t!|d	|��}�t!||	j
|��}t'|t)|��d��S)
Nr�r�z@pow() 3rd argument not allowed unless all arguments are integersr(zApow() 2nd argument cannot be negative when 3rd argument specifiedzpow() 3rd argument cannot be 0zSinsufficient precision: pow() 3rd argument must not have more than precision digitszXat least one of pow() 1st argument and 2nd argument must be nonzero; 0**0 is not definedr�)r�r�rr�r�r
rE�
_isintegerr�r_�_isevenrCr�r�r��to_integral_valuer�r��rangerBr�)r5r��modulor6r�r��
modulo_is_nanrP�base�exponent�is           r.�
_power_modulozDecimal._power_modulo�sa��/��u�%�%���N�"�"��L���'�'���^�#�#��M��?� �l�l�G��k�k�m�m���|�|�~�~���
�
���
��	,�,�	,�-�	,��a����+�+�,<�f�(,�.�.�.��q� � ��+�+�,<�f�(-�/�/�/���!�!��+�+�,<�f�(.�0�0�0��
.��}�}�W�-�-�-��
/��~�~�g�.�.�.��?�?�7�+�+�+����!�!�	M�� � �"�"�	M��!�!�#�#�	M��'�'�(8�)L�M�M�
M��1�9�9��'�'�(8�)O�P�P�
P��	J��'�'�(8�(H�J�J�
J�
�?�?�����,�,��'�'�(8�);�<�<�
<��	?�T�	?��'�'�(8�)>�?�?�
?��=�=�?�?�	��D�D��:�D��S��[�[�!�!����.�.�0�0�1�1���E�3�3�5�5�6�6����6�!�C��D�H�f�$=�$=�=��G���x�|�$�$�	)�	)�A��t�R��(�(�D�D��4���v�.�.����c�$�i�i��3�3�3r0c�	�	t|��}|j|j}}|dzdkr|dz}|dz
}|dzdk�t|��}|j|j}}|dzdkr|dz}|dz
}|dzdk�|dkr�||z}|dzdkr|dz}|dz
}|dzdk�|dkrdS|d|zz}	|jdkr|	}	|���r9|jdkr.|jt|��z}
t|	|
z
|dz
��}nd}tddd|zz|	|z
��S|jdk�rq|dz}|dvr�||z|krdSt|��dz
}
|dzdz}|tt|����krdSt|
|z|��}
t||z|��}|
�|�dS|
|krdSd	|
z}n�|d	kr�t|��d
zdz}
td	|
z|��\}}|rdS|d	zdkr|d	z}|
dz}
|d	zdk�|dzdz}|tt|����krdSt|
|z|��}
t||z|��}|
�|�dS|
|krdSd|
z}ndS|d|zkrdS|
|z
}tdt|��|��S|dkr|d|zzd}}n�|dkr3ttt||z������|krdSt|��}ttt|��|z����|krdS|d|z}}|dz|dzcxkrdkr"nn|dz}|dz}|dz|dzcxkrdk�n|d	z|d	zcxkrdkr"nn|d	z}|d	z}|d	z|d	zcxkrdk�n|dkrz||krdSt||��\}}|dkrdSdt|��|zz}	t|||dz
z��\}}||krn||dz
z|z|z}�/||kr|dksdS|}|dkr||dzt|��zkrdS||z}||z}|d|zkrdSt|��}|���rF|jdkr;|jt|��z}
t||
z
|t|��z
��}nd}td|d|zz||z
��S)Nr�r(r1r0r�)r�����]�Ar��r�r�T�d)r�r�r�rPr�rCr�rrB�_nbitsr�r��_decimal_lshift_exactr6r��	_log10_lb)r5r��p�x�xc�xe�y�yc�yer�rP�zeros�
last_digitr�emaxr8r�rA�xc_bits�rem�ar=r>�str_xcs                        r.�_power_exactzDecimal._power_exact
sC��	B�r
�T�N�N������B���2�g��l�l��2�I�B��!�G�B��2�g��l�l�
�U�O�O������B���2�g��l�l��2�I�B��!�G�B��2�g��l�l���7�7��"�H�B��r�'�Q�,�,��r�	���a����r�'�Q�,�,��A�v�v��t��B��F�{�H��v��{�{�$�9�����!�!�
�e�k�Q�&6�&6�!%��3�u�:�:�!5���H�^�3�Q�q�S�9�9�����#�A�s�S��Y�����G�G�G�
�6�Q�;�;��b��J��Y�&�&����8�r�>�>��4��2�J�J�q�L��6��t�R�x����S��Y�Y���'�'��4�*�!�b�&�"�5�5��*�2��7�B�7�7���9��
��4��t�8�8��4���T����q����2�J�J�r�M�2�%�� &�q�!�t�R� 0� 0�
��I�� ��4��1�f��k�k��1�H�B���F�A��1�f��k�k���t�Q�w����S��Y�Y���'�'��4�)�!�b�&�"�5�5��*�2��7�B�7�7���9��
��4��t�8�8��4���T����t��R��U�{�{��t���B��B�#�A�s�2�w�w��3�3�3���7�7��b�"�f�9�a�q�A�A��Q�w�w�3�s�3�r�"�u�:�:���/�/�B�3�6�6��t��R�j�j�G��3�s�2�w�w�w��'�'�(�(�R�C�/�/��t��r�R�C�y�q�A��a�%�1�q�5�%�%�%�%�A�%�%�%�%�%��a����a����a�%�1�q�5�%�%�%�%�A�%�%�%�%��a�%�1�q�5�%�%�%�%�A�%�%�%�%�%��a����a����a�%�1�q�5�%�%�%�%�A�%�%�%�%�

�q�5�5��!�|�|��t��R��m�m�G�B���a�x�x��t���r�
�
�{�A�~�&�&�A�
)��b�!�a��c�(�+�+���1���6�6���A�a�C��1��q�(�A�
)���F�F�q�A�v�v��t��B���6�6�a�!�C�%��2���.�.�.��4�
��U��
�a���
��A��:�:��4�
�R���������	�%�+��"2�"2�!�Y�s�5�z�z�1�N���>�)�1�S��[�[�=�9�9�E�E��E���6�#�e�)�#3�R��X�>�>�>r0c��	|�|�|||��St|��}|tur|S|�t��}|�||��}|r|S|s$|s|�td��StSd}|jdkr\|�	��r|�
��sd}n|r|�td��S|���}|s)|jdkrt|dd��St|S|���r)|jdkr
t|St|dd��S|tkr�|�	��rm|jdkrd}n"||jkr|j}nt!|��}|j|z}|d|jz
kr$d|jz
}|�t$��n>|�t&��|�t$��d|jz
}t|dd|zz|��S|���}|���r1|jdk|dkkrt|dd��St|Sd}d}	|���|���z}
|dk|jdkkr?|
t-t/|j����krt|d|jdz��}nI|���}|
t-t/|����krt|d|dz
��}|�C|�||jdz��}|�#|dkrtd|j|j��}d}	|��|j}t9|��}
|
j|
j}}t9|��}|j|j}}|jdkr|}d	}	t?||||||z��\}}|d
dt-t/|����|z
dz
zzzrn|d	z
}�Kt|t/|��|��}|	�r�|�	���sut-|j��|jkrH|jdzt-|j��z
}t|j|jd|zz|j|z
��}|� ��}|�!��tDD]}d|j#|<�
|�$|��}|�t&��|j%tLr|�tN��|j%tPr!|�tPd|j��tNtLt&t$tRfD]$}|j%|r|�|���%n|�$|��}|S)
Nz0 ** 0r(r1z+x ** y with x negative and y not an integerr�r0FTr�r�r�rl)*r�r�r�rr�r�r
�_OnerCr�r�rrBrNr�r_r�r�r
rr��_log10_exp_boundr�r�r`r5r�rDr�r�rP�_dpowerrqrr�_signalsrirrhrrrr	)r5r�r�r6rG�result_sign�
multiplierr��self_adj�exact�boundr5r�r�r�r�r�r�r��extrar�r<�
newcontext�	exceptions                        r.�__pow__zDecimal.__pow__�s2��	�.���%�%�e�V�W�=�=�=��u�%�%���N�"�"��L��?� �l�l�G����u�g�.�.���	��J��	��
��+�+�,<�h�G�G�G������:��?�?����!�!�
G��}�}���$�"#�K���G�"�/�/�0@�E�G�G�G��#�#�%�%�D��	4��{�a���'��S�!�<�<�<�&�{�3�3������	=��{�a���&�{�3�3�'��S�!�<�<�<�
�4�<�<����!�!�
%�
�;�!�#�#�!"�J�J��W�\�)�)�!(��J�J�!$�U���J��i�*�,����7�<��'�'��G�L�.�C��(�(��1�1�1���$�$�W�-�-�-��$�$�W�-�-�-����n��#�K��S�#��X��s�C�C�C��=�=�?�?�������	4���q� �h��l�3�3�'��S�!�<�<�<�&�{�3�3������%�%�'�'�%�.�.�*:�*:�:����M�u�{�a�/�0�0���C���-�-�.�.�.�.�&�{�C���a��H�H����M�M�O�O�E���C���K�K�(�(�(�(�&�{�C��q��A�A���;��#�#�E�7�<�!�+;�<�<�C����!�#�#�*�1�c�h���A�A�C����;���A�����A��U�A�E��B�����A��U�A�E��B��v��{�{��S���E�
�$�R��R��Q�u�W�=�=�
��s��A�b�3�s�5�z�z�?�?�1�#4�Q�#6�7�7�8�����
��	
�#�;��E�
�
�C�@�@�C��"	$��)�)�+�+�"	$��3�8�}�}���,�,�!�,��*�S���]�]�:��&�s�y�#�(�3�w�;�2F�'*�x��'7�9�9��!�����J��"�"�$�$�$�%�
0�
0�	�./�
� ��+�+��(�(�:�&�&�C�
�#�#�G�,�,�,���	�*�
3��'�'�	�2�2�2����)�
H��$�$�X�|�S�Y�G�G�G�&�	�7�G�W�L�
4�
4�	��#�I�.�4��(�(��3�3�3��
4�
�(�(�7�#�#�C��
r0c�f�	t|��}|tur|S|�||���Sr)r�r�r�r�s   r.�__rpow__zDecimal.__rpow__�	rNr0c�0�	|�t��}|jr|�|���}|r|S|�|��}|���r|S|st|jdd��S|j|���g|j	}t|j��}|j}|j|dz
dkr*||kr$|dz
}|dz}|j|dz
dkr||k�$t|j|jd|�|��S)Nror�r(r1)
rr�r�rr�rBrCr`rmrgr�rDr�)r5r6rG�dupro�endr�s       r.�	normalizezDecimal.normalize�	s"��M��?� �l�l�G���	��"�"�7�"�3�3�C��
��
��i�i�� � ���?�?���	��J��	7�#�C�I�s�A�6�6�6��<������0���?���#�(�m�m���h���h�s�1�u�o��$�$��w����1�H�C��1�H�C��h�s�1�u�o��$�$��w��� ��	�3�8�D�S�D�>�3�?�?�?r0c��	t|d���}|�t��}|�|j}|js|jr�|�||��}|r|S|���s|���rR|���r#|���rt
|��S|�td��S|�	��|j
cxkr|jksn|�td��S|s0t|j
d|j
��}|�|��S|���}||jkr|�td��S||j
z
dz|jkr|�td��S|�|j
|��}|���|jkr|�td��St%|j��|jkr|�td��S|r7|���|jkr|�t*��|j
|j
kr:||kr|�t,��|�t.��|�|��}|S)	NTr�zquantize with one INFz)target exponent out of bounds in quantizer�z9exponent of quantize result too large for current contextr1z7quantize result has too many digits for current context)r�rr^r�r�r�rr�r
r5r�r`rBrCrr�r_r%r�rDrerrr
)r5r�r^r6rGr�s      r.r�zDecimal.quantize�	s���	��S�$�/�/�/���?� �l�l�G����'�H���		A�s��		A��"�"�3��0�0�C��
��
���� � �
A�D�$4�$4�$6�$6�
A��?�?�$�$�)��)9�)9�);�);�)�"�4�=�=�(��+�+�,<�(?�A�A�A��
�
���3�8�;�;�;�;�w�|�;�;�;�;��'�'�(8�>�@�@�
@��	%�"�4�:�s�C�H�=�=�C��8�8�G�$�$�$��
�
���
��7�<�'�'��'�'�(8�(c�e�e�
e��3�8�#�a�'�'�,�6�6��'�'�(8�(a�c�c�
c��m�m�C�H�h�/�/���<�<�>�>�G�L�(�(��'�'�(8�(c�e�e�
e��s�x�=�=�7�<�'�'��'�'�(8�(a�c�c�
c��	,�3�<�<�>�>�G�L�0�0�� � ��+�+�+��8�d�i����d�{�{��$�$�W�-�-�-�� � ��)�)�)��h�h�w�����
r0c��	t|d���}|js|jrP|���r|���p'|���o|���S|j|jkSr�)r�r�r��is_infiniter�r�s   r.�same_quantumzDecimal.same_quantum/
s���	��u�d�3�3�3����	@�u�0�	@��K�K�M�M�4�e�l�l�n�n�?��$�$�&�&�>�5�+<�+<�+>�+>�
@��y�E�J�&�&r0c��	|jrt|��S|st|jd|��S|j|kr)t|j|jd|j|z
zz|��St
|j��|jz|z
}|dkrt|jd|dz
��}d}|j|}|||��}|jd|�pd}|dkrtt|��dz��}t|j||��S)Nr�r(r0r1)
r�rrBrCr�rDr�rnr�r�)r5r�r^r��
this_functionrtr�s       r.r%zDecimal._rescale>
s ��		���	!��4�=�=� ��	:�#�D�J��S�9�9�9��9����#�D�J�(,�	�C���S��4I�(I�3�P�P�
P�
�T�Y���$�)�+�c�1���A�:�:�#�D�J��S��U�;�;�D��F��4�X�>�
��-��f�-�-���	�'�6�'�"�)�c���a�<�<���E�
�
�1��%�%�E���
�E�3�7�7�7r0c�n�	|dkrtd���|js|st|��S|�|���dz|z
|��}|���|���kr.|�|���dz|z
|��}|S)Nr(z'argument should be at least 1 in _roundr1)r�r�rr%r�)r5�placesr^rGs    r.�_roundzDecimal._round`
s���	��Q�;�;��F�G�G�G���	!�4�	!��4�=�=� ��m�m�D�M�M�O�O�A�-�f�4�h�?�?��
�<�<�>�>�T�]�]�_�_�,�,��,�,�s�|�|�~�~�a�/��6��A�A�C��
r0c��	|jr)|�|���}|r|St|��S|jdkrt|��S|st	|jdd��S|�t
��}|�|j}|�d|��}||kr|�	t��|�	t��|S)Nror(r�)r�r�rr�rBrCrr^r%r�rr
�r5r^r6rGs    r.�to_integral_exactzDecimal.to_integral_exactw
s���	���	!��"�"�7�"�3�3�C��
��
��4�=�=� ��9��>�>��4�=�=� ��	8�#�D�J��Q�7�7�7��?� �l�l�G����'�H��m�m�A�x�(�(���$�;�;�� � ��)�)�)����W�%�%�%��
r0c��	|�t��}|�|j}|jr)|�|���}|r|St	|��S|jdkrt	|��S|�d|��S)Nror()rr^r�r�rr�r%r�s    r.r�zDecimal.to_integral_value�
s���N��?� �l�l�G����'�H���	!��"�"�7�"�3�3�C��
��
��4�=�=� ��9��>�>��4�=�=� ��=�=��H�-�-�-r0c�D�	|�t��}|jrH|�|���}|r|S|���r|jdkrt|��S|s3t
|jd|jdz��}|�|��S|jdkr|�	td��S|jdz}t|��}|j
dz	}|j
dzr%|jdz}t|j��dz	dz}n!|j}t|j��dzdz	}||z
}|dkr|d|zz}d	}	nt#|d|z��\}}
|
}	||z}d|z}	||z}||krn	||zdz	}�|	o||z|k}	|	r|dkr	|d|zz}n	|d|zz}||z
}n|d
zdkr|dz
}t
dt%|��|��}|���}|�t*��}
|�|��}|
|_|S)Nror(r�r�r1zsqrt(-x), x > 0r�r�Tr�)rr�r�r�rCrrBr�rr�r
r_r�r�r�r�rDr6r��
_shallow_copy�
_set_roundingrr^)r5r6rGr_�opr�c�lr7r�r8rAr=r^s              r.�sqrtzDecimal.sqrt�
s��-��?� �l�l�G���	%��"�"�7�"�3�3�C��
��
����!�!�
%�d�j�A�o�o��t�}�}�$��	%�"�4�:�s�D�I��N�C�C�C��8�8�G�$�$�$��:��?�?��'�'�(8�:K�L�L�L�,�|�A�~���d�^�^���F�a�K��
�6�A�:�	&�����A��T�Y���1�$��)�A�A���A��D�I���q� �A�%�A��Q����A�:�:�
��e��O�A��E�E�!�!�S�5�&�[�1�1�L�A�y�!�M�E�	�U�
��
��H��	��1��A��A�v�v����E�Q�J��	��"�!�A�#��(���	���z�z��b�%�i�����R�%��Z���
��J�A�A��1�u��z�z��Q����q�#�a�&�&�!�,�,���'�'�)�)���(�(��9�9���h�h�w����#����
r0c�
�	t|d���}|�t��}|js|jr�|���}|���}|s|rX|dkr|dkr|�|��S|dkr|dkr|�|��S|�||��S|�|��}|dkr|�|��}|dkr|}n|}|�|��S�NTr�r1r(r��r�rr�r�rr�r��
compare_total�r5r�r6�sn�onr�rGs       r.r$zDecimal.max
s��	�
�u�d�3�3�3���?� �l�l�G���
	8�u�0�
	8������B������B��
8�R�
8���7�7�r�Q�w�w��9�9�W�-�-�-���7�7�r�Q�w�w� �:�:�g�.�.�.��'�'��w�7�7�7��I�I�e������6�6��"�"�5�)�)�A���7�7��C�C��C��x�x�� � � r0c�
�	t|d���}|�t��}|js|jr�|���}|���}|s|rX|dkr|dkr|�|��S|dkr|dkr|�|��S|�||��S|�|��}|dkr|�|��}|dkr|}n|}|�|��Sr�r�r�s       r.rzDecimal.min4s��	�
�u�d�3�3�3���?� �l�l�G���
	8�u�0�
	8������B������B��
8�R�
8���7�7�r�Q�w�w��9�9�W�-�-�-���7�7�r�Q�w�w� �:�:�g�.�.�.��'�'��w�7�7�7��I�I�e������6�6��"�"�5�)�)�A���7�7��C�C��C��x�x�� � � r0c��	|jrdS|jdkrdS|j|jd�}|dt|��zkS)NFr(Tr�)r�r�rDr�)r5�rests  r.r�zDecimal._isintegerVsL��0���	��5��9��>�>��4��y�����$���s�3�t�9�9�}�$�$r0c�P�	|r|jdkrdS|jd|jzdvS)Nr(Tr�r�)r�rDr�s r.r�zDecimal._iseven_s4��H��	�t�y�1�}�}��4��y��D�I��&�'�1�1r0c�f�		|jt|j��zdz
S#t$rYdSwxYw)Nr1r()r�r�rDrxr�s r.r�zDecimal.adjustedesF��2�	��9�s�4�9�~�~�-��1�1���	�	�	��1�1�	���s�"�
0�0c��	|Sr+r,r�s r.�	canonicalzDecimal.canonicalms��	�
�r0c��	t|d���}|�||��}|r|S|�||���S�NTr�ro)r�r�r�r�s    r.�compare_signalzDecimal.compare_signalusS��	�
�u��5�5�5���&�&�u�g�6�6���	��J��|�|�E�7�|�3�3�3r0c�V�	t|d���}|jr|jstS|js|jrtS|j}|���}|���}|s|r�||krit|j��|jf}t|j��|jf}||kr|rtStS||kr|rtStStS|r5|dkrtS|dkrtS|dkrtS|dkrtSn4|dkrtS|dkrtS|dkrtS|dkrtS||krtS||krtS|j|jkr|rtStS|j|jkr|rtStStS)NTr�r1r�)	r�rC�_NegativeOner�r�r�rD�_Zeror�)r5r�r6rP�self_nan�	other_nan�self_key�	other_keys        r.r�zDecimal.compare_total�s���	��u�d�3�3�3���:�	 �e�k�	 ����z�	�e�k�	��K��z���;�;�=�=���L�L�N�N�	��"	(�y�"	(��9�$�$��t�y�>�>�4�9�4����
�O�O�U�Z�7�	��i�'�'��,�#��+�+��i�'�'��$�+�+�#�����
(��q�=�=�'�'���>�>��K��q�=�=�'�'���>�>��K�"��q�=�=��K���>�>�'�'��q�=�=��K���>�>�'�'��%�<�<����%�<�<��K��9�u�z�!�!��
$���#�#��9�u�z�!�!��
�#�#����r0c��	t|d���}|���}|���}|�|��Sr�)r�rr�)r5r�r6rY�os     r.�compare_total_magzDecimal.compare_total_mag�sI��	��u�d�3�3�3���M�M�O�O���N�N�������q�!�!�!r0c�F�	td|j|j|j��Sr`)rBrDr�r�r�s r.rzDecimal.copy_abs�s ��5���4�9�d�i��9I�J�J�Jr0c��	|jr!td|j|j|j��Std|j|j|j��S)Nr(r1)rCrBrDr�r�r�s r.rzDecimal.copy_negate�sF��4��:�	O�#�A�t�y�$�)�T�=M�N�N�N�#�A�t�y�$�)�T�=M�N�N�Nr0c�r�	t|d���}t|j|j|j|j��Sr�)r�rBrCrDr�r�r�s   r.�	copy_signzDecimal.copy_sign�s;��2��u�d�3�3�3�����T�Y� $�	�4�+;�=�=�	=r0c�*�	|�t��}|�|���}|r|S|���dkrtS|stS|���dkrt|��S|j}|���}|jdkrF|tt|jdzdz����krtdd|jdz��}�nb|jdkr`|tt|�
��dzdz����kr'tdd|�
��dz
��}n�|jdkr&||krtddd|dz
zzdz|��}n�|jdkr&||dz
krtdd|dzz|dz
��}n�t|��}|j|j}}|jdkr|}d}	t%||||z��\}	}
|	d
dtt|	����|z
dz
zzzrn|dz
}�Itdt|	��|
��}|���}|�t*��}|�|��}||_|S)Nror�r1r(r�r0r�r]Tr�r�)rr�r�r�r�rr_r�rCr�r�r`rBr5r�r�r�rP�_dexpr�r�rrr^)r5r6rGr��adjr�r�rr�r�r�r^s            r.r�zDecimal.exp�s��� ��?� �l�l�G����w��/�/���	��J�������#�#��L��	��K�������"�"��4�=�=� �
�L���m�m�o�o���:��?�?�s�S��g�l�1�n�a�-?�)@�)@�%A�%A�A�A�"�1�c�7�<��>�:�:�C�C�
�Z�1�_�_��s�3������0@��0B�A�/E�+F�+F�'G�'G�!G�!G�"�1�c�7�=�=�?�?�1�+<�=�=�C�C�
�Z�1�_�_���r���"�1�c�C��1��I�o��&;�a�R�@�@�C�C�
�Z�1�_�_���r�!�t���"�1�c�1�Q�3�i�!��A��6�6�C�C��$���B��6�2�6�q�A��w�!�|�|��B��
�E�
�"�1�a��5��1�1�
��s��A�b�3�s�5�z�z�?�?�1�#4�Q�#6�7�7�8�����
��	
�#�1�c�%�j�j�#�6�6�C��'�'�)�)���(�(��9�9���h�h�w����#����
r0c��	dS)NTr,r�s r.�is_canonicalzDecimal.is_canonical1s��	�
�tr0c��	|jSr+)r�r�s r.�	is_finitezDecimal.is_finite9s��	�
�#�#�#r0c��	|jdkS)Nr��r�r�s r.r�zDecimal.is_infiniteAs��F��y�C��r0c��	|jdvS)Nr�rr�s r.r�zDecimal.is_nanEs��L��y�J�&�&r0c�t�	|js|sdS|�t��}|j|���kS�NF)r�rrer�rs  r.�	is_normalzDecimal.is_normalIs?��M���	�4�	��5��?� �l�l�G��|�t�}�}���.�.r0c��	|jdkS)NrArr�s r.r�zDecimal.is_qnanQs��I��y�C��r0c��	|jdkS�Nr1)rCr�s r.�	is_signedzDecimal.is_signedUs��F��z�Q��r0c��	|jdkS)Nr�rr�s r.r�zDecimal.is_snanYs��M��y�C��r0c�t�	|js|sdS|�t��}|���|jkSr)r�rr�rers  r.�is_subnormalzDecimal.is_subnormal]s?��G���	�4�	��5��?� �l�l�G��}�}�����-�-r0c�*�	|jo
|jdkSr�r�r�s r.�is_zerozDecimal.is_zeroes��D��#�#�8��	�S�(8�8r0c�"�	|jt|j��zdz
}|dkr%tt|dzdz����dz
S|dkr(ttd|z
dzdz����dz
St	|��}|j|j}}|dkrKt|d|zz
��}t|��}t|��t|��z
||kz
S|ttd|z|z
����zdz
S)Nr1�r�r�r�r(�r�r�rDr�r�r�r��r5r	r�r�r�num�dens       r.�
_ln_exp_boundzDecimal._ln_exp_boundis��	��i�#�d�i�.�.�(�1�,���!�8�8��s�3�r�6�2�:���'�'�!�+�+��"�9�9��s�B�s�F�B�;��?�+�+�,�,�q�0�0�
�d�^�^���v�r�v�1���!�8�8��a��Q�B��h�-�-�C��a�&�&�C��s�8�8�c�#�h�h�&�#��)�4�4��3�s�2��r�6�A�:���'�'�'�!�+�+r0c
�H�	|�t��}|�|���}|r|S|stS|���dkrtS|t
krtS|jdkr|�td��St|��}|j|j}}|j
}||���z
dz}	t|||��}|ddt!t#t%|������|z
dz
zzzrn|dz
}�Pt't|d	k��t#t%|����|��}|���}|�t,��}	|�|��}|	|_|S)
Nror1zln of a negative valuer�Tr�r�r�r()rr��_NegativeInfinityr��	_Infinityr�r�rCr�r
r�r�r�r_r#�_dlogr�r�r�rBr�r�rrr^�
r5r6rGr�r�rr�r�r�r^s
          r.�lnz
Decimal.ln�s���=��?� �l�l�G����w��/�/���	��J��	%�$�$�������"�"����4�<�<��L��:��?�?��'�'�(8�(@�B�B�
B��d�^�^���v�r�v�1���L���T�'�'�)�)�)�A�-��	��!�Q��'�'�E���"�s�3�s�5�z�z�?�?�3�3�A�5�a�7�8�8�9�
���a�K�F�	��s�5��7�|�|�S��U���_�_�v�g�F�F���'�'�)�)���(�(��9�9���h�h�w����#����
r0c�(�	|jt|j��zdz
}|dkrtt|����dz
S|dkr"ttd|z
����dz
St	|��}|j|j}}|dkrQt|d|zz
��}td|z��}t|��t|��z
||kz
dzStd|z|z
��}t|��|z|dkz
dz
S)	Nr1r�r�r(r���r��231rr s       r.r�zDecimal._log10_exp_bound�s��	��i�#�d�i�.�.�(�1�,���!�8�8��s�3�x�x�=�=��?�"��"�9�9��s�2�c�6�{�{�#�#�A�%�%�
�d�^�^���v�r�v�1���!�8�8��a��Q�B��h�-�-�C��c�!�e�*�*�C��s�8�8�c�#�h�h�&�#��)�4�q�8�8��"�q�b�&��(�m�m���3�x�x�!�|�s�U�{�+�a�/�/r0c
��	|�t��}|�|���}|r|S|stS|���dkrtS|jdkr|�td��S|jddkrX|jdd�dt|j��dz
zkr-t|jt|j��zdz
��}n�t|��}|j
|j}}|j}||���z
dz}	t#|||��}|d	d
tt%t'|������|z
dz
zzzrn|dz
}�Pt)t|dk��t%t'|����|��}|���}|�t.��}	|�|��}|	|_|S)Nror1zlog10 of a negative valuer(r0r�r�Tr�r�r�)rr�r%r�r&rCr�r
rDr�rr�r�r�r�r_r��_dlog10r�r�rBr�r�rrr^r(s
          r.�log10z
Decimal.log10�s���4��?� �l�l�G����w��/�/���	��J��	%�$�$�������"�"����:��?�?��'�'�(8�(C�E�E�
E��9�Q�<�3���4�9�Q�R�R�=�C��T�Y���!�9K�4L�#L�#L��$�)�c�$�)�n�n�4�q�8�9�9�C�C��$���B��6�2�6�q�A���A��t�,�,�.�.�.�q�0�F�
���1�f�-�-���A�b�3�s�3�u�:�:���#7�#7��#9�!�#;�<�<�=����!���
�#�3�u�Q�w�<�<��S��Z�Z���6�'�J�J�C��'�'�)�)���(�(��9�9���h�h�w����#����
r0c�6�	|�|���}|r|S|�t��}|���rtS|s|�t
dd��St
|�����}|�|��S)Nrozlogb(0)r1)	r�rr�r&r�rrr�rrs   r.�logbzDecimal.logb
s���	����w��/�/���	��J��?� �l�l�G������	����	F��'�'��	�1�E�E�E�
�d�m�m�o�o�&�&���x�x�� � � r0c�Z�	|jdks|jdkrdS|jD]	}|dvrdS�
dS)Nr(F�01T)rCr�rD)r5�digs  r.�
_islogicalzDecimal._islogical#
sN��	��:��?�?�d�i�1�n�n��5��9�	�	�C��$����u�u���tr0c��|jt|��z
}|dkr	d|z|z}n|dkr||jd�}|jt|��z
}|dkr	d|z|z}n|dkr||jd�}||fS)Nr(r�)r_r�)r5r6�opa�opb�difs     r.�
_fill_logicalzDecimal._fill_logical1
s����l�S��X�X�%����7�7��c�'�C�-�C�C�
�1�W�W��w�|�m�n�n�%�C��l�S��X�X�%����7�7��c�'�C�-�C�C�
�1�W�W��w�|�m�n�n�%�C��C�x�r0c��	|�t��}t|d���}|���r|���s|�t��S|�||j|j��\}}d�d�t||��D����}td|�
d��pdd��S)NTr�r�c�l�g|]1\}}tt|��t|��z����2Sr,�r�r���.0r��bs   r.�
<listcomp>z'Decimal.logical_and.<locals>.<listcomp>L
�4��E�E�E���1�#�c�!�f�f�S��V�V�m�,�,�E�E�Er0r(r��rr�r5r�r
r:rDr��ziprBr��r5r�r6r7r8r�s      r.�logical_andzDecimal.logical_and>
����I��?� �l�l�G��u�d�3�3�3����� � �	:��(8�(8�(:�(:�	:��'�'�(8�9�9�9��'�'����E�J�G�G�
��c����E�E��C����E�E�E�F�F����6�=�=��#5�#5�#<��a�@�@�@r0c�~�	|�t��}|�tdd|jzd��|��S)Nr(r0)r�logical_xorrBr_rs  r.�logical_invertzDecimal.logical_invertO
sD��$��?� �l�l�G���� 0��3�w�|�3C�A� F� F� '�)�)�	)r0c��	|�t��}t|d���}|���r|���s|�t��S|�||j|j��\}}d�d�t||��D����}td|�
d��pdd��S)NTr�r�c�l�g|]1\}}tt|��t|��z����2Sr,r=r>s   r.rAz&Decimal.logical_or.<locals>.<listcomp>d
rBr0r(r�rCrEs      r.�
logical_orzDecimal.logical_orV
s���H��?� �l�l�G��u�d�3�3�3����� � �	:��(8�(8�(:�(:�	:��'�'�(8�9�9�9��'�'����E�J�G�G�
��c����E�E��C����E�E�E�F�F����6�=�=��#5�#5�#<��a�@�@�@r0c��	|�t��}t|d���}|���r|���s|�t��S|�||j|j��\}}d�d�t||��D����}td|�
d��pdd��S)NTr�r�c�l�g|]1\}}tt|��t|��z����2Sr,r=r>s   r.rAz'Decimal.logical_xor.<locals>.<listcomp>u
rBr0r(r�rCrEs      r.rIzDecimal.logical_xorg
rGr0c�R�	t|d���}|�t��}|js|jr�|���}|���}|s|rX|dkr|dkr|�|��S|dkr|dkr|�|��S|�||��S|����|�����}|dkr|�|��}|dkr|}n|}|�|��Sr��	r�rr�r�rr�rr�r�r�s       r.�max_magzDecimal.max_magx
s)��F��u�d�3�3�3���?� �l�l�G���
	8�u�0�
	8������B������B��
8�R�
8���7�7�r�Q�w�w��9�9�W�-�-�-���7�7�r�Q�w�w� �:�:�g�.�.�.��'�'��w�7�7�7��M�M�O�O� � ����!1�!1�2�2����6�6��"�"�5�)�)�A���7�7��C�C��C��x�x�� � � r0c�R�	t|d���}|�t��}|js|jr�|���}|���}|s|rX|dkr|dkr|�|��S|dkr|dkr|�|��S|�||��S|����|�����}|dkr|�|��}|dkr|}n|}|�|��Sr�rQr�s       r.�min_magzDecimal.min_mag�
s)��F��u�d�3�3�3���?� �l�l�G���
	8�u�0�
	8������B������B��
8�R�
8���7�7�r�Q�w�w��9�9�W�-�-�-���7�7�r�Q�w�w� �:�:�g�.�.�.��'�'��w�7�7�7��M�M�O�O� � ����!1�!1�2�2����6�6��"�"�5�)�)�A���7�7��C�C��C��x�x�� � � r0c�N�	|�t��}|�|���}|r|S|���dkrtS|���dkr+t	dd|jz|�����S|���}|�t��|�
��|�|��}||kr|S|�t	dd|�
��dz
��|��S)Nror�r1r(r]r0)rr�r�r%rBr_rmrqr�r�_ignore_all_flagsrr,r5�r5r6rG�new_selfs    r.�
next_minuszDecimal.next_minus�
s��K��?� �l�l�G����w��/�/���	��J�������#�#�$�$�������"�"�#�A�s�7�<�'7������H�H�H��,�,�.�.�����k�*�*�*��!�!�#�#�#��9�9�W�%�%���t����O��|�|�,�Q��W�]�]�_�_�Q�5F�G�G�#�%�%�	%r0c�N�	|�t��}|�|���}|r|S|���dkrtS|���dkr+t	dd|jz|�����S|���}|�t��|�
��|�|��}||kr|S|�t	dd|�
��dz
��|��S)Nror1r�r]r(r0)rr�r�r&rBr_rmrqr�rrVrr*r5rWs    r.�	next_pluszDecimal.next_plus�
s��K��?� �l�l�G����w��/�/���	��J�������"�"���������#�#�#�A�s�7�<�'7������H�H�H��,�,�.�.�����m�,�,�,��!�!�#�#�#��9�9�W�%�%���t����O��|�|�,�Q��W�]�]�_�_�Q�5F�G�G�#�%�%�	%r0c�V�	t|d���}|�t��}|�||��}|r|S|�|��}|dkr|�|��S|dkr|�|��}n|�|��}|���rV|�td|j
��|�t��|�t��n�|�
��|jkr�|�t��|�t ��|�t��|�t��|s|�t"��|S)NTr�r(r�z Infinite result from next_toward)r�rr�r�rr[rYr�r�rrCrr
r�rerrr	)r5r�r6rG�
comparisons     r.�next_towardzDecimal.next_toward�
s���	��u�d�3�3�3���?� �l�l�G����u�g�.�.���	��J��Y�Y�u�%�%�
���?�?��>�>�%�(�(�(������.�.��)�)�C�C��/�/�'�*�*�C��?�?���	.�� � ��!C�!$��
,�
,�
,�
� � ��)�)�)�� � ��)�)�)�)�
�\�\�^�^�g�l�
*�
*�� � ��+�+�+�� � ��+�+�+�� � ��)�)�)�� � ��)�)�)��
.��$�$�W�-�-�-��
r0c�Z�	|���rdS|���rdS|���}|dkrdS|dkrdS|���r|jrdSdS|�t��}|�|�	��r|jrd
SdS|jrdSd
S)Nr�rr1z	+Infinityr�z	-Infinityz-Zeroz+Zeroroz
-Subnormalz
+Subnormalz-Normalz+Normal)r�r�r�rrCrr)r5r6�infs   r.�number_classzDecimal.number_classs���
	��<�<�>�>�	��6��<�<�>�>�	��5���� � ���!�8�8��;��"�9�9��;��<�<�>�>�	��z�
��w��w��?� �l�l�G����W��-�-�	$��z�
$�#�|�#�|��:�	��9��9r0c�"�	td��S�Nr�rar�s r.�radixz
Decimal.radix:s��5��r�{�{�r0c��	|�t��}t|d���}|�||��}|r|S|jdkr|�t
��S|jt|��cxkr|jksn|�t
��S|���rt|��St|��}|j
}|jt|��z
}|dkr	d|z|z}n|dkr||d�}||d�|d|�z}t|j
|�d��pd|j��S�NTr�r(r��rr�r�r�r�r
r_r�r�rrDr�rBrCr�)r5r�r6rG�torot�rotdig�topad�rotateds        r.�rotatezDecimal.rotate>sk��C��?� �l�l�G��u�d�3�3�3�����u�g�.�.���	��J��:��?�?��'�'�(8�9�9�9���
��U���;�;�;�;�w�|�;�;�;�;��'�'�(8�9�9�9������	!��4�=�=� ��E�
�
�������s�6�{�{�*���1�9�9���Y��'�F�F�
�Q�Y�Y��U�F�G�G�_�F�����.�6�&�5�&�>�1����
� '���s� 3� 3� :�s�D�I�G�G�	Gr0c�L�	|�t��}t|d���}|�||��}|r|S|jdkr|�t
��Sd|j|jzz}d|j|jzz}|t|��cxkr|ksn|�t
��S|�	��rt|��St|j|j
|jt|��z��}|�|��}|S)NTr�r(r�r�)rr�r�r�r�r
r`r_r�r�rrBrCrDr)r5r�r6rG�liminf�limsupr�s       r.�scalebzDecimal.scaleb_s��L��?� �l�l�G��u�d�3�3�3�����u�g�.�.���	��J��:��?�?��'�'�(8�9�9�9��w�|�g�l�2�3���w�|�g�l�2�3���#�e�*�*�.�.�.�.��.�.�.�.��'�'�(8�9�9�9������	!��4�=�=� ��T�Z���D�I��E�
�
�4J�K�K��
�F�F�7�O�O���r0c���	|�t��}t|d���}|�||��}|r|S|jdkr|�t
��S|jt|��cxkr|jksn|�t
��S|���rt|��St|��}|j
}|jt|��z
}|dkr	d|z|z}n|dkr||d�}|dkr|d|�}n|d|zz}||jd�}t|j
|�d��pd|j��Srfrg)r5r�r6rGrhrirj�shifteds        r.r7z
Decimal.shiftxs���C��?� �l�l�G��u�d�3�3�3�����u�g�.�.���	��J��:��?�?��'�'�(8�9�9�9���
��U���;�;�;�;�w�|�;�;�;�;��'�'�(8�9�9�9������	!��4�=�=� ��E�
�
�������s�6�{�{�*���1�9�9���Y��'�F�F�
�Q�Y�Y��U�F�G�G�_�F��1�9�9��V�e�V�n�G�G��s�5�y�(�G��w�|�m�n�n�-�G���
�$+�N�N�3�$7�$7�$>�3��	�K�K�	Kr0c�0�|jt|��ffSr+)�	__class__r�r�s r.�
__reduce__zDecimal.__reduce__�s�����T����-�-r0c�v�t|��tur|S|�t|����Sr+��typerrtr�r�s r.�__copy__zDecimal.__copy__��0����:�:�� � ��K��~�~�c�$�i�i�(�(�(r0c�v�t|��tur|S|�t|����Sr+rw)r5�memos  r.�__deepcopy__zDecimal.__deepcopy__�rzr0c��	|�t��}t||���}|jrXt|j|��}t|�����}|ddkr|dz
}t|||��S|d�ddg|j|d<|ddkr#t|j|j
|jdz��}|j}|d}|�~|ddvr|�
|d	z|��}nZ|dd
vr|�||��}n8|ddvr.t|j
��|kr|�
||��}|s+|jdkr |dd
vr|�d|��}|s|d
r
|jrd}	n|j}	|jt|j
��z}
|ddvr
|s|�d	|z
}n0d	}n-|dd
vr|
}n |ddvr|jdkr	|
dkr|
}nd	}|dkrd}d|z|j
z}
n]|t|j
��kr%|j
d|t|j
��z
zz}d}
n |j
d|�pd}|j
|d�}
|
|z
}t!|	||
||��S)N)�_localeconvrx�%�g�Gr��	precision�eEr1zfF%�gGr(�no_neg_0rr�r�)r�_parse_format_specifierr��_format_signrCr�r�
_format_alignrfrBrDr�r^r�r%r��_format_number)r5�	specifierr6r�specrP�bodyr^r��
adjusted_signrrr�r�r�s               r.�
__format__zDecimal.__format__�s���	��?� �l�l�G�&�y�k�J�J�J����	3���
�D�1�1�D��t�}�}���'�'�D��F�|�s�"�"����� ��t�T�2�2�2���<����:�g�&6�7�D��L���<�3���#�D�J��	�4�9�Q�;�G�G�D��#����%�	�� ��F�|�t�#�#��{�{�9�Q�;��9�9����f���&�&��}�}�i�Z��:�:����f���%�%�#�d�i�.�.�9�*D�*D��{�{�9�h�7�7���	.��	�A�
�
�$�v�,�%�*?�*?��=�=��H�-�-�D��	'��Z�(�	'�T�Z�	'��M�M� �J�M��Y��T�Y���/�
���<�4����
�I�1��y�=������
�&�\�U�
"�
"�!�H�H�
�&�\�T�
!�
!��y�A�~�~�*�r�/�/�%������a�<�<��G��X�I����2�H�H�
��D�I���
&�
&��i�#�x��D�I���'>�"?�?�G��H�H��i�	��	�*�1�c�G��y����+�H���!���m�W�h��T�J�J�Jr0)r�N)NNr+)FN)TN)�r9r:r;�	__slots__r��classmethodr�r�r�r�r�r�r�r�r�r�r�r�r�r�rr�rrrrrr"r*�__radd__r,r.r3�__rmul__r:r?rArGrIrKrMrQrSrUrZr\�	__trunc__�propertyr^rbrdrgrErrxrzr}r�r�r�r�r��dictrnr�r�r�r�r�r�r�r�r�r�r�r%r�r�r��to_integralr�r$rr�r�r�r�r�r�rrrrr�rr
r�r�rr�rr�rrr#r)r�r/r1r5r:rFrJrMrIrRrTrYr[r^rardrlrpr7ruryr}r�r,r0r.rrs	������6�6�I�T@�T@�T@�T@�l�*�*��[�*�X
�
�
��������@���B4�4�4�-'�-'�-'�@%�%�%�%�$�$�$�$�%�%�%�%�$�$�$�$�%�%�%�%�)�)�)�)�$(�(�(�4O�O�O�0�0�0�d+�+�+�
2/�2/�2/�2/�h7�7�7�7�!�!�!�!�,!�!�!�!�*����,T�T�T�T�l�H�B�B�B�B�4�4�4�4�6�6�6�6�n�H�9!�9!�9!�9!�v���B8�8�8�8�"#�"#�"#�"#�H7�7�7�7�����64�4�4�4�I!�I!�I!�I!�V/�/�/�/�89�9�9�9����7�7�7��I�
����X������X�����$�$�$�
�
�
�Z�Z�Z�L���'�'�'����-�-�-�-�-�-�+�+�+�+�+�+�+�+�+�#�d� ��&�*�*�&�"� �	�	�	��<6�<6�<6�<6�|
2�
2�
2�
4�
4�
4�*/�*/�*/�*/�XS4�S4�S4�S4�jk?�k?�k?�ZV�V�V�V�p4�4�4�4�@�@�@�@�2;�;�;�;�z
'�
'�
'�
'� 8� 8� 8�D���.����:.�.�.�.�"$�K�a�a�a�a�F(!�(!�(!�(!�T !� !� !� !�D%�%�%�2�2�2�������
4�
4�
4�
4�F�F�F�F�R	"�	"�	"�	"�K�K�K�O�O�O�=�=�=�=�I�I�I�I�V���$�$�$� � � �'�'�'�/�/�/�/� � � ���� � � �.�.�.�.�9�9�9�,�,�,�20�0�0�0�d0�0�0�<1�1�1�1�f!�!�!�!�<������A�A�A�A�")�)�)�)�A�A�A�A�"A�A�A�A�"!�!�!�!�<!�!�!�!�<%�%�%�%�.%�%�%�%�.,�,�,�,�\(�(�(�(�T���G�G�G�G�B����2$K�$K�$K�$K�N.�.�.�)�)�)�
)�)�)�TK�TK�TK�TK�TK�TKr0rFc�~�	t�t��}||_||_||_||_|Sr+)r�r�rrCrDr�r�)rP�coefficientr��specialr5s     r.rBrBs<����>�>�'�"�"�D��D�J��D�I��D�I��D���Kr0c�"�eZdZ	d�Zd�Zd�ZdS)ruc�8�|���|_dSr+)rqrz)r5rzs  r.�__init__z_ContextManager.__init__"s��&�+�+�-�-����r0c�^�t��|_t|j��|jSr+)r�
saved_contextrrzr�s r.�	__enter__z_ContextManager.__enter__$s(��'�\�\����4�#�$�$�$���r0c�.�t|j��dSr+)rr�)r5�t�v�tbs    r.�__exit__z_ContextManager.__exit__(s���4�%�&�&�&�&�&r0N)r9r:r;r�r�r�r,r0r.rurusF�������
.�.�.� � � �'�'�'�'�'r0ruc��eZdZ				dTd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
e
ZdUd
�Zd�Zd�Zd�ZdZd�Zd�Zd�ZdVd�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/�Z1d0�Z2d1�Z3d2�Z4d3�Z5d4�Z6d5�Z7d6�Z8d7�Z9d8�Z:d9�Z;d:�Z<d;�Z=d<�Z>d=�Z?d>�Z@d?�ZAd@�ZBdA�ZCdB�ZDdC�ZEdD�ZFdUdE�ZGdF�ZHdG�ZIdH�ZJdI�ZKdJ�ZLdK�ZMdL�ZNdM�ZOdN�ZPdO�ZQdP�ZRdQ�ZSdR�ZTdS�ZUeUZVdS)WrNc
�����	t}
n#t$rYnwxYw|�|n|
j|_|�|n|
j|_|�|n|
j|_|�|n|
j|_|�|n|
j|_|�|n|
j|_|	�g|_n|	|_��|
j	�
��|_	nEt�t��s)t�fd�t�zD����|_	n�|_	��'t�td��|_dSt�t��s*t�fd�t�zD����|_dS�|_dS)Nc3�>�K�|]}|t|�v��fV��dSr+�r�)r?rYris  �r.�	<genexpr>z#Context.__init__.<locals>.<genexpr>W�2�����M�M�q�q�#�a�5�j�/�/�2�M�M�M�M�M�Mr0r(c3�>�K�|]}|t|�v��fV��dSr+r�)r?rYrhs  �r.r�z#Context.__init__.<locals>.<genexpr>^r�r0)r�	NameErrorr_r^rer`rfrg�_ignored_flagsrirqr�r�r��fromkeysrh)r5r_r^rer`rfrgrhrir��dcs       ``  r.r�zContext.__init__>s{����
	��B�B���	�	�	��D�	����!�,�D�D�"�'��	�$,�$8���b�k��
� �,�D�D�"�'��	� �,�D�D�"�'��	�$,�$8���b�k��
�#�/�U�U�R�X��
��!�"$�D���"0�D���=�������D�J�J��E�4�(�(�	��M�M�M�M�H�u�<L�M�M�M�M�M�D�J�J��D�J��=����x��3�3�D�J�J�J��E�4�(�(�	��M�M�M�M�H�u�<L�M�M�M�M�M�D�J�J�J��D�J�J�Js��
�c�X�t|t��std|z���|dkr||krtd||||fz���nE|dkr||krtd||||fz���n"||ks||krtd||||fz���t�|||��S)Nz%s must be an integer�-infz%s must be in [%s, %d]. got: %sr`z%s must be in [%d, %s]. got: %sz%s must be in [%d, %d]. got %s)r�r�rxr�r��__setattr__)r5�namer�vmin�vmaxs     r.�_set_integer_checkzContext._set_integer_checkbs����%��%�%�	<��3�d�:�;�;�;��6�>�>��t�|�|� �!B�d�D�RV�X]�E^�!^�_�_�_��
�U�]�]��t�|�|� �!B�d�D�RV�X]�E^�!^�_�_�_���t�|�|�u�t�|�|� �!A�T�4�QU�W\�D]�!]�^�^�^��!�!�$��e�4�4�4r0c��t|t��std|z���|D]}|tvrt	d|z����tD]}||vrt	d|z����t
�|||��S)Nz%s must be a signal dictz%s is not a valid signal dict)r�r�rxr��KeyErrorr�r�)r5r�r�r~s    r.�_set_signal_dictzContext._set_signal_dictps����!�T�"�"�	<��6��:�;�;�;��	D�	D�C��(�?�?��>��B�C�C�C�#��	D�	D�C��!�8�8��>��B�C�C�C���!�!�$��a�0�0�0r0c�T�|dkr|�||dd��S|dkr|�||dd��S|dkr|�||dd��S|dkr|�||dd��S|d	kr|�||dd��S|d
kr7|tvrtd|z���t�|||��S|dks|d
kr|�||��S|dkrt�|||��St
d|z���)Nr_r1r`rer�r(r`rfrgr^z%s: invalid rounding moderhrir�z.'decimal.Context' object has no attribute '%s')r��_rounding_modesrxr�r�r��AttributeError)r5r�rs   r.r�zContext.__setattr__{s_���6�>�>��*�*�4���5�A�A�A�
�V�^�^��*�*�4����B�B�B�
�V�^�^��*�*�4���5�A�A�A�
�Z�
�
��*�*�4���1�=�=�=�
�W�_�_��*�*�4���1�=�=�=�
�Z�
�
��O�+�+� � ;�e� C�D�D�D��%�%�d�D�%�8�8�8�
�W�_�_������(�(��u�5�5�5�
�%�
%�
%��%�%�d�D�%�8�8�8� �@�4�G�I�I�
Ir0c�&�td|z���)Nz%s cannot be deleted)r�)r5r�s  r.�__delattr__zContext.__delattr__�s���3�d�:�;�;�;r0c	���d�|j���D��}d�|j���D��}|j|j|j|j|j|j|j	||ffS)Nc��g|]	\}}|�|��
Sr,r,�r?�sigr�s   r.rAz&Context.__reduce__.<locals>.<listcomp>��!��;�;�;���a��;��;�;�;r0c��g|]	\}}|�|��
Sr,r,r�s   r.rAz&Context.__reduce__.<locals>.<listcomp>�r�r0)
rhrvrirtr_r^rer`rfrg)r5rhris   r.ruzContext.__reduce__�sv��;�;�4�:�#3�#3�#5�#5�;�;�;��;�;�4�:�#3�#3�#5�#5�;�;�;������D�M�4�9�d�i����
�E�5�:�;�	;r0c���	g}|�dt|��z��d�|j���D��}|�dd�|��zdz��d�|j���D��}|�dd�|��zdz��d�|��dzS)	NzrContext(prec=%(prec)d, rounding=%(rounding)s, Emin=%(Emin)d, Emax=%(Emax)d, capitals=%(capitals)d, clamp=%(clamp)dc�&�g|]\}}|�|j��Sr,�r9)r?r�r�s   r.rAz$Context.__repr__.<locals>.<listcomp>��#��@�@�@���1�a�@���@�@�@r0zflags=[�, �]c�&�g|]\}}|�|j��Sr,r�)r?r�r�s   r.rAz$Context.__repr__.<locals>.<listcomp>�r�r0ztraps=[�))r��varsrhrvr�ri)r5rY�namess   r.rzContext.__repr__�s���'���	���#���:�:��	�	�	�A�@��
�(8�(8�(:�(:�@�@�@��	����T�Y�Y�u�-�-�-��3�4�4�4�@�@��
�(8�(8�(:�(:�@�@�@��	����T�Y�Y�u�-�-�-��3�4�4�4��y�y��|�|�c�!�!r0c�0�	|jD]}d|j|<�
dSr`)rh�r5�flags  r.rrzContext.clear_flags��/��%��J�	!�	!�D� �D�J�t���	!�	!r0c�0�	|jD]}d|j|<�
dSr`)rir�s  r.�clear_trapszContext.clear_traps�r�r0c��	t|j|j|j|j|j|j|j|j|j	�	�	}|Sr+)
rr_r^rer`rfrgrhrir��r5�ncs  r.r�zContext._shallow_copy�sB��/�
�T�Y��
�t�y�$�)��]�D�J��
�D�J��(�*�*���	r0c���	t|j|j|j|j|j|j|j���|j	���|j
�	�	}|Sr+)rr_r^rer`rfrgrhrqrir�r�s  r.rqzContext.copy�sW��,�
�T�Y��
�t�y�$�)��]�D�J��Z�_�_�&�&��
���(9�(9��(�*�*���	r0c���	t�||��}||jvr|��j|g|�R�Sd|j|<|j|s|��j|g|�R�S||���r)�_condition_maprlr�r7rhri)r5�	condition�explanationr-�errors     r.r�zContext._raise_error�s���	��"�"�9�i�8�8���D�'�'�'�!�5�5�7�7�>�$�.��.�.�.�.���
�5���z�%� �	3�%�9�9�;�;�%�d�2�T�2�2�2�2��e�K� � � r0c�"�	|jt�Sr+)�
_ignore_flagsr�r�s r.rVzContext._ignore_all_flags�s��2�!�t�!�8�,�,r0c�Z�	|jt|��z|_t|��Sr+)r�r�)r5rhs  r.r�zContext._ignore_flags�s)��2� $�2�T�%�[�[�@����E�{�{�r0c��	|r*t|dttf��r|d}|D]}|j�|���dSr`)r�r�r�r��remove)r5rhr�s   r.�
_regard_flagszContext._regard_flags�sb��9��	�Z��a��5��,�7�7�	��!�H�E��	-�	-�D���&�&�t�,�,�,�,�	-�	-r0c�B�	t|j|jz
dz��Sr)r�rer_r�s r.r5z
Context.Etiny�s!��/��4�9�t�y�(�1�,�-�-�-r0c�B�	t|j|jz
dz��Sr)r�r`r_r�s r.rmzContext.Etop�s!��:��4�9�t�y�(�1�,�-�-�-r0c�$�	|j}||_|Sr+)r^)r5rxr^s   r.r�zContext._set_rounding�s��
	��=����
��r0r�c��	t|t��r7||���ksd|vr|�td��St||���}|���r@t|j��|j	|j
z
kr|�td��S|�|��S)Nr�zAtrailing or leading whitespace and underscores are not permitted.rozdiagnostic info too long in NaN)r�r�r�r�rrr�r�rDr_rgr)r5r!r�s   r.�create_decimalzContext.create_decimals���	&�
�c�3���	G�S�C�I�I�K�K�%7�%7�3�#�:�:��$�$�%5�&F�G�G�
G�
�C��&�&�&���8�8�:�:�	H�#�a�f�+�+��	�D�J�(>�>�>��$�$�%5�%F�H�H�
H��v�v�d�|�|�r0c�b�	t�|��}|�|��Sr+)rr�r)r5r�r�s   r.�create_decimal_from_floatz!Context.create_decimal_from_floats,��	�
���q�!�!���v�v�d�|�|�r0c�R�	t|d���}|�|���Sr�)r�r"�r5r�s  r.r�zContext.abs/s/��	�"
�1�d�+�+�+���y�y��y�&�&�&r0c��	t|d���}|�||���}|turtd|z���|S�NTr�ro�Unable to convert %s to Decimal)r�r*r�rx�r5r�r@r>s    r.�addzContext.addDsT��	�
�1�d�+�+�+��
�I�I�a��I�&�&�������=��A�B�B�B��Hr0c�F�t|�|����Sr+)r�rr�s  r.�_applyzContext._applyYs���1�6�6�$�<�<� � � r0c�t�	t|t��std���|���S)Nz,canonical requires a Decimal as an argument.)r�rrxr�r�s  r.r�zContext.canonical\s9��	��!�W�%�%�	L��J�K�K�K��{�{�}�}�r0c�T�	t|d���}|�||���Sr�)r�r��r5r�r@s   r.r�zContext.compareis2��	�@
�1�d�+�+�+���y�y��D�y�)�)�)r0c�T�	t|d���}|�||���Sr�)r�r�r�s   r.r�zContext.compare_signal�s4��	�>
�1�d�+�+�+������4��0�0�0r0c�P�	t|d���}|�|��Sr�)r�r�r�s   r.r�zContext.compare_total�s-��	�2
�1�d�+�+�+�����q�!�!�!r0c�P�	t|d���}|�|��Sr�)r�rr�s   r.rzContext.compare_total_mag�s/��	�
�1�d�+�+�+���"�"�1�%�%�%r0c�N�	t|d���}|���Sr�)r�rr�s  r.rzContext.copy_abs�s)��	�
�1�d�+�+�+���z�z�|�|�r0c�D�	t|d���}t|��Sr�)r�rr�s  r.�copy_decimalzContext.copy_decimal�s'��	�
�1�d�+�+�+���q�z�z�r0c�N�	t|d���}|���Sr�)r�rr�s  r.rzContext.copy_negate�s)��	�
�1�d�+�+�+���}�}���r0c�P�	t|d���}|�|��Sr�)r�rr�s   r.rzContext.copy_sign�s+��	�(
�1�d�+�+�+���{�{�1�~�~�r0c��	t|d���}|�||���}|turtd|z���|Sr�)r�r:r�rxr�s    r.�dividezContext.dividesT��	�:
�1�d�+�+�+��
�M�M�!�T�M�*�*�������=��A�B�B�B��Hr0c��	t|d���}|�||���}|turtd|z���|Sr�)r�rSr�rxr�s    r.�
divide_intzContext.divide_int9sT��	�
�1�d�+�+�+��
�N�N�1�d�N�+�+�������=��A�B�B�B��Hr0c��	t|d���}|�||���}|turtd|z���|Sr�)r�rGr�rxr�s    r.r6zContext.divmodPsT��	�
�1�d�+�+�+��
�L�L��D�L�)�)�������=��A�B�B�B��Hr0c�R�	t|d���}|�|���Sr�)r�r�r�s  r.r�zContext.expes/��	�(�!�T�*�*�*���u�u�T�u�"�"�"r0c�V�	t|d���}|�|||���Sr�)r�r�)r5r�r@r�s    r.r�zContext.fma}s3��	�&
�1�d�+�+�+���u�u�Q��4�u�(�(�(r0c�t�	t|t��std���|���S)Nz/is_canonical requires a Decimal as an argument.)r�rrxrr�s  r.rzContext.is_canonical�s;��	��!�W�%�%�	O��M�N�N�N��~�~���r0c�N�	t|d���}|���Sr�)r�r
r�s  r.r
zContext.is_finite�s)��	�$
�1�d�+�+�+���{�{�}�}�r0c�N�	t|d���}|���Sr�)r�r�r�s  r.r�zContext.is_infinite�s)��
	�
�1�d�+�+�+���}�}���r0c�N�	t|d���}|���Sr�)r�r�r�s  r.r�zContext.is_nan�s)��	�
�1�d�+�+�+���x�x�z�z�r0c�R�	t|d���}|�|���Sr�)r�rr�s  r.rzContext.is_normal�s/��	�&
�1�d�+�+�+���{�{�4�{�(�(�(r0c�N�	t|d���}|���Sr�)r�r�r�s  r.r�zContext.is_qnan�s)��
	�
�1�d�+�+�+���y�y�{�{�r0c�N�	t|d���}|���Sr�)r�rr�s  r.rzContext.is_signed�s)��	�
�1�d�+�+�+���{�{�}�}�r0c�N�	t|d���}|���Sr�)r�r�r�s  r.r�zContext.is_snan
s)��	�
�1�d�+�+�+���y�y�{�{�r0c�R�	t|d���}|�|���Sr�)r�rr�s  r.rzContext.is_subnormals/��	�$
�1�d�+�+�+���~�~�d�~�+�+�+r0c�N�	t|d���}|���Sr�)r�rr�s  r.rzContext.is_zero3s)��	�
�1�d�+�+�+���y�y�{�{�r0c�R�	t|d���}|�|���Sr�)r�r)r�s  r.r)z
Context.lnDs/��	�$
�1�d�+�+�+���t�t�D�t�!�!�!r0c�R�	t|d���}|�|���Sr�)r�r/r�s  r.r/z
Context.log10Zs/��	�0
�1�d�+�+�+���w�w�t�w�$�$�$r0c�R�	t|d���}|�|���Sr�)r�r1r�s  r.r1zContext.logbvs/��	�,
�1�d�+�+�+���v�v�d�v�#�#�#r0c�T�	t|d���}|�||���Sr�)r�rFr�s   r.rFzContext.logical_and��1��	�.
�1�d�+�+�+���}�}�Q��}�-�-�-r0c�R�	t|d���}|�|���Sr�)r�rJr�s  r.rJzContext.logical_invert�s2��	�
�1�d�+�+�+�������-�-�-r0c�T�	t|d���}|�||���Sr�)r�rMr�s   r.rMzContext.logical_or�s1��	�.
�1�d�+�+�+���|�|�A�t�|�,�,�,r0c�T�	t|d���}|�||���Sr�)r�rIr�s   r.rIzContext.logical_xor�rr0c�T�	t|d���}|�||���Sr�)r�r$r�s   r.r$zContext.max��1��	�.
�1�d�+�+�+���u�u�Q��u�%�%�%r0c�T�	t|d���}|�||���Sr�)r�rRr�s   r.rRzContext.max_mag�1��	�
�1�d�+�+�+���y�y��D�y�)�)�)r0c�T�	t|d���}|�||���Sr�)r�rr�s   r.rzContext.min rr0c�T�	t|d���}|�||���Sr�)r�rTr�s   r.rTzContext.min_mag;rr0c�R�	t|d���}|�|���Sr�)r�rr�s  r.�minusz
Context.minusL�/��	�
�1�d�+�+�+���y�y��y�&�&�&r0c��	t|d���}|�||���}|turtd|z���|Sr�)r�r3r�rxr�s    r.�multiplyzContext.multiply]sT��	�0
�1�d�+�+�+��
�I�I�a��I�&�&�������=��A�B�B�B��Hr0c�R�	t|d���}|�|���Sr�)r�rYr�s  r.rYzContext.next_minus}s/��	� 
�1�d�+�+�+���|�|�D�|�)�)�)r0c�R�	t|d���}|�|���Sr�)r�r[r�s  r.r[zContext.next_plus�s/��	� 
�1�d�+�+�+���{�{�4�{�(�(�(r0c�T�	t|d���}|�||���Sr�)r�r^r�s   r.r^zContext.next_toward�s1��	�>
�1�d�+�+�+���}�}�Q��}�-�-�-r0c�R�	t|d���}|�|���Sr�)r�r�r�s  r.r�zContext.normalize�s/��	�(
�1�d�+�+�+���{�{�4�{�(�(�(r0c�R�	t|d���}|�|���Sr�)r�rar�s  r.razContext.number_class�s0��-	�\
�1�d�+�+�+���~�~�d�~�+�+�+r0c�R�	t|d���}|�|���Sr�)r�rr�s  r.�pluszContext.plusr!r0c��	t|d���}|�|||���}|turtd|z���|Sr�)r�r�r�rx)r5r�r@r�r>s     r.�powerz
Context.power#sX��G	�P
�1�d�+�+�+��
�I�I�a���I�.�.�������=��A�B�B�B��Hr0c�T�	t|d���}|�||���Sr�)r�r�r�s   r.r�zContext.quantizess2��5	�l
�1�d�+�+�+���z�z�!�T�z�*�*�*r0c�"�	td��Srcrar�s r.rdz
Context.radix�s��	�
�r�{�{�r0c��	t|d���}|�||���}|turtd|z���|Sr�)r�rKr�rxr�s    r.r8zContext.remainder�sT��	�<
�1�d�+�+�+��
�I�I�a��I�&�&�������=��A�B�B�B��Hr0c�T�	t|d���}|�||���Sr�)r�rQr�s   r.rQzContext.remainder_near�s4��	�<
�1�d�+�+�+������4��0�0�0r0c�T�	t|d���}|�||���Sr�)r�rlr�s   r.rlzContext.rotate�s1��	�2
�1�d�+�+�+���x�x��4�x�(�(�(r0c�P�	t|d���}|�|��Sr�)r�r�r�s   r.r�zContext.same_quantums-��	�(
�1�d�+�+�+���~�~�a� � � r0c�T�	t|d���}|�||���Sr�)r�rpr�s   r.rpzContext.scaleb2s1��	�
�1�d�+�+�+���x�x��4�x�(�(�(r0c�T�	t|d���}|�||���Sr�)r�r7r�s   r.r7z
Context.shiftEs1��	�4
�1�d�+�+�+���w�w�q�$�w�'�'�'r0c�R�	t|d���}|�|���Sr�)r�r�r�s  r.r�zContext.sqrtcs/��	�8
�1�d�+�+�+���v�v�d�v�#�#�#r0c��	t|d���}|�||���}|turtd|z���|Sr�)r�r,r�rxr�s    r.�subtractzContext.subtract�sT��	�
�1�d�+�+�+��
�I�I�a��I�&�&�������=��A�B�B�B��Hr0c�R�	t|d���}|�|���Sr�)r�rr�s  r.rzContext.to_eng_string�s/��	�0
�1�d�+�+�+�����t��,�,�,r0c�R�	t|d���}|�|���Sr�)r�rr�s  r.�
to_sci_stringzContext.to_sci_string�s/��	�
�1�d�+�+�+���y�y��y�&�&�&r0c�R�	t|d���}|�|���Sr�)r�r�r�s  r.r�zContext.to_integral_exact�s2��	�4
�1�d�+�+�+���"�"�4�"�0�0�0r0c�R�	t|d���}|�|���Sr�)r�r�r�s  r.r�zContext.to_integral_value�s2��	�2
�1�d�+�+�+���"�"�4�"�0�0�0r0)	NNNNNNNNNr+)r�)Wr9r:r;r�r�r�r�r�rurrrr�r�rqryr�rVr�r�r�r5rmr�r�r�r�r�r�r�r�r�r�rrr�rrrrr6r�r�rr
r�r�rr�rr�rrr)r/r1rFrJrMrIr$rRrrTr r#rYr[r^r�rar*r,r�rdr8rQrlr�rpr7r�r7rr:r�r�r�r,r0r.rr+s�������$BF�DH�&*�"�"�"�"�H5�5�5�	1�	1�	1�I�I�I�2<�<�<�;�;�;�"�"�"�!�!�!�
!�!�!�
�������H�!�!�!�!�,-�-�-����-�-�-��H�.�.�.�.�.�.����&����"���$'�'�'�*���*!�!�!����"*�"*�"*�H!1�!1�!1�F"�"�"�:&�&�&�������������0#�#�#�J���.���*#�#�#�0)�)�)�. � � ����,
�
�
���� )�)�)�.
�
�
����"��� ,�,�,�,���""�"�"�,%�%�%�8$�$�$�4.�.�.�6.�.�.�&-�-�-�6.�.�.�6&�&�&�6*�*�*�"&�&�&�6*�*�*�"'�'�'�"���@*�*�*�()�)�)�(!.�!.�!.�F)�)�)�00,�0,�0,�d'�'�'�"N�N�N�N�`8+�8+�8+�t���$�$�$�L 1� 1� 1�D)�)�)�:!�!�!�0)�)�)�&(�(�(�<$�$�$�@���.-�-�-�8'�'�'�1�1�1�<1�1�1�<$�K�K�Kr0rc� �eZdZdZdd�Zd�ZdS)r��rPr�r�Nc��|�d|_d|_d|_dSt|t��r3|j|_t|j��|_|j|_dS|d|_|d|_|d|_dS)Nr(r1r�)rPr�r�r�rrCrDr�)r5rs  r.r�z_WorkRep.__init__s~���=��D�I��D�H��D�H�H�H�
��w�
'�
'�	 ���D�I��5�:���D�H��z�D�H�H�H��a��D�I��Q�x�D�H��Q�x�D�H�H�Hr0c�8�d|j�d|j�d|j�d�S)N�(r�r�r>r�s r.rz_WorkRep.__repr__s#���!%����D�H�H�H�d�h�h�h�?�?r0r+)r9r:r;r�r�rr,r0r.r�r��sA������$�I�

 �
 �
 �
 �@�@�@�@�@r0r�c��	|j|jkr|}|}n|}|}tt|j����}tt|j����}|jt	d||z
dz
��z}||jzdz
|krd|_||_|xjd|j|jz
zzc_|j|_||fS)Nr�r�r1r�)r�r�r�r�r)r(r)r_�tmpr��tmp_len�	other_lenr�s        r.r&r&s�����w���������������#�c�g�,�,���G��C��	�N�N�#�#�I�

�'�C��G�d�N�Q�.�/�/�
/�C��5�9��q� �3�&�&���	���	��G�G�r�c�g��	�)�*�*�G�G��i�C�G���8�Or0c���	|dkrdS|dkr|d|zzStt|����}t|��t|�d����z
}||krdn|d|zzS)Nr(r�r�)r�r�r��rstrip)rAr�str_n�val_ns    r.r�r�6s���	�	�A�v�v��q�	
�a����2�q�5�y���C��F�F�����E�
�
�S����c�!2�!2�3�3�3����r�z�z�t�t�q�B���F�{�2r0c�v�	|dks|dkrtd���d}||kr||||zz
dz	}}||k�|S)Nr(z3Both arguments to _sqrt_nearest should be positive.r1)r�)rAr�r@s   r.�
_sqrt_nearestrKKs^���	�A�v�v��a����N�O�O�O��A�
�q�&�&��!�Q�B��E�'�1�*�1���q�&�&��Hr0c�H�	d|z||z	}}|d||dz
zz|dzz|kzS)Nr1r�r,)r�r7r@r=s    r.�_rshift_nearestrMZs?���
��:�q�E�z�q�A���1��!��9�
��1��%��)�*�*r0c�N�	t||��\}}|d|z|dzz|kzS)Nr�r1)r6)r�r@r=r>s    r.�_div_nearestrObs5����!�Q�<�<�D�A�q���!��q��s��a�� � r0r�c���	||z
}d}||krt|��||z
z|ks||kr�t|��||z
z	|kr~t||zdz|t||t||��zz|��z��}|dz
}||krt|��||z
z|k�_||krt|��||z
z	|k�~t	dtt
|����zd|zz��}t||��}t||��}t|dz
dd��D]&}t||��t||z|��z
}�'t||z|��S)Nr(r1���r�r�)r�rOrKrMr�r�r�r�)	r��M�Lr��R�T�yshift�wr�s	         r.�_ilogrXjs����:	
�!��A�	�A���6�6�c�!�f�f��!��m�q�(�(��q�5�5�S��V�V�q��s�]�a�'�'��!�A�#�!���]�1�a���1�0E�0E�.E�+F��J�J�J�
L�
L��	�Q���	
��6�6�c�!�f�f��!��m�q�(�(��q�5�5�S��V�V�q��s�]�a�'�'�

�S��S��V�V���_�q��s�
#�	$�	$�$�A�
�Q��
"�
"�F��Q����A�
�1�Q�3��2�
�
�;�;����A����f�Q�h��!:�!:�:�����!��Q���r0c��	|dz
}tt|����}||z||zdkz
}|dkrhd|z}||z|z
}|dkr	|d|zz}nt|d|z��}t||��}t	|��}t||z|��}||z}	nd}t|d|z��}	t|	|zd��S�Nr�r1r(r�r�)r�r�rOrX�
_log10_digits)
r�rr�r�r�rRr��log_d�log_10�log_tenpowers
          r.r.r.�s���:���F�A�	�C��F�F���A�	�!��q��s�a�x��A��1�u�u���E��
�a�C��E����6�6�
��Q��J�A�A��Q��Q�B��'�'�A��a������q�!�!���U�1�W�f�-�-����s�����#�A�r�A�2�v�.�.����U�*�C�0�0�0r0c���	|dz
}tt|����}||z||zdkz
}|dkr?||z|z
}|dkr	|d|zz}nt|d|z��}t|d|z��}nd}|r_ttt	|������dz
}||zdkr't|t||z��zd|z��}nd}nd}t||zd��SrZ)r�r�rOrXr�r[)	r�rr�r�r�r�r\r��	f_log_tens	         r.r'r'�s��:���F�A�
	�C��F�F���A�	�!��q��s�a�x��A�	�1�u�u�
�a�C��E����6�6�
��Q��J�A�A��Q��Q�B��'�'�A��a��Q��������	�	��C��A���K�K� � ��"���u�9��>�>�%�Q�}�Q�u�W�'=�'=�%=�r�5�y�I�I�I�I��I�I��	��	�E�)�3�/�/�/r0c��eZdZ	d�Zd�ZdS)�
_Log10Memoizec��d|_dS)N�/23025850929940456840179914546843642076011014886)r�r�s r.r�z_Log10Memoize.__init__�s
��G����r0c��	|dkrtd���|t|j��krwd}	d||zdzz}tt	td|z|��d����}||d�d|zkrn|dz
}�R|�d��dd	�|_t|jd|d
z���S)Nr(zp should be nonnegativer�Tr�r�r�r�r�r1)r�r�r�r�rOrXrGr�)r5r�r�rRr�s     r.�	getdigitsz_Log10Memoize.getdigits�s���	�
�q�5�5��6�7�7�7���D�K� � � � ��E�
���5����O���\�%��1��a�.�.�#�>�>�?�?���5�&�'�'�?�c�%�i�/�/����
��

�!�-�-��,�,�S�b�S�1�D�K��4�;�t��!��t�$�%�%�%r0N)r9r:r;r�rfr,r0r.rbrb�s;������C�H�H�H�&�&�&�&�&r0rbc��	t||z|z��}tdtt|����zd|zz��}t	||��}||z}t|dz
dd��D]}t	|||zz||z��}�t|dz
dd��D] }||dzz}t	|||zz|��}�!||zS)NrQr�r1r(r�r�)r�r�r�r�rOr�)	r�rRrSrTrUr��Mshiftr�r�s	         r.�_iexpri
s���!�(	��1��q�y���A�

�S��S��V�V���_�q��s�
#�	$�	$�$�A��Q����A�
��T�F�
�1�Q�3��2�
�
�5�5����F�Q�J���!��4�4����1�Q�3��B�
�
�/�/���Q�q�S�����A�f�H��v�.�.����Q�3�Jr0c	�j�	|dz
}td|tt|����zdz
��}||z}||z}|dkr	|d|zz}n	|d|zz}t|t	|����\}}t|d|z��}tt
|d|z��d��||z
dzfS)Nr�r(r1r�i�r�)r$r�r�r6r[rOri)	r�rr�r�r=r7�cshift�quotr�s	         r.rr2s���4���F�A�
��1�s�3�q�6�6�{�{�?�Q�&�'�'�E�	�E�	�A�
�a�C�E���z�z��2�u�9�����B���J����v�}�Q�/�/�0�0�I�D�#��s�B��I�
&�
&�C���c�2�q�5�)�)�4�0�0�$��(�Q�,�>�>r0c���	ttt|������|z}t||||zdz��}||z
}|dkr||zd|zz}nt	||zd|z��}|dkrHtt|����|zdk|dkkrd|dz
zdzd|z
}
}	n<d|zdz
|}
}	n0t||dz|dz��\}	}
t	|	d��}	|
dz
}
|	|
fS)Nr1r(r�)r�r�r�r'rOr)r�r�r�r�r�r@�lxcr7�pcr�r�s           r.r�r�Vs$���	�C��B���L�L���B��A���B��!��A��
�
�C�
�q�D�E���z�z�
��V�B��I�
���
�#�b�&�"�u�f�*�
-�
-��	�Q�w�w���R���\�\�B�
�!�
#��a��0�0��a��c��1��a��c�3�E�E��Q��q��1�"�3�E�E��2��1��v�q��s�+�+�
��s��U�B�'�'���q����#�:�r0r��F�5�(�r�r�r�)	r0�2�3�4�5�6�7�8r]c��	|dkrtd���t|��}dt|��z||dz
S)Nr(z0The argument to _log10_lb should be nonnegative.r�)r�r�r�)r��
correction�str_cs   r.r�r��sI��K��A�v�v��K�L�L�L���F�F�E��s�5�z�z�>�J�u�Q�x�0�0�0r0c��	t|t��r|St|t��rt|��S|r/t|t��rt�|��S|rtd|z���tS)Nr�)r�rr�r�r�rxr�)r�r��allow_floats   r.r�r��s�����%��!�!�����%������u�~�~���)�z�%��/�/�)��!�!�%�(�(�(��C��9�E�A�B�B�B��r0c�x�	t|t��r||fSt|tj��r_|jsBt|jtt|j	��|j
z��|j��}|t|j��fS|r,t|tj
��r|jdkr|j}t|t ��rWt#��}|rd|jt&<n|�t&d��|t�|��fSt,t,fS)Nr(r1r�)r�r�_numbers�Rationalr�rBrCr�r�rD�denominatorr��	numerator�Complexrbr^r�rrhrr�r�r�)r5r�r�r6s    r.r�r��s7����%��!�!���U�{���%��*�+�+�.���	/�#�D�J�$'��D�I����9J�(J�$K�$K�$(�I�/�/�D��W�U�_�-�-�-�-�
��z�%��)9�:�:��u�z�Q����
���%����/��,�,���	O�,-�G�M�.�)�)�� � ��M�
O�
O�
O��W�'�'��.�.�.�.��>�)�)r0r�i?Bi���)r_r^rirhr`rerfrgr�)r_r^rirha�        # 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
z0*$z50*$z�\A
(?:
   (?P<fill>.)?
   (?P<align>[<>=^])
)?
(?P<sign>[-+ ])?
(?P<no_neg_0>z)?
(?P<alt>\#)?
(?P<zeropad>0)?
(?P<minimumwidth>(?!0)\d+)?
(?P<thousands_sep>,)?
(?:\.(?P<precision>0|(?!0)\d+))?
(?P<type>[eEfFgGn%])?
\Z
c��	t�|��}|�td|z���|���}|d}|d}|ddu|d<|dr(|�td|z���|�td|z���|pd|d<|pd|d<|d	�d
|d	<t	|dpd��|d<|d
�t	|d
��|d
<|d
dkr|d�
|ddvrd|d
<|ddkrVd|d<|�tj��}|d�td|z���|d|d<|d|d<|d|d<n|d�d|d<ddg|d<d|d<|S)NzInvalid format specifier: �fill�align�zeropadz7Fill character conflicts with '0' in format specifier: z2Alignment conflicts with '0' in format specifier: � �>rPr��minimumwidthr�r�r(rx�gGnr1rAr��
thousands_sepzJExplicit thousands separator conflicts with 'n' type in format specifier: �grouping�
decimal_pointr�r�r
)�_parse_format_specifier_regex�matchr��	groupdictr��_locale�
localeconv)�format_specrr��format_dictr�r�s      r.r�r�,s:���$	&�+�+�K�8�8�A��y��5��C�D�D�D��+�+�-�-�K��v��D��� �E�)�)�4�D�@�K�	���9��A����6�8C�D�E�E�
E����2�4?�@�A�A�
A��+�#�K���!�<�C�K����6��"�!��F��#&�k�.�&A�&H�S�"I�"I�K����;��+�#&�{�;�'?�#@�#@��K� ��;��1�$�$��v��&�+�f�*=��*F�*F�'(�K��$��6��c�!�!�!��F����!�,�.�.�K���'�3��>�@K�L�M�M�
M�'2�?�'C��O�$�"-�j�"9��J��'2�?�'C��O�$�$���'�/�+-�K��(�#$�a�&��J��'*��O�$��r0c�b�	|d}|d}||t|��z
t|��z
z}|d}|dkr	||z|z}na|dkr	||z|z}nR|dkr	||z|z}nC|dkr.t|��dz}|d|�|z|z||d�z}ntd	���|S)
Nr�r�r��<r��=�^r�zUnrecognised alignment field)r�r�)	rPr�r�r�r��paddingr�r��halfs	         r.r�r�|s������'�L���<�D��L�3�t�9�9�,�s�4�y�y�8�9�G���M�E���|�|����w�&���	�#����4��$�&���	�#������$�&���	�#����7�|�|�Q�����$���$�&��-������>����7�8�8�8��Mr0c��	ddlm}m}|sgS|ddkr6t|��dkr#||dd�||d����S|dtjkr
|dd�St
d���)Nr()�chain�repeatr�r�r�z unrecognised format for grouping)�	itertoolsr�r�r�r��CHAR_MAXr�)r�r�r�s   r.�_group_lengthsr��s����(�'�'�'�'�'�'�'��=��	�	�"���	�	�s�8�}�}��1�1��u�X�c�r�c�]�F�F�8�B�<�$8�$8�9�9�9�	�"���)�	)�	)�����}���;�<�<�<r0c�v�	|d}|d}g}t|��D]�}|dkrtd���ttt	|��|d��|��}|�d|t	|��z
z||d�z��|d|�}||z}|s|dkrne|t	|��z}��tt	|��|d��}|�d|t	|��z
z||d�z��|�t|����S)Nr�r�r(zgroup length should be positiver1r�)r�r�rr$r�r�r��reversed)r�r��	min_width�sepr��groupsr�s       r.�_insert_thousands_sepr��sB��� ��
�C��J��H�
�F�
�H�
%�
%�
;�
;����6�6��>�?�?�?���C��K�K��A�.�.��2�2���
�
�c�1�s�6�{�{�?�+�f�a�R�S�S�k�9�:�:�:���!������Q��	��	�)�q�.�.��E��S��X�X��	�	���F���Y��*�*���
�
�c�1�s�6�{�{�?�+�f�a�R�S�S�k�9�:�:�:��8�8�H�V�$�$�%�%�%r0c�4�	|rdS|ddvr|dSdS)Nr�rPz +r�r,)�is_negativer�s  r.r�r��s0��#����s�	
�f���	�	��F�|���rr0c��	t||��}|s|dr|d|z}|dks
|ddvr,ddddd�|d}|d	�||��z
}|dd
kr|d
z
}|dr)|dt|��z
t|��z
}nd}t|||��}t	|||z|��S)
N�altr�r(rxr�rr)rrr�r�z{0}{1:+}r�r�r�)r��formatr�r�r�)r�r�r�r�r�rP�echarr�s        r.r�r��s����"��T�*�*�D��4�4��;�4���(�8�3��
�a�x�x�4��<�4�'�'���#�C�8�8��f��F���J�%�%�e�S�1�1�1���F�|�s����C����I�����(�3�x�=�=�8�3�t�9�9�D�	�	��	�#�G�T�9�=�=�G���w�x�/��6�6�6r0�Infz-Infrr�r�r+)F)r()r�)FF)r1){�__all__r9�	__xname__�__version__�__libmpdec_version__�mathr��numbersr��sys�collectionsr)�_namedtupler�ImportErrorrrrrrrrrr%r&�maxsizer!r"r#r$�ArithmeticErrorrr	r
r�ZeroDivisionErrorrrrrrr
rrrrxrr�r�r��contextvars�
ContextVarrk�	frozensetrwrrr r�rrB�Number�registerrurr�r&r�r�r�r�rKrMrOrXr.r'rbrfr[rirr�r�r�r�rrr�re�compile�VERBOSE�
IGNORECASEr�r�rvr��DOTALLr��localer�r�r�r�r�r�r�r&r%rFr�r�r�rN�	hash_info�modulusr�r`r�rW�_PyHASH_NANr�r�r,r0r.�<module>r�s��� a�F!�!�!��F
�	���������������
�
�
�
�&�5�5�5�5�5�5��;�~�/E�F�F�L�L���&�&�&�%�%�L�L�L�&�����
��
�#���
�����#��
�
������;�'���!�H�!�H�"�H�H��H��H��H����
�#�	�
�
�
�
�
��
�
�
�.
�
�
�
�
��
�
�
������'����:�����'����%�%�%�%�%�%�'8�%�%�%� 	�	�	�	�	�)�	�	�	�	�	�	�	�	�(�*;�	�	�	�
�
�
�
�
��
�
�
������%����
�
�
�
�
��
�
�
�	�	�	�	�	� �	�	�	�#:�#:�#:�#:�#:�w��#:�#:�#:�L
�
�
�
�
���)�
�
�
�
�
�
�
�
�%�y�
�
�
� 
�^�W�h���'��N�D��#�#3�$�%5�#�$4� �!1�3���}�o�}���/�:�G������-�{�-�.?�@�@���i�O�O�O�������&�&�&��+�+�+�+�hw3K�w3K�w3K�w3K�w3K�f�w3K�w3K�w3K�rg����&	�����!�!�!�

'�
'�
'�
'�
'�f�
'�
'�
'�O$�O$�O$�O$�O$�f�O$�O$�O$�b6@�@�@�@�@�v�@�@�@�4����<

���3�3�3�*

�

�

�+�+�+�!�!�!�. �. �. �. �` 1� 1� 1�D*0�*0�*0�X!&�!&�!&�!&�!&�F�!&�!&�!&�F�
���)�
�#�#�#�#�J"?�"?�"?�H(�(�(�V�r���"�
�b�r��+�+�1�1�1�1�����&"*�"*�"*�"*�T��
�/��x�)9�:��
�
��������w�
���x�)9�7�I�N�������'�
��������*
�	�	�	�
�"�*��"�Z�"�-��#!�!�""'�#�&�R�Z��
�
�
$�
��b�j�� � �&��!+��
�,��Z��	��!�!�� �
	��������	�	�	��D�	����N�N�N�N�`���6=�=�=�.#&�#&�#&�#&�J���#7�#7�#7�R
�G�E�N�N�	��G�F�O�O���w�u�~�~�����
�
���w�q�z�z���w�r�{�{���/�0���-�'���m����m�����B��!�+�_�=�=�
��C�Cs�.�9�9�$K)�)K1�0K1

Zerion Mini Shell 1.0