Skip to content

Commit

Permalink
Fix division by zero for low frequency timers for CV statistics
Browse files Browse the repository at this point in the history
  • Loading branch information
ivafanas committed Jan 2, 2024
1 parent 7b52bf7 commit 079b40e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/statistics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ double StatisticsCV(const std::vector<double>& v) {
const auto stddev = StatisticsStdDev(v);
const auto mean = StatisticsMean(v);

if (std::fpclassify(mean) == FP_ZERO) return 0.0;

return stddev / mean;
}

Expand Down

0 comments on commit 079b40e

Please sign in to comment.