[Numpy-discussion] Numexpr giving randomized results on arrays larger than 2047 elements

John Salvatier jsalvati at u.washington.edu
Mon Jan 24 12:47:58 EST 2011


I have discovered a strange bug with numexpr. numexpr.evaluate gives
randomized results on arrays larger than 2047 elements. The following
program demonstrates this:

from numpy import *
from numexpr import evaluate

def func(x):

    return evaluate("sum(x, axis = 0)")

x = zeros(2048)+.01

print evaluate("sum(x, axis = 0)")
print evaluate("sum(x, axis = 0)")

For me this prints different results each time, for example:


If we set the size to 2047 I get consistent results.


Interestingly, if I do not add .01 to x, it consistently sums to 0.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20110124/f9779d1f/attachment.html>

More information about the NumPy-Discussion mailing list