diff options
author | B. Stack <bgstack15@gmail.com> | 2023-07-24 15:08:16 -0400 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2023-07-24 15:08:16 -0400 |
commit | 69e12f5bd10459ff7c239b82519107ae2a755bc0 (patch) | |
tree | 8b22393241df7e46686c9426140582bd747a6d5a /zen/format_unit.cpp | |
parent | add upstream 12.4 (diff) | |
download | FreeFileSync-69e12f5bd10459ff7c239b82519107ae2a755bc0.tar.gz FreeFileSync-69e12f5bd10459ff7c239b82519107ae2a755bc0.tar.bz2 FreeFileSync-69e12f5bd10459ff7c239b82519107ae2a755bc0.zip |
add upstream 12.5
Diffstat (limited to 'zen/format_unit.cpp')
-rw-r--r-- | zen/format_unit.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/zen/format_unit.cpp b/zen/format_unit.cpp index a5dd5152..0ce68d9b 100644 --- a/zen/format_unit.cpp +++ b/zen/format_unit.cpp @@ -27,7 +27,8 @@ std::wstring zen::formatTwoDigitPrecision(double value) //print two digits: 0,1 | 1,1 | 11 if (std::abs(value) < 9.95) //9.99 must not be formatted as "10.0" return printNumber<std::wstring>(L"%.1f", value); - return numberTo<std::wstring>(std::llround(value)); + + return formatNumber(std::llround(value)); } @@ -38,7 +39,8 @@ std::wstring zen::formatThreeDigitPrecision(double value) return printNumber<std::wstring>(L"%.2f", value); if (std::abs(value) < 99.95) //99.99 must not be formatted as "100.0" return printNumber<std::wstring>(L"%.1f", value); - return numberTo<std::wstring>(std::llround(value)); + + return formatNumber(std::llround(value)); } @@ -151,10 +153,9 @@ std::wstring zen::formatRemainingTime(double timeInSec) std::wstring zen::formatProgressPercent(double fraction, int decPlaces) { -#if 0 //special case for perf!? - if (decPlaces == 0) - return numberTo<std::wstring>(static_cast<int>(fraction * 100)) + L'%'; -#endif + if (decPlaces == 0) //special case for perf + return numberTo<std::wstring>(static_cast<int>(std::floor(fraction * 100))) + L'%'; + //round down! don't show 100% when not actually done: https://freefilesync.org/forum/viewtopic.php?t=9781 const double blocks = std::pow(10, decPlaces); const double percent = std::floor(fraction * 100 * blocks) / blocks; |