From 6e886c3ab3039f30eba9438ebe572e2374720637 Mon Sep 17 00:00:00 2001 From: Rein Date: Tue, 16 Dec 2014 08:33:46 +0100 Subject: [PATCH] decimal bug value like 74,50 get a value like 74,00.50. So the decimail format goos before the number_format. --- system/expressionengine/third_party/math/pi.math.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/system/expressionengine/third_party/math/pi.math.php b/system/expressionengine/third_party/math/pi.math.php index ee8dc98..edf7562 100644 --- a/system/expressionengine/third_party/math/pi.math.php +++ b/system/expressionengine/third_party/math/pi.math.php @@ -93,15 +93,19 @@ public function __construct() // Format response if ($decimals !== false) { - $result = number_format((int) $parts[0], 0, $decimal_point, $thousands_seperator); + + $parts[0] = (int) $parts[0]; if ($decimals > 0) { if ($decimal_digits < $decimals and $trailing_zeros) { - $result .= '.' . str_pad($decimal_value, $decimals, 0); + $parts[0] .= '.' . str_pad($decimal_value, $decimals, 0); } else { - $result .= $decimal_value ? ('.' . $decimal_value) : ''; + $parts[0] .= $decimal_value ? ('.' . $decimal_value) : ''; } } + + $result = number_format($parts[0], 0, $decimal_point, $thousands_seperator); + } else { $decimals = $decimal_digits;