summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Smokeping/matchers/Median.pm1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/Smokeping/matchers/Median.pm b/lib/Smokeping/matchers/Median.pm
index 22a2445..2c721bf 100644
--- a/lib/Smokeping/matchers/Median.pm
+++ b/lib/Smokeping/matchers/Median.pm
@@ -97,5 +97,6 @@ sub robust_median(@){
my @numbers = sort {$a <=> $b} grep { defined $_ and $_ =~ /\d/ } @_;
my $count = scalar @numbers;
return 0 if $count == 0;
+ $count--; # we are 0 based
return ($count / 2 == int($count/2)) ? $numbers[$count/2] : ($numbers[$count/2+0.5] + $numbers[$count/2-0.5])/2;
}