|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfr.cnes.sirius.patrius.utils.Comparators
public final class Comparators
- Static comparison methods for real numbers
- Classical methods to compare doubles using an epsilon, as an input or with a default value
See DV-MATHS_30.
Those methods can be used this way : if (greaterOrEqual(x, y)) {...}
The condition is "true" if x is greater or equal to y (with a relative comparison using the default epsilon)
Field Summary | |
---|---|
static double |
DOUBLE_COMPARISON_EPSILON
The epsilon used for doubles relative comparison |
Method Summary | |
---|---|
static boolean |
equals(double x,
double y)
Tests the equality between doubles with a relative comparison using a default epsilon. |
static boolean |
equals(double x,
double y,
double eps)
Tests the equality between doubles with a relative comparison using an input epsilon. |
static boolean |
equalsWithRelativeTolerance(double x,
double y,
double eps)
Copied from commons math Precision.equalsWithRelativeTolerance(double, double, double) . |
static boolean |
greaterOrEqual(double x,
double y)
Tests if a double is greater or equal to another with a relative comparison using a default epsilon. |
static boolean |
greaterOrEqual(double x,
double y,
double eps)
Tests if a double is greater or equal to another with a relative comparison using an input epsilon. |
static boolean |
greaterStrict(double x,
double y)
Tests if a double is strictly greater than another with a relative comparison using a default epsilon. |
static boolean |
greaterStrict(double x,
double y,
double eps)
Tests if a double is strictly greater than another with a relative comparison using an input epsilon. |
static boolean |
lowerOrEqual(double x,
double y)
Tests if a double is lower or equal to another with a relative comparison using a default epsilon. |
static boolean |
lowerOrEqual(double x,
double y,
double eps)
Tests if a double is lower or equal to another with a relative comparison using an input epsilon. |
static boolean |
lowerStrict(double x,
double y)
Tests if a double is strictly lower than another with a relative comparison using a default epsilon. |
static boolean |
lowerStrict(double x,
double y,
double eps)
Tests if a double is strictly lower than another with a relative comparison using an input epsilon. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final double DOUBLE_COMPARISON_EPSILON
Method Detail |
---|
public static boolean equals(double x, double y)
x
- first double to be comparedy
- second double to be compared
The value "Nan" as input always imply the return "false"
public static boolean equals(double x, double y, double eps)
x
- first double to be comparedy
- second double to be comparedeps
- epsilon used in the relative comparison
The value "Nan" as input always imply the return "false"
public static boolean lowerOrEqual(double x, double y)
x
- first double to be comparedy
- second double to be compared
The value "Nan" as input always imply the return "false"
public static boolean lowerOrEqual(double x, double y, double eps)
x
- first double to be comparedy
- second double to be comparedeps
- epsilon used in the relative comparison
The value "Nan" as input always imply the return "false"
public static boolean greaterOrEqual(double x, double y)
x
- first double to be comparedy
- second double to be compared
The value "Nan" as input always imply the return "false"
public static boolean greaterOrEqual(double x, double y, double eps)
x
- first double to be comparedy
- second double to be comparedeps
- epsilon used in the relative comparison
The value "Nan" as input always imply the return "false"
public static boolean lowerStrict(double x, double y)
x
- first double to be comparedy
- second double to be compared
The value "Nan" as input always imply the return "false"
public static boolean lowerStrict(double x, double y, double eps)
x
- first double to be comparedy
- second double to be comparedeps
- epsilon used in the relative comparison
The value "Nan" as input always imply the return "false"
public static boolean equalsWithRelativeTolerance(double x, double y, double eps)
Precision.equalsWithRelativeTolerance(double, double, double)
.
Returns true
if the difference between the number is smaller or equal
to the given tolerance.
The difference is the call to the Precision.equals(double, double, int)
. The ulp is 0 instead of 1. This
means that two adjacent numbers are not considered equal.
x
- First value.y
- Second value.eps
- Amount of allowed relative error.
true
if the values are two adjacent floating point
numbers or they are within range of each other.public static boolean greaterStrict(double x, double y)
x
- first double to be comparedy
- second double to be compared
The value "Nan" as input always imply the return "false"
public static boolean greaterStrict(double x, double y, double eps)
x
- first double to be comparedy
- second double to be comparedeps
- epsilon used in the relative comparison
The value "Nan" as input always imply the return "false"
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |