Ë
    	š„jv  ã                   óL   — d Z ddlmZ ddlmZmZmZ ddlmZm	Z	 d	d„Z
d„ ZdgZy)
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| j                  |«      S t        d«      | z  }dt        t	        | «      «      v rt        | «      } t        | t        «      r| }n't        st        j                  | «      }nt        | «      }|dk  rt        ||z  «      |z  }n|j                  |t        ¬«      }|rt        |«      S t        |«      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.
    FTr   Ú	__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         úO/var/www/html/GAP/venv/lib/python3.12/site-packages/future/builtins/newround.pyr   r      sÎ   € ð €JØ€Øˆ
ØˆÜˆv�{Ô#Ø×Ñ Ó(Ð(ä�t‹} ' Ñ*€Hð ”$”t˜F“|Ó$Ñ$Ü�v“ˆä�&œ'Ô"Ø‰åÜ×"Ñ" 6Ó*‰Aä˜fÓ%ˆAà�‚{Ü˜!˜h™,Ó'¨(Ñ2‰à—‘˜H¬�Ó?ˆáÜ�6‹{Ðä�V‹}Ðó    c                 ó„  — ddl }ddlm} t        | t        t
        f«      rt        | «      S |j                  | «      s|j                  | «      rt        t        | «      «      S |j                  d| «      dk(  rd}nd}t        | «      j                  «       \  }}d„ } ||«      dz
  } ||t        |d|z  z  «      | «      }|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')

    r   N)Ú_dec_from_tripleg      ð?é   c                 óN   — | dk7  r t        t        t        | «      «      «      dz
  S y)Nr   é   )ÚlenÚbinÚabs)r   s    r   Ú
bit_lengthz!from_float_26.<locals>.bit_length_   s$   € Ø�Š6Ü”sœ3˜q›6“{Ó# aÑ'Ð'àr   é   )ÚmathÚdecimalr!   r   r   Úlongr   ÚisinfÚisnanr   Úcopysignr'   Úas_integer_ratioÚstr)	ÚfÚ_mathr!   ÚsignÚnr   r(   Úkr   s	            r   r   r   =   s¯   € ó* Ý(ä�!”cœ4�[Ô!Ü�q‹zÐØ‡{�{�1„~˜Ÿ™ QœÜ”t˜A“wÓÐØ‡~�~�c˜1Ó Ò$Ø‰àˆÜˆq‹6×"Ñ"Ó$�D€A€qòñ
 	�1‹˜Ñ€AÙ˜d¤C¨¨!¨Q©$©£K°!°Ó4€FØ€Mr   r   )N)Ú__doc__Ú
__future__r   Úfuture.utilsr   r   r   r+   r   r   r   r   Ú__all__© r   r   ú<module>r<      s/   ðñõ  ß 0Ñ 0÷ -ó+ò`)ðX ˆ,�r   