public class PrecisionUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static double |
calculateFraction(int shift)
Computes the smallest double that is yet recognizable (by comparison)
when shifting the default scale up by the given amount.
|
static boolean |
equal(double d1,
double d2) |
static boolean |
equal(double d1,
double d2,
int shift)
Tests whether the two values are regarded to be equal w.r.t. the given
shift.
|
static boolean |
greater(double d1,
double d2) |
static boolean |
greater(double d1,
double d2,
int shift)
Tests whether the first given value is regarded to be greater than the
second value w.r.t. the given shift.
|
static boolean |
greaterEqual(double d1,
double d2) |
static boolean |
greaterEqual(double d1,
double d2,
int shift)
Tests whether the first given value is regarded to be greater or equal
than the second value w.r.t. the given shift.
|
static boolean |
smaller(double d1,
double d2) |
static boolean |
smaller(double d1,
double d2,
int shift)
Tests whether the first given value is regarded to be smaller than the
second value w.r.t. the given shift.
|
static boolean |
smallerEqual(double d1,
double d2) |
static boolean |
smallerEqual(double d1,
double d2,
int shift)
Tests whether the first given value is regarded to be smaller or equal
than the second value w.r.t. the given shift.
|
public static final double calculateFraction(int shift)
shift
- the number of digits to shift precision up (may be negative
number)public static final boolean equal(double d1, double d2)
d1
- The first operand.d2
- The second operand.equal(double, double, int)
public static final boolean equal(double d1, double d2, int shift)
d1
- the first value to testd2
- the second value to testshift
- the delta shift used for this testtrue
in case the given two values are identical or
differ from each other by an amount that is smaller than what is
recognizable by the shifted delta, false
otherwisepublic static final boolean greater(double d1, double d2)
d1
- The first operand.d2
- The second operand.greater(double, double, int)
public static final boolean greater(double d1, double d2, int shift)
d1
- the first value to testd2
- the second value to testshift
- the delta shift used for this testtrue
in case the first value is greater than the
second value by an amount recognizable by the shifted delta,
false
otherwisepublic static final boolean greaterEqual(double d1, double d2)
d1
- The first operand.d2
- The second operand.greaterEqual(double, double, int)
public static final boolean greaterEqual(double d1, double d2, int shift)
d1
- the first value to testd2
- the second value to testshift
- the delta shift used for this testtrue
in case the first value is greater than the
second value by an amount recognizable by the given scale or
differs from it by an amount not recognizable by the shifted
delta, false
otherwisepublic static final boolean smaller(double d1, double d2)
d1
- The first operand.d2
- The second operand.smaller(double, double, int)
public static final boolean smaller(double d1, double d2, int shift)
d1
- the first value to testd2
- the second value to testshift
- the delta shift used for this testtrue
in case the first value is smaller than the
second value by an amount recognizable by the shifted delta,
false
otherwisepublic static final boolean smallerEqual(double d1, double d2)
d1
- The first operand.d2
- The second operand.smallerEqual(double, double, int)
public static final boolean smallerEqual(double d1, double d2, int shift)
d1
- the first value to testd2
- the second value to testshift
- the delta shift used for this testtrue
in case the first value is smaller than the
second value by an amount recognizable by the given scale or
differs from it by an amount not recognizable by the shifted
delta, false
otherwiseCopyright (c) 2014 itemis AG, and others. All rights reserved.