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

totonixsame at gmail.com totonixsame at gmail.com
Mon Jan 24 13:23:06 EST 2011


I have the same problem here. I'm using numexpr 1.4.1 and numpy 1.3.0.

On Mon, Jan 24, 2011 at 4:19 PM, John Salvatier
<jsalvati at u.washington.edu> wrote:
> 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.
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>



More information about the NumPy-Discussion mailing list