A simple comparison of two double values in Java creates some problems. Let\'s consider the following simple code snippet in Java.
package doublecomparision;
double a = 1.000001; double b = 0.000001; System.out.println( a.compareTo(b) );
Returns:
-1 : 'a' is numerically less than 'b'.
0 : 'a' is equal to 'b'.
1 : 'a' is greater than 'b'.