## "Fossies" - the Fresh Open Source Software Archive

### Source code changes of the file "mpmath/ctx_mp.py" betweenmpmath-0.18.tar.gz and mpmath-0.19.tar.gz

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

ctx_mp.py  (mpmath-0.18):ctx_mp.py  (mpmath-0.19)
skipping to change at line 490 skipping to change at line 490
>>> besselj(5, 125 * 10**28) # Exact input >>> besselj(5, 125 * 10**28) # Exact input
-8.03284785591801e-17 -8.03284785591801e-17
>>> besselj(5, '1.25e30') # Bad >>> besselj(5, '1.25e30') # Bad
7.12954868316652e-16 7.12954868316652e-16
>>> autoprec(besselj)(5, '1.25e30') # Good >>> autoprec(besselj)(5, '1.25e30') # Good
-8.03284785591801e-17 -8.03284785591801e-17
The following fails to converge because \sin(\pi) = 0 whereas all The following fails to converge because \sin(\pi) = 0 whereas all
finite-precision approximations of \pi give nonzero values:: finite-precision approximations of \pi give nonzero values::
>>> autoprec(sin)(pi) >>> autoprec(sin)(pi) # doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last): Traceback (most recent call last):
... ...
NoConvergence: autoprec: prec increased to 2910 without convergence NoConvergence: autoprec: prec increased to 2910 without convergence
As the following example shows, :func:~mpmath.autoprec can protect aga inst As the following example shows, :func:~mpmath.autoprec can protect aga inst
cancellation, but is fooled by too severe cancellation:: cancellation, but is fooled by too severe cancellation::
>>> x = 1e-10 >>> x = 1e-10
>>> exp(x)-1; expm1(x); autoprec(lambda t: exp(t)-1)(x) >>> exp(x)-1; expm1(x); autoprec(lambda t: exp(t)-1)(x)
1.00000008274037e-10 1.00000008274037e-10
End of changes. 1 change blocks.
1 lines changed or deleted 1 lines changed or added