Bug 387395 talos computes Median value incorrectly

r=anodelman
This commit is contained in:
ginn.chen@sun.com 2007-07-18 23:33:13 -07:00
parent 44d466a5b4
commit a37badfd81
2 changed files with 7 additions and 3 deletions

View File

@ -41,6 +41,10 @@
var index = 0;
var cycle = 0;
function compareNumbers(a, b) {
return a - b;
}
// returns an object with the following properties:
// min : min value of array elements
// max : max value of array elements
@ -67,14 +71,14 @@
// median
sorted_ary = ary.concat();
sorted_ary.sort();
sorted_ary.sort(compareNumbers);
// remove longest run
sorted_ary.pop();
if (sorted_ary.length%2) {
r.median = sorted_ary[(sorted_ary.length-1)/2];
}else{
var n = Math.floor(sorted_ary.length / 2);
r.median = (sorted_ary[n] + sorted_ary[n + 1]) / 2;
r.median = (sorted_ary[n - 1] + sorted_ary[n]) / 2;
}
// ignore max value when computing mean and stddev

View File

@ -69,7 +69,7 @@
<body>
<table>
<thead>
<tr><th>Page</th><th>Min</th><th>Max</th><th>Mean</th><th>Std</th><th>Times...</th></tr>
<tr><th>Page</th><th>Min</th><th>Max</th><th>Mean</th><th>Std</th><th>Median</th><th>Times...</th></tr>
</thead>
<tbody id="tbody"></tbody>
</table>