Your IP : 18.223.170.253
B
�A�[ � @ sD d Z ddlmZmZmZ ddlmZmZ d dd�Zdd� Z dgZ
dS )
zD
``python-future``: pure Python implementation of Python 3 round().
� )�PYPY�PY26�bind_method)�Decimal�ROUND_HALF_EVENNc C s� d}|dkrd}d}t | d�r(| �|�S |dk r8td��td�| }trbdtt| ��krbt| �} ts|t� | �j
|td �}nt| �j
|td �}|r�t
|�S t|�S dS )
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)Zrounding)�hasattrr �NotImplementedErrorr r �repr�type�floatr Z
from_floatZquantizer �
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&