@Internal public class CompensatedSum extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
static CompensatedSum |
ZERO |
Constructor and Description |
---|
CompensatedSum(double value,
double delta)
Used to calculate sums using the Kahan summation algorithm
|
Modifier and Type | Method and Description |
---|---|
CompensatedSum |
add(CompensatedSum other)
Increments the Kahan sum by adding two sums, and updating the correction term for reducing numeric errors
|
CompensatedSum |
add(double value)
Increments the Kahan sum by adding a value without a correction term
|
CompensatedSum |
add(double value,
double delta)
Increments the Kahan sum by adding a value and a correction term
|
double |
delta()
The correction term
|
double |
value()
The value of the sum
|
public static final CompensatedSum ZERO
public CompensatedSum(double value, double delta)
value
- the sumdelta
- correction termpublic double value()
public double delta()
public CompensatedSum add(double value, double delta)
public CompensatedSum add(double value)
public CompensatedSum add(CompensatedSum other)
Copyright © 2014–2016 The Apache Software Foundation. All rights reserved.