From 69e12f5bd10459ff7c239b82519107ae2a755bc0 Mon Sep 17 00:00:00 2001 From: "B. Stack" Date: Mon, 24 Jul 2023 15:08:16 -0400 Subject: add upstream 12.5 --- zen/format_unit.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'zen/format_unit.cpp') 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(L"%.1f", value); - return numberTo(std::llround(value)); + + return formatNumber(std::llround(value)); } @@ -38,7 +39,8 @@ std::wstring zen::formatThreeDigitPrecision(double value) return printNumber(L"%.2f", value); if (std::abs(value) < 99.95) //99.99 must not be formatted as "100.0" return printNumber(L"%.1f", value); - return numberTo(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(static_cast(fraction * 100)) + L'%'; -#endif + if (decPlaces == 0) //special case for perf + return numberTo(static_cast(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; -- cgit