title: Is floating-point addition and multiplication associative?
body: <p>I had a problem when I was adding three floating point values and comparing them to 1.</p>
  
  <pre><code>cout &lt;&lt; ((0.7 + 0.2 + 0.1)==1)&lt;&lt;endl;     //output is 0
  cout &lt;&lt; ((0.7 + 0.1 + 0.2)==1)&lt;&lt;endl;     //output is 1
  </code></pre>
  
  <p>Why would these values come out different?</p>