diff --git a/src/statistics.cc b/src/statistics.cc index 4a639fd2b9..261dcb299a 100644 --- a/src/statistics.cc +++ b/src/statistics.cc @@ -84,6 +84,8 @@ double StatisticsCV(const std::vector& v) { const auto stddev = StatisticsStdDev(v); const auto mean = StatisticsMean(v); + if (std::fpclassify(mean) == FP_ZERO) return 0.0; + return stddev / mean; }