title: Is it safe to test a float for 0.0 equality?
body: <p>I know it's dangerous to test floats for equality due to precision errors but is it safe to test for zero? I can think of some cases, for example in optimizing special cases in algorithms, where you would want to do this. The question is regarding floats but I would assume the answer also applies to doubles as well.</p>
  
  <p>Consider the following code:</p>
  
  <pre><code>float factor = calculateFactor();
  if(factor != 0.0f)
      applyComplexAlgorithm(factor);
  </code></pre>