title: Printing a float after rounding to 4 places
body: <p>I have a rounding function, </p>
  
  <pre><code>float myround(float x, int places)
  {
     float const shift = powf(10.0f, places);
     x *= shift;
     x = floorf(x + 0.5f);
     x /= shift;
  
     return x;
  }
  </code></pre>
  
  <p>When I try to round of numbers to lets say 4 decimal places and then print the number with</p>
  
  <pre><code>printf("%f ", x); 
  </code></pre>
  
  <p>I get the number without rounding. If I print it with</p>
  
  <pre><code>printf("%.4f ", x);
  </code></pre>
  
  <p>I get the number rounded to 4 places. Should the first printf not print the number to 4 decimal places as I have already rounded the number?</p>
  
  <p>Thanks.</p>