Bug #77483 [Csd->Nab]: NumberFormatter::formatCurrency rounding issues with CHF (Swiss Francs)

From: Date: Fri, 18 Jan 2019 17:16:16 +0000
Subject: Bug #77483 [Csd->Nab]: NumberFormatter::formatCurrency rounding issues with CHF (Swiss Francs)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-219068@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77483&edit=1 ID: 77483 Updated by: cmb@php.net Reported by: 1000nettles at gmail dot com Summary: NumberFormatter::formatCurrency rounding issues with CHF (Swiss Francs) -Status: Closed +Status: Not a bug Type: Bug Package: Unknown/Other Function Operating System: Amazon Linux / CentOS PHP Version: 7.1.26 Assigned To: cmb Block user comment: N Private report: N New Comment: Great that the problem has been resolved. Previous Comments: ------------------------------------------------------------------------ [2019-01-18 17:04:58] 1000nettles at gmail dot com You are absolutely correct - we were using an out-of-date INTL ICU version (50.x). Upgraded to the latest and the rounding disappears. Really appreciate the help, thanks. ------------------------------------------------------------------------ [2019-01-18 11:00:12] cmb@php.net It seems to me this never was a PHP issue, but rather an ICU issue. Which INTL_ICU_VERSION do you use? ------------------------------------------------------------------------ [2019-01-17 22:46:41] 1000nettles at gmail dot com Description: ------------ Hi there, It looks as if a bug that was fixed years ago (https://bugs.php.net/bug.php?id=60083) has reappeared in PHP 7.1.x. While using NumberFormatter::formatCurrency, if you specify CHF (Swiss Francs) as a currency, it will round to the nearest 0.05. Test script: --------------- $formatter = new \NumberFormatter('en_US', \NumberFormatter::CURRENCY); echo $formatter->formatCurrency(12.99, 'CHF'); Expected result: ---------------- CHF12.99 Actual result: -------------- CHF13.00 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=77483&edit=1

« previous php.bugs (#219068) next »