mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 387395 talos computes Median value incorrectly
r=anodelman
This commit is contained in:
parent
44d466a5b4
commit
a37badfd81
@ -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
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user