[Numpy-discussion] Precision difference between dot and sum

Matthieu Brucher matthieu.brucher@gmail....
Tue Nov 2 04:05:45 CDT 2010


>> It would be great if someone could let me know why this happens.
>
> They don't use the same implementation, so such tiny differences are
> expected - having exactly the same solution would have been surprising,
> actually. You may be surprised about the difference for such a trivial
> operation, but keep in mind that dot is implemented with highly
> optimized CPU instructions (that is if you use ATLAS or similar library).

Also, IIRC, 1.0 cannot be represented exactly as a float, so the dot
way may be more wrong than the sum way.

Matthieu
-- 
Information System Engineer, Ph.D.
Blog: http://matt.eifelle.com
LinkedIn: http://www.linkedin.com/in/matthieubrucher


More information about the NumPy-Discussion mailing list