Package org.planit.utils.math
Class Precision
- java.lang.Object
-
- org.planit.utils.math.Precision
-
public class Precision extends Object
compare doubles with a certain precision- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description static double
EPSILON_6
-
Constructor Summary
Constructors Constructor Description Precision()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
isEqual(double d1, double d2)
Compare using a Precision.EPSILON_6static boolean
isEqual(double d1, double d2, double epsilon)
Compare using a custom precision epsilonstatic boolean
isGreater(double d1, double d2)
isGreater with Precision.EPSILON_6static boolean
isGreater(double d1, double d2, double epsilon)
isGreaterEqual with epsilonstatic boolean
isGreaterEqual(double d1, double d2)
isGreaterEqual with Precision.EPSILON_6static boolean
isGreaterEqual(double d1, double d2, double epsilon)
isGreaterEqual with epsilonstatic boolean
isSmaller(double d1, double d2)
isSmaller with Precision.EPSILON_6static boolean
isSmaller(double d1, double d2, double epsilon)
isSmaller with epsilonstatic boolean
isSmallerEqual(double d1, double d2)
isSmallerEqual with Precision.EPSILON_6static boolean
isSmallerEqual(double d1, double d2, double epsilon)
isSmallerEqual with epsilon
-
-
-
Field Detail
-
EPSILON_6
public static final double EPSILON_6
- See Also:
- Constant Field Values
-
-
Method Detail
-
isEqual
public static boolean isEqual(double d1, double d2, double epsilon)
Compare using a custom precision epsilon- Parameters:
d1
- double1d2
- double2epsilon
- epsilon value- Returns:
- true when equal within epsilon, false otherwise
-
isEqual
public static boolean isEqual(double d1, double d2)
Compare using a Precision.EPSILON_6- Parameters:
d1
- double1d2
- double2- Returns:
- true when equal within epsilon, false otherwise
-
isSmallerEqual
public static boolean isSmallerEqual(double d1, double d2, double epsilon)
isSmallerEqual with epsilon- Parameters:
d1
- double1d2
- double2epsilon
- epsilon value- Returns:
- true when
d1 <= (d2 + epsilon)
-
isSmaller
public static boolean isSmaller(double d1, double d2)
isSmaller with Precision.EPSILON_6- Parameters:
d1
- double1d2
- double2- Returns:
- true when
(d1 + epsilon) < d2
-
isSmaller
public static boolean isSmaller(double d1, double d2, double epsilon)
isSmaller with epsilon- Parameters:
d1
- double1d2
- double2epsilon
- epsilon value- Returns:
- true when
d1 <= (d2 + epsilon)
-
isSmallerEqual
public static boolean isSmallerEqual(double d1, double d2)
isSmallerEqual with Precision.EPSILON_6- Parameters:
d1
- double1d2
- double2- Returns:
- true when
(d1 + epsilon) <= d2
-
isGreaterEqual
public static boolean isGreaterEqual(double d1, double d2, double epsilon)
isGreaterEqual with epsilon- Parameters:
d1
- double1d2
- double2epsilon
- epsilon value- Returns:
- true when
d1 >= (d2 - epsilon)
-
isGreaterEqual
public static boolean isGreaterEqual(double d1, double d2)
isGreaterEqual with Precision.EPSILON_6- Parameters:
d1
- double1d2
- double2- Returns:
- true when
(d1 - epsilon) >= d2
-
isGreater
public static boolean isGreater(double d1, double d2, double epsilon)
isGreaterEqual with epsilon- Parameters:
d1
- double1d2
- double2epsilon
- epsilon value- Returns:
- true when
d1 > (d2 - epsilon)
-
isGreater
public static boolean isGreater(double d1, double d2)
isGreater with Precision.EPSILON_6- Parameters:
d1
- double1d2
- double2- Returns:
- true when
(d1 - epsilon) > d2
-
-