Package it.unimi.dsi.law.util
Class KahanSummation
java.lang.Object
it.unimi.dsi.law.util.KahanSummation
public class KahanSummation extends Object
Kahan's
summation algorithm encapsulated in an object.
-
Constructor Summary
Constructors Constructor Description KahanSummation()
-
Method Summary
-
Constructor Details
-
KahanSummation
public KahanSummation()
-
-
Method Details
-
add
public void add(double v)Adds a value.- Parameters:
v
- the value to be added to the sum.
-
value
public double value()Returns the sum computed so far.- Returns:
- the sum computed so far.
-
reset
public void reset()Resets the current value and correction to zero.
-