[Numpy-discussion] dot product by 1*n maxtrix multiply it's transform not equal to raw python dot product?

Li Li fancyerii at gmail.com
Fri Feb 21 03:44:56 EST 2014

hi all
   I am porting some python code to java but got different results.
after long time debugging, I found the reason is numpy's result is not
the same as java(even the result of raw python codes)
  one case is:
  vector:[0.446141, 0.10414999999999996](that's not accurate)
  it's binary representation of IEEE754 is:

  dot product by java(or raw python) of x1*x1+x2*x2 is:
  but the result of pynum: x*x.T is:
  the last bit of mantissa is one difference.
  I don't floating points always hard to make sure to get same result
in different environment(not only hardware but also software such as
compiler optimizing and reordering)
  But I still want to know why, thanks.
  My environment:

Python 2.7.3 (default, Sep 26 2013, 20:03:06)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> numpy.version.version

More information about the NumPy-Discussion mailing list