title: Adding floats does not yield a correct result
body: <p>Imagine the following situation.
  Amounts are added to a total in a loop:</p>
  
  <pre><code>float total = 0;
  float[] amounts = new float[]{...};
  foreach(float amount in amounts)
  {
    total += amount;
  }
  </code></pre>
  
  <p><code>total</code>, as wel as all the <code>amount</code>s are written to a database.
  When I calculate <code>SUM(amount)</code> in SQL, it results in a value that differs from <code>total</code>.
  Moreover, when I do the same calculation in C#, but this time adding the amounts to a value of type double,</p>
  
  <pre><code>double total = 0;
  //the rest of the code is the same as above
  </code></pre>
  
  <p>then <code>total</code> represents the correct value.</p>
  
  <p>Could this be caused by the difference in precision between a float and a double?</p>
  
  <p>Note that it depends on the values. Most of the results of this calculation <em>are</em> correct.</p>