JSONReporter: RoundDouble(): 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
This commit is contained in:
Roman Lebedev 2019-11-23 00:19:02 +03:00
parent cc7f50e126
commit c22c266eaf
No known key found for this signature in database
GPG Key ID: 083C3EBB4A1689E0

View File

@ -92,7 +92,7 @@ std::string FormatKV(std::string const& key, double value) {
return ss.str();
}
int64_t RoundDouble(double v) { return static_cast<int64_t>(v + 0.5); }
int64_t RoundDouble(double v) { return std::lround(v); }
} // end namespace