title: Why C# compares "the same" floating numbers in C# different
body: <pre><code>float a = 0.95f;
  float b = 5.05f;
  float ab = (a + b);
  bool isTrue = (ab == 6.0f);
  bool isFalse = ((a + b) == 6.0f);
  bool isTrueAgain = ((float)(a + b) == 6.0f);
  </code></pre>
  
  <p>Why <em>isTrue</em> is true?</p>
  
  <p>Why <em>isFalse</em> is false?</p>
  
  <p><a href="https://i.stack.imgur.com/cgHxe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cgHxe.png" alt="enter image description here"></a></p>