title: C# Value Comparison
body: <p>I have compared two variable of different types with same values,</p>
  
  <pre><code>int i = 100;
  short s = (short)100;
  
  if (s == i)
  {
     return "Equals";
  }
  else
  {
    return "Not Equals";
  }
  
  float f = 100.5f;
  double d = 100.5d;
  
  if (d == f)
  {
     return "Equals";
  }
  else
  {
    return "Not Equals";
  }
  </code></pre>
  
  <p>The First comparison output is "Equal"
  and Second Comparison output is " Not Equal"</p>
  
  <p>My Question is 
  How same value for short &amp; int are Equal,
  If it is Equals then why not same value for float and double are equal.</p>
  
  <p>This is not only for float and double, If we compared decimal it will show compiler error.</p>