benchmarks: fix over-width number formatting issue
This commit is contained in:
parent
db58b8b578
commit
930056f5db
1 changed files with 2 additions and 2 deletions
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
// stl
|
// stl
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <cmath> // log10
|
#include <cmath> // log10, round
|
||||||
#include <cstdio> // snprintf
|
#include <cstdio> // snprintf
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
@ -153,7 +153,7 @@ struct big_number_fmt
|
||||||
static const char* suffixes = "\0\0k\0M\0G\0T\0P\0E\0Z\0Y\0\0";
|
static const char* suffixes = "\0\0k\0M\0G\0T\0P\0E\0Z\0Y\0\0";
|
||||||
u = suffixes;
|
u = suffixes;
|
||||||
|
|
||||||
while (v > 1 && std::log10(v) >= width && u[2])
|
while (v > 1 && std::log10(std::round(v)) >= width && u[2])
|
||||||
{
|
{
|
||||||
v /= base;
|
v /= base;
|
||||||
u += 2;
|
u += 2;
|
||||||
|
|
Loading…
Add table
Reference in a new issue