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

Mon Apr 20 14:50:09 CDT 2009

```Well, thanks everybody for such a quick help!! I just couldn't imagine what
could arise this difference.

1e-15 is enough precision for what I will be doing, but was just curious.

Anyway, this 'deepcopy' really surprised me. I have now looked for it and I
think I get an idea of it, though I wouldn't expect this difference in
behavior to happen. From "my logical" point of view a copy is a copy, and if
I find a method called copy() I can only expect it to...copy (whether I am
copying compound or "simple" objects!!). This comment is only for the shake
of curiosity. I guess maybe it is just my lack of knowledge in programming
in general and this is such a needed difference in copy behavior.

On Mon, Apr 20, 2009 at 7:21 PM, John Gleeson <jdgleeson@mac.com> wrote:

>
> 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.
>

It's not? Would you please mind commenting this a little bit?

> 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.
>

I don't get what you mean

>
> >
> > print ml - morig
> >
> > shows that the internal representation is not exactly the same.
> >
> > David
>
> The discrepancy David found in ml - morig vanishes if you change line
> 118
>
> morigl = ml[:]

Sorry for this mistake :S

> 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
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20090420/678a7cb9/attachment.html
```