Skip to content

Commit

Permalink
src: Use llround instead of round
Browse files Browse the repository at this point in the history
  • Loading branch information
tatsuhiro-t committed Jul 12, 2017
1 parent 0911337 commit 1002c6d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 1002c6d

Please sign in to comment.