Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/future/builtins/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/future/builtins/__pycache__/newround.cpython-311.pyc

�

�܋fv��N�dZddlmZddlmZmZmZddlmZm	Z	d	d�Z
d�ZdgZdS)
zD
``python-future``: pure Python implementation of Python 3 round().
�)�division)�PYPY�PY26�bind_method)�Decimal�ROUND_HALF_EVENNc��d}|�d}d}t|d��r|�|��Std��|z}dtt	|����vrt|��}t
|t��r|}n+tstj|��}nt|��}|dkrt||z��|z}n|�|t���}|rt|��St|��S)	a�
    See Python 3 documentation: uses Banker's Rounding.

    Delegates to the __round__ method if for some reason this exists.

    If not, rounds a number to a given precision in decimal digits (default
    0 digits). This returns an int when called with one argument,
    otherwise the same type as the number. ndigits may be negative.

    See the test_round method in future/tests/test_builtins.py for
    examples.
    FNTr�	__round__�10�numpy)�rounding)�hasattrr
r�repr�type�float�
isinstancer�
from_float�
from_float_26�newround�quantizer�int)�number�ndigits�
return_int�exponent�d�results      �i/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/future/builtins/newround.pyrr
s���J����
����v�{�#�#�)�����(�(�(��t�}�}�'��*�H��$�t�F�|�|�$�$�$�$��v�����&�'�"�"�&�����	&��"�6�*�*�A�A��f�%�%�A���{�{��!�h�,�'�'�(�2������H���?�?�����6�{�{���V�}�}��c���ddl}ddlm}t|tt
f��rt
|��S|�|��s|�|��rt
t|����S|�
d|��dkrd}nd}t|�����\}}d�}||��dz
}||t|d|zz��|��}|S)a�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')

    rN)�_dec_from_tripleg�?�c�j�|dkr,ttt|������dz
SdS)Nr�)�len�bin�abs)rs r�
bit_lengthz!from_float_26.<locals>.bit_length_s/����6�6��s�3�q�6�6�{�{�#�#�a�'�'��1r�)�math�decimalr!rr�longr�isinf�isnanr�copysignr'�as_integer_ratio�str)	�f�_mathr!�sign�nrr(�krs	         rrr=s��*����(�(�(�(�(�(��!�c�4�[�!�!���q�z�z���{�{�1�~�~� ����Q��� ��t�A�w�w�����~�~�c�1����$�$�������q�6�6�"�"�$�$�D�A�q����
	�
�1�
�
���A�
�
�d�C��!�Q�$��K�K�!��
4�
4�F��Mrr)N)
�__doc__�
__future__r�future.utilsrrrr+rrrr�__all__�rr�<module>r<s����� ������0�0�0�0�0�0�0�0�0�0�-�,�,�,�,�,�,�,�+�+�+�+�`)�)�)�X�,���r

Hacked By AnonymousFox1.0, Coded By AnonymousFox