diff --git a/src/Numeral.php b/src/Numeral.php index 0555b3e5..b7f78bec 100644 --- a/src/Numeral.php +++ b/src/Numeral.php @@ -284,7 +284,7 @@ protected function toFixed($number, $decimalPlaces, $optionalDigits = 0) // Handle the case where there are more decimal places // than are desired. if ($currentDecimalLength >= $decimalPlaces) { - $roundedValue = round($number, $decimalPlaces); + $roundedValue = number_format($number, $decimalPlaces, '.', ''); if ($this->stringStartsWith((string) $roundedValue, '-') && +$roundedValue >= 0) { $roundedValue = mb_substr($roundedValue, 1); diff --git a/tests/FormattingTest.php b/tests/FormattingTest.php index 4ff71f0f..60b1d97f 100644 --- a/tests/FormattingTest.php +++ b/tests/FormattingTest.php @@ -99,6 +99,7 @@ class FormattingTest extends PHPUnit_Framework_TestCase [100.12345, '0[.]00[000]', '100.12345'], [100.123456, '0[.]00[000]', '100.12346'], [100.123453, '0[.]00[000]', '100.12345'], + [0.069999999999993, '0[.]00', '0.07'], // specified abbreviations