<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
        integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
</html>
B
    A[                 @   sD   d Z ddlmZmZmZ ddlmZmZ d	ddZdd Z	dgZ
dS )
zD
``python-future``: pure Python implementation of Python 3 round().
    )PYPYPY26bind_method)DecimalROUND_HALF_EVENNc             C   s   d}|dkrd}d}t | dr(| |S |dk r8tdtd|  }trbdtt| krbt| } ts|t	| j
|td	}nt| j
|td	}|rt|S t|S d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__z"negative ndigits not supported yet10numpy)Zrounding)hasattrr   NotImplementedErrorr   r   reprtypefloatr   Z
from_floatZquantizer   from_float_26int)numberndigitsZ
return_intexponentd r   I/opt/alt/python37/lib/python3.7/site-packages/future/builtins/newround.pynewround   s&    


r   c       	      C   s   ddl }ddlm} t| ttfr*t| S || s>|| rJtt	| S |
d| dkr`d}nd}t|  \}}dd }||d }||t|d|  | }|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             S   s$   | dkrt tt| d S dS d S )Nr      )lenbinabs)r   r   r   r   
bit_lengthY   s    z!from_float_26.<locals>.bit_length   )mathdecimalr   
isinstancer   longr   isinfisnanr   copysignr   as_integer_ratiostr)	fZ_mathr   signnr   r   kresultr   r   r   r   7   s    r   )N)__doc__Zfuture.utilsr   r   r   r!   r   r   r   r   __all__r   r   r   r   <module>   s
   
+,