title: math.h ceil not working as expected in C
body: <p>How come ceil() rounds up an even floating with no fractional parts?<br>
  When I try to do this:  </p>
  
  <pre><code>double x = 2.22;  
  x *= 100; //which becomes 222.00...  
  printf("%lf", ceil(x)); //prints 223.00... (?)  
  </code></pre>
  
  <p>But when I change the value of 2.22 to 2.21  </p>
  
  <pre><code>x *= 100; //which becomes 221.00...  
  printf("%lf", ceil(x)); //prints 221.00... as expected  
  </code></pre>
  
  <p>I tried to do it another way like this using modf() and encountered another strange thing:    </p>
  
  <pre><code>double x = 2.22 * 100;  
  double num, fraction;  
  fraction = modf(x, &amp;num);  
  if(fraction &gt; 0)  
      num += 1; //goes inside here even when fraction is 0.00...  
  </code></pre>
  
  <p>So what happens is 0.000... is greater than 0?<br>
  Can anyone explain why both of these situations are happening? Also I'm compiling using cc version 4.1.2 in RedHat.  </p>