title: Is it safe to cast result of ceil to integer?
body: <p><code>ceil</code> function in <code>C</code> is declared as <code>double ceil(double)</code>. Is it safe to cast return value of the function to <code>int</code>? I mean is there any guarantee that the following will never occur (the sample is just to illustrate of what I mean)?</p>
  
  <pre><code>double r = ceil(234235.53453);
  // imagine r = 234235.9999999 due to round errors or
  // due to the peculiarities of the machine arithmetics, etc.
  int i = (int)r;
  // i = 234235, but must be 234236
  </code></pre>
  
  <p>Of course, I know that the range of <code>double</code> is large than the range of <code>int</code>, so the cast may fail. My question is not about it, but about rounding errors or machine arithmetics side effects.</p>