diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Smokeping/RRDhelpers.pm | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Smokeping/RRDhelpers.pm b/lib/Smokeping/RRDhelpers.pm index 3f4fa5b..e491a5c 100644 --- a/lib/Smokeping/RRDhelpers.pm +++ b/lib/Smokeping/RRDhelpers.pm @@ -52,7 +52,8 @@ sub get_stddev{ } } return undef unless $cnt; - return sqrt( 1.0 / $cnt * ( $sqsum - $sum**2 / $cnt )) + my $sqdev = 1.0 / $cnt * ( $sqsum - $sum**2 / $cnt ); + return $sqdev < 0.0 ? 0.0 : sqrt($sqdev); } |