From 930056f5db1d43603f8671fa52e4261e23bdba4a Mon Sep 17 00:00:00 2001 From: Mickey Rose Date: Sun, 28 Feb 2016 01:04:35 +0100 Subject: [PATCH] benchmarks: fix over-width number formatting issue --- benchmark/bench_framework.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/benchmark/bench_framework.hpp b/benchmark/bench_framework.hpp index 0dfb76e8d..c5f280207 100644 --- a/benchmark/bench_framework.hpp +++ b/benchmark/bench_framework.hpp @@ -10,7 +10,7 @@ // stl #include -#include // log10 +#include // log10, round #include // snprintf #include #include @@ -153,7 +153,7 @@ struct big_number_fmt static const char* suffixes = "\0\0k\0M\0G\0T\0P\0E\0Z\0Y\0\0"; u = suffixes; - while (v > 1 && std::log10(v) >= width && u[2]) + while (v > 1 && std::log10(std::round(v)) >= width && u[2]) { v /= base; u += 2;