Forgot to mention that I am using numexpr 1.4.1 and numpy 1.5.1<br><br><div class="gmail_quote">On Mon, Jan 24, 2011 at 9:47 AM, John Salvatier <span dir="ltr"><<a href="mailto:jsalvati@u.washington.edu">jsalvati@u.washington.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hello, <div><br></div><div>I have discovered a strange bug with numexpr. numexpr.evaluate gives randomized results on arrays larger than 2047 elements. The following program demonstrates this: </div>
<div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div><div><div>from numpy import * </div><div>from numexpr import evaluate</div><div><br></div><div>def func(x):</div><div><br></div><div>    return evaluate("sum(x, axis = 0)")</div><div><br></div><div><br></div>

<div>x = zeros(2048)+.01</div><div><br></div><div>print evaluate("sum(x, axis = 0)")</div><div>print evaluate("sum(x, axis = 0)")</div></div></div><div><br></div></blockquote>For me this prints different results each time, for example:<blockquote style="margin:0 0 0 40px;border:none;padding:0px">

<div><div><div>11.67</div><div>14.84</div></div></div><div><br></div></blockquote>If we set the size to 2047 I get consistent results.<blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div><div>20.47</div><div>20.47</div></div><div><br></div></blockquote>Interestingly, if I do not add .01 to x, it consistently sums to 0.
</blockquote></div><br>