Module datarush.library
Interface FloatingPointTolerance
-
- All Known Implementing Classes:
AbsoluteErrorBound
,ExactTolerance
,RelativeErrorBound
,UlpDistanceBound
public interface FloatingPointTolerance
Represents allowable error bounds for comparing the equality of two floating point numbers.
-
-
Field Summary
Fields Modifier and Type Field Description static FloatingPointTolerance
EXACT
A tolerance requiring exact value equivalence.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
isWithinTolerance(double value1, double value2)
Indicates whether the specified values are equal under the tolerance.boolean
isWithinTolerance(float value1, float value2)
Indicates whether the specified values are equal under the tolerance.boolean
isWithinTolerance(BigDecimal value1, BigDecimal value2)
Indicates whether the specified values are equal under the tolerance.
-
-
-
Field Detail
-
EXACT
static final FloatingPointTolerance EXACT
A tolerance requiring exact value equivalence.
-
-
Method Detail
-
isWithinTolerance
boolean isWithinTolerance(float value1, float value2)
Indicates whether the specified values are equal under the tolerance.- Parameters:
value1
- the first value to comparevalue2
- the second value to compare- Returns:
true
if the two values lie with the error bounds, otherwisefalse
-
isWithinTolerance
boolean isWithinTolerance(double value1, double value2)
Indicates whether the specified values are equal under the tolerance.- Parameters:
value1
- the first value to comparevalue2
- the second value to compare- Returns:
true
if the two values lie with the error bounds, otherwisefalse
-
isWithinTolerance
boolean isWithinTolerance(BigDecimal value1, BigDecimal value2)
Indicates whether the specified values are equal under the tolerance.- Parameters:
value1
- the first value to comparevalue2
- the second value to compare- Returns:
true
if the two values lie with the error bounds, otherwisefalse
-
-