title: C- Floating point precision
body: <p>I have a program:</p>
  
  <pre><code>int main() 
  {   
          float f = 0.0f;  
          int i;  
  
          for (i = 0 ; i &lt; 10 ; i++) 
                  f = f + 0.1f; 
  
          if (f == 1.0f) 
                  printf("f is 1.0 \n"); 
          else 
                  printf("f is NOT 1.0\n"); 
  
          return 0; 
  } 
  </code></pre>
  
  <p>It always prints <code>f is NOT 1.0</code>. I understand this is related to floating point precision in C. But I am not sure exactly where it is getting messed up. Can someone please explain me why it is not printing the other line? </p>