title: C++ How to correctly round a const float to unsigned int
body: <p>So I have a const float that has a range from 0.0 to 1.0. What is the correct way to cast this to an unsigned int either by rounding or truncating?</p>
  
  <p>Would this be acceptable?</p>
  
  <pre><code>const float f=0.5f;
  unsigned int i=static_cast&lt;unsigned int&gt;(f);
  </code></pre>