title: Does casting to an int after std::floor guarantee the right result?
body: <p>I'd like a <code>floor</code> function with the syntax</p>
  
  <pre><code>int floor(double x);
  </code></pre>
  
  <p>but <code>std::floor</code> returns a <code>double</code>. Is</p>
  
  <pre><code>static_cast &lt;int&gt; (std::floor(x));
  </code></pre>
  
  <p>guaranteed to give me the correct integer, or could I have an off-by-one problem? It seems to work, but I'd like to know for sure.</p>
  
  <p>For bonus points, why the heck does <code>std::floor</code> return a <code>double</code> in the first place?</p>