[Numpy-discussion] Different results from repeated calculation, part 2

Keith Goodman kwgoodman at gmail.com
Thu Aug 14 13:20:42 EDT 2008


I get slightly different results when I repeat a calculation.

I've seen this problem before (it went away but has returned):

http://projects.scipy.org/pipermail/numpy-discussion/2007-January/025724.html

A unit test is attached. It contains three tests:

In test1, I construct matrices x and y and then repeatedly calculate z
= calc(x,y). The result z is the same every time. So this test passes.

In test2, I construct matrices x and y each time before calculating z
= calc(x,y). Sometimes z is slightly different. But the x's test to be
equal and so do the y's. This test fails (on Debian Lenny, Core 2 Duo,
with libatlas3gf-sse2 but not with libatlas3gf-sse).

test3 is the same as test2 but I calculate z like this: z =
calc(100*x,y) / (100 * 100). This test passes.

I get:

======================================================================
FAIL: repeatability #2
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/[snip]/test/repeat_test.py", line 73, in test_repeat_2
    self.assert_(result, msg)
AssertionError: Max difference = 2.04946e-16

----------------------------------------------------------------------

Should a unit test like this be added to numpy?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: repeat_test.py
Type: text/x-python
Size: 2695 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20080814/7e237f0b/attachment.py>


More information about the NumPy-Discussion mailing list