title: Why python numpy sum() is giving different value than +?
body: <p>I have two arrays with two rows each, using which I am trying to do some calculation. Last step in calculation is to sum. When I try to sum using <code>.sum()</code>, it gives one answer, and when I try to manually sum with <code>+</code> by explicitly indexing each row, it gives different answer:</p>
  <pre><code>&gt;&gt;&gt; ad=[[0.,0.,0.,-0.91,0.34],[0.,0.,1.,0.93,0.65]]
  &gt;&gt;&gt; nad=np.array(ad)
  &gt;&gt;&gt; W=[[0.29,0.],[0.23,0.]]
  &gt;&gt;&gt; NW = np.array(W)
  &gt;&gt;&gt; (nad[:,4] * (nad[:,3] + 0.96 * NW[nad[:,2].astype(int)][0][0])).sum() #use sum() on row 0 and 1
  0.5707160000000001
  &gt;&gt;&gt; (nad[0,4] * (nad[0,3] + 0.96 * NW[nad[0,2].astype(int)][0])) #calculate by explicitly indexing row 0
  -0.21474400000000005
  &gt;&gt;&gt; (nad[1,4] * (nad[1,3] + 0.96 * NW[nad[1,2].astype(int)][0])) #calculate by explicitly indexing row 0
  0.74802
  &gt;&gt;&gt; (nad[0,4] * (nad[0,3] + 0.96 * NW[nad[0,2].astype(int)][0])) +  (nad[1,4] * (nad[1,3] + 0.96 * NW[nad[1,2].astype(int)][0])) #calculate by explicitly indexing row 0 and row 1
  0.533276
  </code></pre>
  <p>The difference (0.57071-0.533276) might look small, but it blows with iterative calculations. I feel both approaches should give same values, right? But then why they are giving different values? What my eyes are missing?</p>
  <p>Even <a href="https://www.google.com/search?q=0.74802-0.21474400000000005" rel="nofollow noreferrer">manually doing sum</a> gives later answer (one with <code>+</code>). Is numpy <code>sum()</code> doing something else which I dont know?</p>