Run - Can't take log of 0

do not attempt to take log() of 0

github: fixes #21
This commit is contained in:
Glenn Strauss 2016-09-17 22:28:19 -04:00
parent e0b8c00209
commit a04d7c6b63

View File

@ -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};
}