Thu, 29 Mar 2018 10:18:18 +0300
use 3 significant figures in file size representation
src/basics.cpp | file | annotate | diff | comparison | revisions |
--- a/src/basics.cpp Tue Mar 27 14:13:58 2018 +0300 +++ b/src/basics.cpp Thu Mar 29 10:18:18 2018 +0300 @@ -73,7 +73,7 @@ static const QString suffixes[] = {" bytes", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"}; int magnitude = (size > 0) ? floor(log10(size) / 3.0 + 1e-10) : 0; magnitude = qBound(0, magnitude, countof(suffixes) - 1); - return QString::number(size / pow(1000, magnitude)) + suffixes[magnitude]; + return QString::number(size / pow(1000, magnitude), 'f', 3) + suffixes[magnitude]; } /*