title: What is the difference between casting long.MaxValue to int and casting float.MaxValue to int?
body: <p>I'm trying to understand difference between some data types and conversion.</p>
  
  <pre><code>public static void ExplicitTypeConversion2()
      {
          long longValue=long.MaxValue;
          float floatValue = float.MaxValue;
          int integerValue = (int) longValue;
          int integerValue2 = (int)floatValue;
          Console.WriteLine(integerValue);
          Console.WriteLine(integerValue2);            
      }
  </code></pre>
  
  <p>When I run that code block, it outputs:</p>
  
  <pre><code>-1
  -2147483648
  </code></pre>
  
  <p>I know that if the value you want to assign to an integer is bigger than that integer can keep, it returns the minimum value of integer (-2147483648).</p>
  
  <p>As far as I know, <code>long.MaxValue</code> is much bigger than the maximum value of an integer, but if I cast <code>long.MaxValue</code> to <code>int</code>, it returns -1.</p>
  
  <p>What is the difference these two casting? I think the first one also suppose to return -2147483648 instead of -1.</p>