From 1002c6da1c13fe7f3ae8954b1b984cab4498778d Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Wed, 12 Jul 2017 22:32:03 +0900 Subject: [PATCH] src: Use llround instead of round --- src/util.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/util.cc b/src/util.cc index 0adb6727..aeaddebb 100644 --- a/src/util.cc +++ b/src/util.cc @@ -1103,8 +1103,9 @@ std::string format_duration(double t) { } std::string dtos(double n) { - auto f = utos(static_cast(round(100. * n)) % 100); - return utos(static_cast(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,