src: Use llround instead of round

This commit is contained in:
Tatsuhiro Tsujikawa 2017-07-12 22:32:03 +09:00
parent 0911337689
commit 1002c6da1c
1 changed files with 3 additions and 2 deletions

View File

@ -1103,8 +1103,9 @@ std::string format_duration(double t) {
}
std::string dtos(double n) {
auto f = utos(static_cast<int64_t>(round(100. * n)) % 100);
return utos(static_cast<int64_t>(n)) + "." + (f.size() == 1 ? "0" : "") + f;
auto m = llround(100. * n);
auto f = utos(m % 100);
return utos(m / 100) + "." + (f.size() == 1 ? "0" : "") + f;
}
StringRef make_http_hostport(BlockAllocator &balloc, const StringRef &host,