List of utility methods to do Double Number Equal
boolean | doubleEqual(double d1, double d2) Returns whether the two specified double value are equal. double absDiff = Math.abs(d1 - d2); return absDiff < FP_EQUALITY_THRESHOLD; |
boolean | doubleEqual(double d1, double d2, double delta) double Equal if (delta < 0) { throw new IllegalArgumentException("Delta for doubleEqual cannot be < 0: " + delta); double diff = d1 - d2; return ((diff >= 0) && (diff < delta)) || ((diff < 0) && (diff > -delta)); |
boolean | doubleEqual(double v1, double v2) double Equal return (Double.isNaN(v1) && Double.isNaN(v2)) || Math.abs(v1 - v2) < epsilon;
|
boolean | doubleEquality(double v1, double v2, double epsilon) a pseudo-equality check for doubles return Math.abs(v1 - v2) < epsilon;
|
boolean | doubleEquals(double a, double b) Implements the semantics of Double#equals(Object) for two primitive doubles. return Double.doubleToLongBits(a) == Double.doubleToLongBits(b);
|
boolean | doubleEquals(double a, double b) double Equals return doubleEquals(a, b, DEFAULT_EPSILON);
|
boolean | doubleEquals(double a, double b) Returns true if the two doubles are within a small epsilon of each other. return Math.abs(a - b) < epsilon;
|
boolean | doubleEquals(double d1, double d2) double Equals return Double.compare(d1, d2) == 0;
|
boolean | doubleEquals(Double d1, Double d2) Check if the two Double values are equal by checking that the absolute value between them is less than 0.01 return Math.abs(d1 - d2) <= 0.01;
|
boolean | doubleEquals(double d1, double d2, double epsilon) double Equals return Math.abs(d1 - d2) <= epsilon;
|