BenchmarkRunner: use std::lround() to round double to int

From clang-tidy bugprone-incorrect-roundings check: > casting (double + 0.5) to integer leads to incorrect rounding; consider using lround (#include <cmath>) instead
parent 74e112ae
...@@ -264,7 +264,7 @@ class BenchmarkRunner { ...@@ -264,7 +264,7 @@ class BenchmarkRunner {
// So what seems to be the sufficiently-large iteration count? Round up. // So what seems to be the sufficiently-large iteration count? Round up.
const IterationCount max_next_iters = const IterationCount max_next_iters =
0.5 + std::max(multiplier * i.iters, i.iters + 1.0); std::lround(std::max(multiplier * i.iters, i.iters + 1.0));
// But we do have *some* sanity limits though.. // But we do have *some* sanity limits though..
const IterationCount next_iters = std::min(max_next_iters, kMaxIterations); const IterationCount next_iters = std::min(max_next_iters, kMaxIterations);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment