[Numpy-discussion] Different results from repeated calculation
Stefan van der Walt
stefan at sun.ac.za
Sat Jan 27 18:25:47 EST 2007
On Sat, Jan 27, 2007 at 04:11:59PM -0700, Fernando Perez wrote:
> OK, this is weird. I modified the repeat code a little to ease
> collecting of results, and all of a sudden the differences went away.
> If you look at the attached code, here's what happens for me:
>
> a) If I have line 77 like this (commented out):
>
> #print '-'*75
>
> I get:
>
> [...]
> 94 z different 8.47032947254e-22
> 95 z different 8.47032947254e-22
> 96 z different 8.47032947254e-22
> 98 z different 8.47032947254e-22
> 99 z different 8.47032947254e-22
>
> Numpy version: 1.0.2.dev3521
>
> test1: 0 differences
> test2: 75 differences
> test3: 0 differences
>
>
>
> b) If I remove the comment char from that line, I get:
>
> tlon[~/Desktop]> python repeat.py
>
> ---------------------------------------------------------------------------
> Numpy version: 1.0.2.dev3521
>
> test1: 0 differences
> test2: 0 differences
> test3: 0 differences
>
>
> That's it. One comment char removed, and something that's done
> /after/ the tests are actually executed.
>
> That kind of 'I add a printf() call and the bug disappears' is
> unpleasantly reminiscent of lurking pointer errors in C code...
I also ran the test under Valgrind, but no errors pop up. Very strange.
Cheers
Stéfan
More information about the NumPy-Discussion
mailing list