From e42ab0ec6c4a1b7838ec9f14143126d4b6cad548 Mon Sep 17 00:00:00 2001
From: Phil Steitz m = m + (new value - m) / (number of observations)
*
- * Returns Double.NaN
if the dataset is empty.
Double.NaN
if the dataset is empty. Note that
+ * Double.NaN may also be returned if the input includes NaN and / or infinite
+ * values.
* * Note that this implementation is not synchronized. If * multiple threads access an instance of this class concurrently, and at least diff --git a/src/main/java/org/apache/commons/math3/stat/descriptive/moment/SecondMoment.java b/src/main/java/org/apache/commons/math3/stat/descriptive/moment/SecondMoment.java index 5caeca385..12715c09c 100644 --- a/src/main/java/org/apache/commons/math3/stat/descriptive/moment/SecondMoment.java +++ b/src/main/java/org/apache/commons/math3/stat/descriptive/moment/SecondMoment.java @@ -36,7 +36,9 @@ import org.apache.commons.math3.util.MathUtils; * new value = old value + dev^2 * (n -1) / n.
*
* Returns Double.NaN
if no data values have been added and
- * returns 0
if there is just one value in the data set.
0
if there is just one value in the data set.
+ * Note that Double.NaN may also be returned if the input includes NaN
+ * and / or infinite values.
* * Note that this implementation is not synchronized. If * multiple threads access an instance of this class concurrently, and at least