diff options
author | mattab <matthieu.aubry@gmail.com> | 2015-10-12 04:54:42 +0300 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2015-10-12 04:54:42 +0300 |
commit | e51b9963c1d3870934059276f61377faae5d916e (patch) | |
tree | 78aa67fe61198489853546826c9d4e26daa44b6f | |
parent | 9ced7c48b4a710428bd7e818b8e919dd13e7944a (diff) |
Fixes Call to undefined function bcdiv
-rw-r--r-- | core/NumberFormatter.php | 3 | ||||
-rw-r--r-- | tests/PHPUnit/Integration/NumberFormatterTest.php | 10 |
2 files changed, 7 insertions, 6 deletions
diff --git a/core/NumberFormatter.php b/core/NumberFormatter.php index 4e2d376314..ad030400f4 100644 --- a/core/NumberFormatter.php +++ b/core/NumberFormatter.php @@ -229,7 +229,8 @@ class NumberFormatter extends Singleton // Ensure that the value is positive and has the right number of digits. $negative = $this->isNegative($value); $signMultiplier = $negative ? '-1' : '1'; - $value = bcdiv($value, $signMultiplier, $maximumFractionDigits); + $value = $value / $signMultiplier; + $value = round($value, $maximumFractionDigits); // Split the number into major and minor digits. $valueParts = explode('.', $value); $majorDigits = $valueParts[0]; diff --git a/tests/PHPUnit/Integration/NumberFormatterTest.php b/tests/PHPUnit/Integration/NumberFormatterTest.php index e2ac454b4e..981b289f2b 100644 --- a/tests/PHPUnit/Integration/NumberFormatterTest.php +++ b/tests/PHPUnit/Integration/NumberFormatterTest.php @@ -57,8 +57,8 @@ class NumberFormatterTest extends \PHPUnit_Framework_TestCase array('be', 51239.56, 3, 0, '51 239,56'), array('de', 51239.56, 3, 0, '51.239,56'), array('bn', 152551239.56, 3, 0, '15,25,51,239.56'), - array('hi', 152551239.56, 0, 0, '15,25,51,239'), - array('lt', -152551239.56, 0, 0, '−152 551 239'), + array('hi', 152551239.56, 0, 0, '15,25,51,240'), + array('lt', -152551239.56, 0, 0, '−152 551 240'), ); } @@ -80,7 +80,7 @@ class NumberFormatterTest extends \PHPUnit_Framework_TestCase array('en', -5, 0, 3, '-5%'), array('en', 5.299, 0, 0, '5%'), array('en', 5.299, 3, 0, '5.299%'), - array('en', -50, 3, 3, '-50.000%'), + array('en', -50, 3, 3, '-50%'), array('en', 5000, 0, 0, '5,000%'), array('en', +5000, 0, 0, '5,000%'), array('en', 5000000, 0, 0, '5,000,000%'), @@ -91,8 +91,8 @@ class NumberFormatterTest extends \PHPUnit_Framework_TestCase array('be', 51239.56, 3, 0, '51 239,56 %'), array('de', 51239.56, 3, 0, '51.239,56 %'), array('bn', 152551239.56, 3, 0, '15,25,51,239.56%'), - array('hi', 152551239.56, 0, 0, '15,25,51,239%'), - array('lt', -152551239.56, 0, 0, '−152 551 239 %'), + array('hi', 152551239.56, 0, 0, '15,25,51,240%'), + array('lt', -152551239.56, 0, 0, '−152 551 240 %'), ); } |