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

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

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

test_functions.py  (mpmath-0.18):test_functions.py  (mpmath-0.19)
skipping to change at line 156 skipping to change at line 156
assert exp(-10000).ae(mpf('1.1354838653147360985e-4343')) assert exp(-10000).ae(mpf('1.1354838653147360985e-4343'))
a = exp(mpf((1, 8198646019315405, -53, 53))) a = exp(mpf((1, 8198646019315405, -53, 53)))
assert(a.bc == bitcount(a.man)) assert(a.bc == bitcount(a.man))
mp.prec = 67 mp.prec = 67
a = exp(mpf((1, 1781864658064754565, -60, 61))) a = exp(mpf((1, 1781864658064754565, -60, 61)))
assert(a.bc == bitcount(a.man)) assert(a.bc == bitcount(a.man))
mp.prec = 53 mp.prec = 53
assert exp(ln2 * 10).ae(1024) assert exp(ln2 * 10).ae(1024)
assert exp(2+2j).ae(cmath.exp(2+2j)) assert exp(2+2j).ae(cmath.exp(2+2j))
def test_issue_3(): def test_issue_73():
mp.dps = 512 mp.dps = 512
a = exp(-1) a = exp(-1)
b = exp(1) b = exp(1)
mp.dps = 15 mp.dps = 15
assert (+a).ae(0.36787944117144233) assert (+a).ae(0.36787944117144233)
assert (+b).ae(2.7182818284590451) assert (+b).ae(2.7182818284590451)
def test_log(): def test_log():
mp.dps = 15 mp.dps = 15
assert log(1) == 0 assert log(1) == 0
skipping to change at line 624 skipping to change at line 624
assert isnan(nthroot(nan, -1)) assert isnan(nthroot(nan, -1))
assert isnan(nthroot(inf, 0)) assert isnan(nthroot(inf, 0))
assert root(2,3) == nthroot(2,3) assert root(2,3) == nthroot(2,3)
assert root(16,4,0) == 2 assert root(16,4,0) == 2
assert root(16,4,1) == 2j assert root(16,4,1) == 2j
assert root(16,4,2) == -2 assert root(16,4,2) == -2
assert root(16,4,3) == -2j assert root(16,4,3) == -2j
assert root(16,4,4) == 2 assert root(16,4,4) == 2
assert root(-125,3,1) == -5 assert root(-125,3,1) == -5
def test_issue_6(): def test_issue_136():
for dps in [20, 80]: for dps in [20, 80]:
mp.dps = dps mp.dps = dps
r = nthroot(mpf('-1e-20'), 4) r = nthroot(mpf('-1e-20'), 4)
assert r.ae(mpf(10)**(-5) * (1 + j) * mpf(2)**(-0.5)) assert r.ae(mpf(10)**(-5) * (1 + j) * mpf(2)**(-0.5))
mp.dps = 80 mp.dps = 80
assert nthroot('-1e-3', 4).ae(mpf(10)**(-3./4) * (1 + j)/sqrt(2)) assert nthroot('-1e-3', 4).ae(mpf(10)**(-3./4) * (1 + j)/sqrt(2))
assert nthroot('-1e-6', 4).ae((1 + j)/(10 * sqrt(20))) assert nthroot('-1e-6', 4).ae((1 + j)/(10 * sqrt(20)))
# Check that this doesn't take eternity to compute # Check that this doesn't take eternity to compute
mp.dps = 20 mp.dps = 20
assert nthroot('-1e100000000', 4).ae((1+j)*mpf('1e25000000')/sqrt(2)) assert nthroot('-1e100000000', 4).ae((1+j)*mpf('1e25000000')/sqrt(2))
End of changes. 2 change blocks.
2 lines changed or deleted 2 lines changed or added