title: Why can't I multiply a float?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/590822/dealing-with-accuracy-problems-in-floating-point-numbers">Dealing with accuracy problems in floating-point numbers</a>  </p>
  </blockquote>
  
  
  
  <p>I was quite surprised why I tried to multiply a float in C (with GCC 3.2) and that it did not do as I expected.. As a sample:</p>
  
  <pre><code>int main() {
    float nb = 3.11f;
    nb *= 10;
    printf("%f\n", nb);
  }
  </code></pre>
  
  <p>Displays: 31.099998</p>
  
  <p>I am curious regarding the way floats are implemented and why it produces this unexpected behavior?</p>