title: Comparison to 0.0 with floating point values
body: <p>When using floating point numbers, there can sometimes be rounding issues. Because of this, it is usually not recommended to compare the result of calculations with == or != and instead to use an appropriate bound like <code>abs(a-b)&lt;1.0e-10</code>.</p>
  
  <p>But would it be appropriate to use it to compare to <code>0.0</code>?</p>
  
  <p>Here is what I am talking about:</p>
  
  <pre><code>double foo(){
      //code which can return values that aren't 0.0
      //all returns are either literals or global variables defined with literals
      return 0.0;
  }
  </code></pre>
  
  <p>Here <code>f</code> will always return either exactly <code>0.0</code> or a number that is unambiguously not <code>0.0</code>. Specifically, the numbers will all have magnitudes greater than <code>0.1</code> but less than <code>2.0</code>.</p>
  
  <p>Will <code>0.0==foo()</code> always be <code>true</code> if it returns <code>0.0</code>? Is it possible for <code>0.0==foo()</code> to be <code>true</code> if <code>foo</code> returns a value other than <code>0.0</code>?</p>