Skip to content

Commit a16f387

Browse files
committed
FIX: loosen numerical tolerance in test_pareto()
The problem was that in 32bit Ubuntu 12.04, one gets the following: > /home/njs/numpy/.tox/py27/local/lib/python2.7/site-packages/numpy/random/tests/test_random.py(363)test_pareto() -> np.testing.assert_array_almost_equal(actual, desired, decimal=15) (Pdb) actual[1, 0] 52828779.702948704 (Pdb) desired[1, 0] 52828779.702948518 and the test was comparing the numbers to 1e-14, which obviously failed. Fixes #424.
1 parent a744f3c commit a16f387

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎numpy/random/tests/test_random.py‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,13 @@ def test_pareto(self):
360360
desired = np.array([[ 2.46852460439034849e+03, 1.41286880810518346e+03],
361361
[ 5.28287797029485181e+07, 6.57720981047328785e+07],
362362
[ 1.40840323350391515e+02, 1.98390255135251704e+05]])
363-
np.testing.assert_array_almost_equal(actual, desired, decimal=15)
363+
# For some reason on 32-bit x86 Ubuntu 12.10 the [1, 0] entry in this
364+
# matrix differs by 24 nulps. Discussion:
365+
# http://mail.scipy.org/pipermail/numpy-discussion/2012-September/063801.html
366+
# Consensus is that this is probably some gcc quirk that affects
367+
# rounding but not in any important way, so we just use a looser
368+
# tolerance on this test:
369+
np.testing.assert_array_almost_equal_nulp(actual, desired, nulp=30)
364370

365371
def test_poisson(self):
366372
np.random.seed(self.seed)

0 commit comments

Comments
 (0)