title: Converting Float to Int32, with negative numbers fails, C
body: <p>I have the following function which is suppose to convert a floating point number to int32. The problem is that for negative numbers it just doesn't work (my if statement isn't executing). I've tried a similar program for a conversion from float to int16 and everything works just fine. Sry if this is too simple , but I just can't figure out what I'm missing and why it doesn't work for negative values.</p>
  
  <pre><code>#define MaxInt32 2147483647
  #define MinInt32 -2147483648
  …
  bool CastFloatToInt32 ( float  fNumber, int32 *ConvertedValue) {
      bool CastStatus = False;
  
      if ( ( fNumber &gt;= MinInt32 ) &amp;&amp; ( fNumber &lt;= MaxInt32 ) ) {
          *ConvertedValue = ( int32 ) ( fNumber );
          CastStatus = True;
  
      } else {
          if (fNumber &lt; MinInt32) {
              *ConvertedValue = MinInt32;
  
          } else {
              *ConvertedValue = MaxInt32;
          }
      }
  
      return CastStatus;
  }
  </code></pre>