title: C floating point precision
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/7011184/floating-point-comparison">Floating point comparison</a>  </p>
  </blockquote>
  
  
  
  <p>I have a problem about the accuracy of float in C/C++. When I execute the program below:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main (void) {
      float a = 101.1;
      double b = 101.1;
      printf ("a: %f\n", a);
      printf ("b: %lf\n", b);
      return 0;
  }
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>a: 101.099998
  b: 101.100000
  </code></pre>
  
  <p>I believe float should have 32-bit so should be enough to store 101.1 Why?</p>