Spade
Mini Shell
| Directory:~$ /lib/python2.7/site-packages/future/builtins/ |
| [Home] [System Details] [Kill Me] |
�
,1�]c@sZdZddlmZmZmZddlmZmZdd�Z d�Z
dgZdS(sD
``python-future``: pure Python implementation of Python 3 round().
i����(tPYPYtPY26tbind_method(tDecimaltROUND_HALF_EVENcCst}|dkr!t}d}nt|d�r=|j|�S|dkrXtd��ntd�|}tr�dtt |��kr�t
|�}q�nt|t�r�|}nBts�tj
|�j|dt�}nt|�j|dt�}|rt|�St
|�SdS(s�
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.
it __round__s"negative ndigits not supported
yett10tnumpytroundingN(tFalsetNonetTruethasattrRtNotImplementedErrorRRtreprttypetfloatt
isinstanceRt
from_floattquantizeRt
from_float_26tint(tnumbertndigitst
return_inttexponenttd((s</usr/lib/python2.7/site-packages/future/builtins/newround.pytnewrounds*
c Cs�ddl}ddlm}t|ttf�r;t|�S|j|�sY|j|�ritt |��S|j
d|�dkr�d}nd}t|�j�\}}d�}||�d}||t
|d|�|�}|S( s�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')
i����N(t_dec_from_tripleg�?iicSs.|dkr&ttt|���dSdSdS(Nii(tlentbintabs(R((s</usr/lib/python2.7/site-packages/future/builtins/newround.pyt
bit_length\si(tmathtdecimalRRRtlongRtisinftisnanRtcopysignRtas_integer_ratiotstr( tft_mathRtsigntnRR
tktresult((s</usr/lib/python2.7/site-packages/future/builtins/newround.pyR:s
!RN(t__doc__tfuture.utilsRRRR"RRR
RRt__all__(((s</usr/lib/python2.7/site-packages/future/builtins/newround.pyt<module>s
. ,