title: Java Double Comparison
body: <p>Are there any java libraries for doing double comparison?
  e.g.</p>
  
  <pre><code>public static boolean greaterThanOrEqual(double a, double b, double epsilon){
       return a - b &gt; -epsilon;
  }
  </code></pre>
  
  <p>Every project I start I end up re-implementing this and copy-pasting code and test.</p>
  
  <p>NB a good example of why its better to use 3rd party JARs is that IBM recommend the following:</p>
  
  <blockquote>
    <p>"If you don't know the scale of the underlying measurements, using the
    test "abs(a/b - 1) &lt; epsilon" is likely to be more robust than simply
    comparing the difference"</p>
  </blockquote>
  
  <p>I doubt many people would have thought of this and illustrates that even simple code can be sub-optimal.</p>