Question: For Double/Float, there are some rounding errors and loss of precision when converting from decimal to binary representation.
For example, setting float to "6.1" and then printing it out again, you may get a reported value of something like "6.099999904632568359375". 
Which is the better option for checking equality of 2 Double objects :
Using BigDecimal
or
(Math.abs(double1 - double2) < epsilon)

Answer: 
With Guava, you have:

```java
DoubleMath.fuzzyEquals(double a, double b, double tolerance)

```

and

```java
DoubleMath.fuzzyCompare(double a, double b, double tolerance)

```

They are easier to use and more correct than writing "Math.abs(a-b) <= EPSILON". They cover the cases of Double.NaN and the infinities.
If you can use a library, you can use Apache Commons Math, there is a Precision class. Works the same way as previous answers.

```
boolean isEqual = Precision.equals(double x, double y, double eps);

```

link to [javadoc](http://commons.apache.org/proper/commons-math/javadocs/api-3.3/org/apache/commons/math3/util/Precision.html)