title: How can I convert an integer to float with rounding towards zero?
body: <p>When an integer is converted to floating-point, and the value cannot be directly represented by the destination type, the nearest value is usually selected (required by IEEE-754).</p>
  <p>I would like to convert an integer to floating-point with rounding towards zero in case the integer value cannot be directly represented by the floating-point type.</p>
  <p>Example:</p>
  <pre><code>int i = 2147483647;
  float nearest = static_cast&lt;float&gt;(i);  // 2147483648 (likely)
  float towards_zero = convert(i);        // 2147483520
  </code></pre>