[SciPy-dev] Failures in current CVS version

Pearu Peterson pearu at scipy.org
Wed Oct 1 23:51:46 CDT 2003



On Wed, 1 Oct 2003, Travis E. Oliphant wrote:

> > I investigated this a bit futher.. The problem was in Numeric.arange that
> > have different implementations in versions 21.0 (that I have under Python 
> > 2.1) and 23.1 (Python 2.3.1) and return a tiny bit different (but 
> > noticable to above tests) results:
> 
> Stragely enough, I saw this error too and couldn't account for it 
> because the implementation of arange hasn't changed between 21.0 and 
> 23.1

Numeric 21.0 was released 12Feb2002 but the arange implementation 
changed between multiarraymodule.c revisions 1.28 and 1.29,1.30 dated 
around  25Mar2002. See

http://cvs.sourceforge.net/viewcvs.py/numpy/Numerical/Src/multiarraymodule.c

That was Travis O. who commited these changes;-)

> --- it shows that you shouldn't count on arange ending on exactly 
> the float you expect if you are relying on float equality

I think the new arange implementation fixed this, or at least, as 
well as possible.

> e,g, 1/10.0 is not necessarily the same as 0.1  down to the last bit.

This is not completely true, 0.1 and 1/10.0 happen to be exactly the 
same floats:-)

>>> '%.24e' % (1/10.0)
'1.000000000000000055511151e-01'
>>> '%.24e' % (0.1)
'1.000000000000000055511151e-01'

but in general I agree that different ways to compute a floating point 
number may have a bit different results.

Pearu




More information about the Scipy-dev mailing list