[Numpy-discussion] Numpy float precision vs Python list float issue

John Gleeson jdgleeson@mac....
Mon Apr 20 12:21:00 CDT 2009


On 2009-04-20, at 10:04 AM, David Cournapeau wrote:

>
> Yes, it is legitimate and healthy to worry about the difference - but
> the surprising thing really is the list behavior when you are used to
> numerical computation :) And I maintain that the algorithms are not
> the same in both operations. For once, the operation of using arrays
> on the data do not give the same data in both cases, you can see right
> away that m and ml are not the same, e.g.
>
> print ml - morig
>
> shows that the internal representation is not exactly the same.
>
> David
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion

The discrepancy David found in ml - morig vanishes if you change line  
118

morigl = ml[:]

to

import copy
morigl = copy.deepcopy(ml)

There is still an issue with disagreement in minimum diff, but I'd bet  
it is not a floating point precision problem.

John


More information about the Numpy-discussion mailing list