From c395ec16bd58fd3cc181c43813f230139ee10029 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 27 Apr 2018 14:06:04 +0200 Subject: [PATCH] Allow `$maxDecimals = 1` for `formatDouble()` --- wcfsetup/install/files/lib/util/StringUtil.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/util/StringUtil.class.php b/wcfsetup/install/files/lib/util/StringUtil.class.php index 045026ea04..9f6b312df9 100644 --- a/wcfsetup/install/files/lib/util/StringUtil.class.php +++ b/wcfsetup/install/files/lib/util/StringUtil.class.php @@ -198,7 +198,7 @@ final class StringUtil { */ public static function formatDouble($double, $maxDecimals = 0) { // round - $double = round($double, ($maxDecimals > 2 ? $maxDecimals : 2)); + $double = round($double, ($maxDecimals > 0 ? $maxDecimals : 2)); // consider as integer, if no decimal places found if (!$maxDecimals && preg_match('~^(-?\d+)(?:\.(?:0*|00[0-4]\d*))?$~', $double, $match)) { -- 2.20.1