Package com.esri.core.geometry
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 double
private double
private double
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) void
add
(double v) add a value.(package private) void
add another summator.(package private) double
Returns current value of the sum.(package private) MathUtils.KahanSummator
minusEquals
(double v) (package private) MathUtils.KahanSummator
(package private) MathUtils.KahanSummator
plusEquals
(double v) (package private) MathUtils.KahanSummator
(package private) void
reset()
Resets the accumulated sum to zero.(package private) void
sub
(double v) Subtracts a value.(package private) void
Subtracts 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
-