title: C# floating point rounding behavior
body: <p>I have been trying to solve a bug that was caused by floating point arithmetic and I reduced it to a simple piece of code that is causing the behavior I don't understand:</p>
  
  <pre><code>float one = 1;
  float three = 3;
  
  float result = one / three;
  Console.WriteLine(result); // prints 0.33333
  
  double back = three * result;
  
  if (back &gt; 1.0)
      Console.WriteLine("larger than one");
  else if (back &lt; 1.0)
      Console.WriteLine("less than one");
  else
      Console.WriteLine("exactly one");
  </code></pre>
  
  <p>As result rounded to 0.33333, I would expect back to be less that 1, however the output is "larger than one".</p>
  
  <p>Can someone explain what is going on here?</p>