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

John Salvatier jsalvati at u.washington.edu
Mon Jan 24 13:19:19 EST 2011


Forgot to mention that I am using numexpr 1.4.1 and numpy 1.5.1

On Mon, Jan 24, 2011 at 9:47 AM, John Salvatier
<jsalvati at u.washington.edu>wrote:

> Hello,
>
> 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:
>
> 11.67
> 14.84
>
> If we set the size to 2047 I get consistent results.
>
> 20.47
> 20.47
>
> 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/6acbeb29/attachment.html>


More information about the NumPy-Discussion mailing list