Class MathUtils.KahanSummator
java.lang.Object
com.esri.core.geometry.MathUtils.KahanSummator
- Enclosing class:
MathUtils
The implementation of the Kahan summation algorithm. Use to get better
precision when adding a lot of values.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate doubleprivate doubleprivate double -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidadd(double v) add a value.(package private) voidadd another summator.(package private) doubleReturns current value of the sum.(package private) MathUtils.KahanSummatorminusEquals(double v) (package private) MathUtils.KahanSummator(package private) MathUtils.KahanSummatorplusEquals(double v) (package private) MathUtils.KahanSummator(package private) voidreset()Resets the accumulated sum to zero.(package private) voidsub(double v) Subtracts a value.(package private) voidSubtracts another summator.
-
Field Details
-
sum
private double sum -
compensation
private double compensation -
startValue
private double startValue
-
-
Constructor Details
-
KahanSummator
KahanSummator(double startValue_) initialize to the given start value. \param startValue_ The value to be added to the accumulated sum.
-
-
Method Details
-
reset
void reset()Resets the accumulated sum to zero. The getResult() returns startValue_ after this call. -
add
void add(double v) add a value. -
sub
void sub(double v) Subtracts a value. -
add
add another summator. -
sub
Subtracts another summator. -
getResult
double getResult()Returns current value of the sum. -
plusEquals
-
minusEquals
-
plusEquals
-
minusEquals
-