title: Compare double to zero using epsilon
body: <p>Today, I was looking through some C++ code (written by somebody else) and found this section:</p>
  
  <pre><code>double someValue = ...
  if (someValue &lt;  std::numeric_limits&lt;double&gt;::epsilon() &amp;&amp; 
      someValue &gt; -std::numeric_limits&lt;double&gt;::epsilon()) {
    someValue = 0.0;
  }
  </code></pre>
  
  <p>I'm trying to figure out whether this even makes sense.</p>
  
  <p>The documentation for <code>epsilon()</code> says:</p>
  
  <blockquote>
    <p>The function returns the difference between 1 and the smallest value greater than 1 that is representable [by a double].</p>
  </blockquote>
  
  <p>Does this apply to 0 as well, i.e. <code>epsilon()</code> is the smallest value greater than 0? Or are there numbers between <code>0</code> and <code>0 + epsilon</code> that can be represented by a <code>double</code>?</p>
  
  <p>If not, then isn't the comparison equivalent to <code>someValue == 0.0</code>?</p>