com.jivesoftware.util
Class DoubleEqualityComparator
java.lang.Object
com.jivesoftware.util.DoubleEqualityComparator
public final class DoubleEqualityComparator
- extends java.lang.Object
This class determines the parameters of the floating point representation and provides
methods for comparing the equality of floating point numbers.
"This material from The Java(tm) Specialists' Newsletter by Maximum Solutions (South Africa).
Please contact Maximum Solutions for more information."
(http://www.javaspecialists.co.za/archive/Issue044.html)
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
getRadix
public static int getRadix()
getMachinePrecision
public static double getMachinePrecision()
defaultNumericalPrecision
public static double defaultNumericalPrecision()
equals
public static boolean equals(double a,
double b)
- Returns:
- true if the difference between a and b is less than the default numerical precision
equals
public static boolean equals(double a,
double b,
double precision)
- Returns:
- true if the relative difference between a and b is less than precision
Copyright © 1999-2006 Jive Software.