title: Casting a result to float in method returning float changes result
body: <p>Why does this code print <code>False</code> in .NET 4?  It seems some unexpected behavior is being caused by the explicit cast.</p>
  
  <p>I'd like an answer beyond "floating point is inaccurate" or "don't do that".</p>
  
  <pre><code>float a(float x, float y)
  {
    return ( x * y );
  }
  
  float b(float x, float y)
  {
    return (float)( x * y );
  }
  
  void Main()
  {
    Console.WriteLine( a( 10f, 1f/10f ) == b( 10f, 1f/10f ) );
  }
  </code></pre>
  
  <p>PS: This code came from a unit test, not release code. The code was written this way deliberately. I suspected it would fail eventually but I wanted to know exactly when and exactly why. The answer proves the validity of this technique because it provides an understanding that goes beyond the usual understanding of floating point determinism. And that was the point of writing this code this way; deliberate exploration.</p>
  
  <p>PPS: The unit test was passing in .NET 3.5, but now fails after the upgrade to .NET 4.</p>