title: Why does casting to int not floor all doubles in C
body: <p>Given the C code:</p>
  
  <pre><code>#include &lt;math.h&gt;  
  #include &lt;stdio.h&gt;  
  int main(){  
   int i;  
   double f=log(2.0)/log(pow(2.0,1.0/2.0));  
   printf("double=%f\n",f);  
   printf("int=%d\n",(int) f);  
  }
  </code></pre>
  
  <p>I get the output:</p>
  
  <pre><code>double=2.000000
  int=1
  </code></pre>
  
  <p>f is apparently at least 2.0. Why is the cast value not 2?</p>