From a04d7c6b63931bdd2859e13cc5c9bdf71c3477c0 Mon Sep 17 00:00:00 2001 From: Glenn Strauss Date: Sat, 17 Sep 2016 22:28:19 -0400 Subject: [PATCH] Run - Can't take log of 0 do not attempt to take log() of 0 github: fixes #21 --- UnixBench/Run | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/UnixBench/Run b/UnixBench/Run index 047a227..1a7ebf6 100755 --- a/UnixBench/Run +++ b/UnixBench/Run @@ -947,12 +947,12 @@ sub combinePassResults { # If $timebase is 0 the figure is a rate; else compute # counts per $timebase. $time is always seconds. - if ($timebase > 0) { + if ($timebase > 0 && $time > 0) { $sum += $count / ($time / $timebase); - $product += log($count) - log($time / $timebase); + $product += log($count) - log($time / $timebase) if ($count > 0); } else { $sum += $count; - $product += log($count); + $product += log($count) if ($count > 0); } $totalTime += $time; } @@ -1030,7 +1030,7 @@ sub indexResults { $bresult->{'index'} = $ratio * 10; # Sun the scores, and count this test for this category. - $sum->{$cat} += log($ratio); + $sum->{$cat} += log($ratio) if ($ratio > 0.000001); ++$indexed->{$cat}; }