java.lang.Object
com.pervasive.datarush.operators.assertion.AbsoluteErrorBound
- All Implemented Interfaces:
FloatingPointTolerance
Checks equivalence based on the absolute error between two floating point
numbers. Two values are considered equal if this error is less than a
fixed bound.
Specifically, for two values v1 and v2 and a
non-negative bound e, it is checked whether
Math.abs(v1 - v2) <= e
- See Also:
-
Field Summary
Fields inherited from interface com.pervasive.datarush.operators.assertion.FloatingPointTolerance
EXACT -
Constructor Summary
ConstructorsConstructorDescriptionAbsoluteErrorBound(double epsilon) Define a fixed bound on the absolute error of two floating point numbers. -
Method Summary
Modifier and TypeMethodDescriptiondoubleGets the maximum absolute difference allowed between values.booleanisWithinTolerance(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.
-
Constructor Details
-
AbsoluteErrorBound
public AbsoluteErrorBound(double epsilon) Define a fixed bound on the absolute error of two floating point numbers.- Parameters:
epsilon- the fixed bound on the error- Throws:
com.pervasive.datarush.graphs.physical.InvalidPropertyValueException- ifepsilonis negative.
-
-
Method Details
-
isWithinTolerance
public boolean isWithinTolerance(float value1, float value2) Description copied from interface:FloatingPointToleranceIndicates whether the specified values are equal under the tolerance.- Specified by:
isWithinTolerancein interfaceFloatingPointTolerance- Parameters:
value1- the first value to comparevalue2- the second value to compare- Returns:
trueif the two values lie with the error bounds, otherwisefalse
-
isWithinTolerance
public boolean isWithinTolerance(double value1, double value2) Description copied from interface:FloatingPointToleranceIndicates whether the specified values are equal under the tolerance.- Specified by:
isWithinTolerancein interfaceFloatingPointTolerance- Parameters:
value1- the first value to comparevalue2- the second value to compare- Returns:
trueif the two values lie with the error bounds, otherwisefalse
-
isWithinTolerance
Description copied from interface:FloatingPointToleranceIndicates whether the specified values are equal under the tolerance.- Specified by:
isWithinTolerancein interfaceFloatingPointTolerance- Parameters:
value1- the first value to comparevalue2- the second value to compare- Returns:
trueif the two values lie with the error bounds, otherwisefalse
-
getEpsilon
public double getEpsilon()Gets the maximum absolute difference allowed between values.- Returns:
- the absolute error bound
-