title: Double vs Decimal Rounding in C#
body: <p>Why does:</p>
  
  <pre><code>double dividend = 1.0;
  double divisor = 3.0;
  Console.WriteLine(dividend / divisor * divisor);
  </code></pre>
  
  <p>output 1.0, </p>
  
  <p>but:</p>
  
  <pre><code>decimal dividend = 1;
  decimal divisor = 3;
  Console.WriteLine(dividend / divisor * divisor);
  </code></pre>
  
  <p>outputs 0.9999999999999999999999999999</p>
  
  <p>?</p>
  
  <p>I understand that 1/3 can't be computed exactly, so there must be some rounding.
  But why does Double round the answer to 1.0, but Decimal does not?</p>
  
  <p>Also, why does double compute 1.0/3.0 to be 0.33333333333333331?
  If rounding is used, then wouldn't the last 3 get rounded to 0, why 1?</p>