Lines Matching full:values
18 function computeAverage(values) {
20 for (var i = 0; i < values.length; i++)
21 sum += values[i];
22 return sum / values.length;
25 function computeMax(values) {
26 var max = values.length ? values[0] : 0;
27 for (var i = 1; i < values.length; i++) {
28 if (max < values[i])
29 max = values[i];
34 function computeMedian(values) {
35 values.sort(function(a, b) { return a - b; });
36 var len = values.length;
38 return values[(len-1)/2];
39 return (values[len/2-1] + values[len/2]) / 2;
42 function computeMin(values) {
43 var min = values.length ? values[0] : 0;
44 for (var i = 1; i < values.length; i++) {
45 if (min > values[i])
46 min = values[i];
51 function computeStdev(values) {
52 var average = computeAverage(values);
54 for (var i = 0; i < values.length; ++i) {
55 var deviation = values[i] - average;
58 return Math.sqrt(sumOfSquaredDeviations / values.length);