"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "mpmath/libmp/libmpi.py" between
mpmath-0.18.tar.gz and mpmath-0.19.tar.gz

About: mpmath is a Python library for arbitrary-precision floating-point arithmetic.

libmpi.py  (mpmath-0.18):libmpi.py  (mpmath-0.19)
skipping to change at line 544 skipping to change at line 544
*error_dps* *error_dps*
limit the error to *error_dps* digits (mode 'plusminus and 'percent') limit the error to *error_dps* digits (mode 'plusminus and 'percent')
Additional keyword arguments are forwarded to the mpf-to-string conversion Additional keyword arguments are forwarded to the mpf-to-string conversion
for the components of the output. for the components of the output.
**Examples** **Examples**
>>> from mpmath import mpi, mp >>> from mpmath import mpi, mp
>>> mp.dps = 30 >>> mp.dps = 30
>>> x = mpi(1, 2) >>> x = mpi(1, 2)._mpi_
>>> mpi_to_str(x, mode='plusminus') >>> mpi_to_str(x, 2, mode='plusminus')
'1.5 +- 5.0e-1' '1.5 +- 0.5'
>>> mpi_to_str(x, mode='percent') >>> mpi_to_str(x, 2, mode='percent')
'1.5 (33.33%)' '1.5 (33.33%)'
>>> mpi_to_str(x, mode='brackets') >>> mpi_to_str(x, 2, mode='brackets')
'[1.0, 2.0]' '[1.0, 2.0]'
>>> mpi_to_str(x, mode='brackets' , brackets=('<', '>')) >>> mpi_to_str(x, 2, mode='brackets' , brackets=('<', '>'))
'<1.0, 2.0>' '<1.0, 2.0>'
>>> x = mpi('5.2582327113062393041', '5.2582327113062749951') >>> x = mpi('5.2582327113062393041', '5.2582327113062749951')._mpi_
>>> mpi_to_str(x, mode='diff') >>> mpi_to_str(x, 15, mode='diff')
'5.2582327113062[4, 7]' '5.2582327113062[4, 7]'
>>> mpi_to_str(mpi(0), mode='percent') >>> mpi_to_str(mpi(0)._mpi_, 2, mode='percent')
'0.0 (0%)' '0.0 (0.0%)'
""" """
prec = dps_to_prec(dps) prec = dps_to_prec(dps)
wp = prec + 20 wp = prec + 20
a, b = x a, b = x
mid = mpi_mid(x, prec) mid = mpi_mid(x, prec)
delta = mpi_delta(x, prec) delta = mpi_delta(x, prec)
a_str = to_str(a, dps, **kwargs) a_str = to_str(a, dps, **kwargs)
b_str = to_str(b, dps, **kwargs) b_str = to_str(b, dps, **kwargs)
mid_str = to_str(mid, dps, **kwargs) mid_str = to_str(mid, dps, **kwargs)
 End of changes. 5 change blocks. 
10 lines changed or deleted 10 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS