public class RelativeErrorBound extends Object implements FloatingPointTolerance
Specifically, for two values v1
and v2
where v1 > v2
and a non-negative bound e
, it is checked whether
Math.abs((v1 - v2)/v1) <= e
EXACT
Constructor and Description |
---|
RelativeErrorBound(double epsilon)
Define a fixed bound on the relative error of two floating point
numbers.
|
Modifier and Type | Method and Description |
---|---|
double |
getEpsilon()
Gets the maximum percentage difference allowed between two values.
|
boolean |
isWithinTolerance(BigDecimal value1,
BigDecimal value2)
Indicates whether the specified values are equal under the tolerance.
|
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.
|
public RelativeErrorBound(double epsilon)
epsilon
- the fixed bound on the errorcom.pervasive.datarush.graphs.physical.InvalidPropertyValueException
- if epsilon
is
negative.public boolean isWithinTolerance(float value1, float value2)
FloatingPointTolerance
isWithinTolerance
in interface FloatingPointTolerance
value1
- the first value to comparevalue2
- the second value to comparetrue
if the two values lie with the error bounds,
otherwise false
public boolean isWithinTolerance(double value1, double value2)
FloatingPointTolerance
isWithinTolerance
in interface FloatingPointTolerance
value1
- the first value to comparevalue2
- the second value to comparetrue
if the two values lie with the error bounds,
otherwise false
public boolean isWithinTolerance(BigDecimal value1, BigDecimal value2)
FloatingPointTolerance
isWithinTolerance
in interface FloatingPointTolerance
value1
- the first value to comparevalue2
- the second value to comparetrue
if the two values lie with the error bounds,
otherwise false
public double getEpsilon()
Copyright © 2024 Actian Corporation. All rights reserved.