1
0
mirror of https://github.com/google/benchmark.git synced 2025-04-06 09:31:03 +08:00

Fix division by zero for low frequency timers for CV statistics ()

This commit is contained in:
Afanasyev Ivan 2024-01-03 19:40:59 +07:00 committed by GitHub
parent 7b52bf7346
commit 2d2e07e3c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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