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

Francesc Alted faltet at pytables.org
Tue Jan 25 09:08:15 EST 2011


A Monday 24 January 2011 18:47:58 John Salvatier escrigué:
> 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.

I'm about to release Numexpr 1.4.2 that should fix this.  Could you give 
it a try at the tarball in?:

python setup.py sdist

Thanks,

-- 
Francesc Alted



More information about the NumPy-Discussion mailing list