Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is due to the inherent imprecision in floating point arithmetic. Mathematically, the associative law holds for addition. Namely:</p> <pre><code>a + (b + c) = (a + b) + c </code></pre> <p>But that is not true for floating point arithmetic on a finite machine. And when you sum the elements in a different order, you therefore can get different answers.</p> <p>You might wonder how it can be that the associative law does not hold for floating point arithmetic. That is all down to the fact that not all numbers are representable. This might come as a surprise to you, but even numbers as apparently simple as 0.1 are not representable exactly with binary floating point data types.</p> <p>So, when the computer calculates <code>a + b</code>, the true exact result might not be representable. The computer does the best it can and gives you the closest number to the exact value that is exactly representable. And this is where the imprecision arises.</p> <p>Required reading on this subject: <a href="http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html" rel="nofollow">What Every Computer Scientist Should Know About Floating-Point Arithmetic</a>.</p> <blockquote> <p>Which sum is correct for the first matrix?</p> </blockquote> <p>That is impossible to say from here, although almost certainly none of them are exactly correct. It's quite likely that the values that you hold in the matrix <code>a</code> are already approximations to the true value so even the definition of what you mean by <em>correct</em> is hard to pin down.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload