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
FieldsModifier and TypeFieldDescriptionstatic final FloatingPointToleranceA tolerance requiring exact value equivalence. -
Method Summary
Modifier and TypeMethodDescriptionbooleanisWithinTolerance(double value1, double value2) Indicates whether the specified values are equal under the tolerance.booleanisWithinTolerance(float value1, float value2) Indicates whether the specified values are equal under the tolerance.booleanisWithinTolerance(BigDecimal value1, BigDecimal value2) Indicates whether the specified values are equal under the tolerance.
-
Field Details
-
EXACT
A tolerance requiring exact value equivalence.
-
-
Method Details
-
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:
trueif 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:
trueif the two values lie with the error bounds, otherwisefalse
-
isWithinTolerance
Indicates whether the specified values are equal under the tolerance.- Parameters:
value1- the first value to comparevalue2- the second value to compare- Returns:
trueif the two values lie with the error bounds, otherwisefalse
-