Simplified calculation, removing extra division.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@140922 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7c57c2ed60
commit
5179d78ef8
|
@ -180,7 +180,8 @@ public class StatUtils {
|
|||
accum += Math.pow((values[i] - mean), 2.0);
|
||||
accum2 += (values[i] - mean);
|
||||
}
|
||||
variance = (accum - (Math.pow(accum2,2)/(double)values.length)) / (double)(values.length - 1);
|
||||
variance = ((accum*(double)values.length) - Math.pow(accum2,2)) /
|
||||
(double)(values.length*(values.length - 1));
|
||||
}
|
||||
return variance;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue