Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6623)

Unified Diff: chrome/common/extensions/docs/examples/extensions/benchmark/options.html

Issue 7108006: The benchmarking tool calculates the population variance rather than the sample variance. Since ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/docs/examples/extensions/benchmark/options.html
===================================================================
--- chrome/common/extensions/docs/examples/extensions/benchmark/options.html (revision 85279)
+++ chrome/common/extensions/docs/examples/extensions/benchmark/options.html (working copy)
@@ -162,16 +162,20 @@
return sum / count;
}
-// Compute the standard deviation of an array
+// Compute the sample standard deviation of an array
Array.stddev = function(array) {
var count = array.length;
- var mean = Array.avg(array);
+ var mean = 0;
+ for (var i = 0; i < count; i++) {
+ mean += array[i];
+ }
+ mean /= count;
var variance = 0;
for (var i = 0; i < count; i++) {
var deviation = mean - array[i];
variance = variance + deviation * deviation;
}
- variance = variance / count;
+ variance = variance / (count - 1);
return Math.sqrt(variance);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698