
    9iv                     N    S r SSKJr  SSKJrJrJr  SSKJrJ	r	  S	S jr
S rS/rg)
zD
``python-future``: pure Python implementation of Python 3 round().
    )division)PYPYPY26bind_method)DecimalROUND_HALF_EVENNc                    SnUc  SnSn[        U S5      (       a  U R                  U5      $ [        S5      U* -  nS[        [	        U 5      5      ;   a  [        U 5      n [        U [        5      (       a  U nO-[        (       d  [        R                  " U 5      nO[        U 5      nUS:  a  [        XC-  5      U-  nOUR                  U[        S9nU(       a  [        U5      $ [        U5      $ )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         X/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/future/builtins/newround.pyr   r      s     J
v{##((t}'*H $tF|$$v&'""t""6*Af%A{!,'(2H?6{V}    c                    SSK nSSKJn  [        U [        [
        45      (       a  [        U 5      $ UR                  U 5      (       d  UR                  U 5      (       a  [        [        U 5      5      $ UR                  SU 5      S:X  a  SnOSn[        U 5      R                  5       u  pES nU" U5      S-
  nU" U[        USU-  -  5      U* 5      nU$ )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                 P    U S:w  a   [        [        [        U 5      5      5      S-
  $ g)Nr      )lenbinabs)r   s    r   
bit_length!from_float_26.<locals>.bit_length_   s$    6s3q6{#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    * (!c4[!!qz{{1~~QtAw~~c1$q6""$DA
 	1AdC!Q$K!4F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   