summaryrefslogtreecommitdiffstats
path: root/lib/Smokeping
diff options
context:
space:
mode:
authorTobias Oetiker <tobi@oetiker.ch>2011-11-24 11:25:53 +0100
committerTobias Oetiker <tobi@oetiker.ch>2011-11-24 11:25:53 +0100
commit77890232a5020dc5caf034da9a2d1bc1392b1a3b (patch)
tree187acabef78825eff22c9c134edc5d144862ee34 /lib/Smokeping
parentc332d31fbf2f398455c4a7dfc8f9eec19943fed0 (diff)
downloadsmokeping-77890232a5020dc5caf034da9a2d1bc1392b1a3b.tar.gz
smokeping-77890232a5020dc5caf034da9a2d1bc1392b1a3b.tar.xz
fixed off by 1 error
Diffstat (limited to 'lib/Smokeping')
-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;
}