ZF-4729: Zend_Currency toCurrency precision error.

Issue Type: Bug Created: 2008-10-28T07:03:19.000+0000 Last Updated: 2009-02-05T14:51:47.000+0000 Status: Resolved Fix version(s): - 1.8.0 (30/Apr/09)

Reporter: Filipe Guerra (alias.mac) Assignee: Thomas Weidner (thomas) Tags: - Zend_Currency

Related issues: - ZF-3473



Precision error when given a number to method toCurrency()

$zendLocale = new Zend_Locale($config->locale); Zend_Locale::setDefault('pt_PT'); // define default Zend_Locale_Format Zend_Locale_Format::setOptions(array( 'locale' => $zendLocale, 'precision' => 2 ));

$zendCurrency = new Zend_Currency($zendLocale); $zendCurrency->toCurrency($price);

if the price is 14.2278 for example it returns 14,22 € (localized number) when actually should return 14,23 €

I managed to correct this using toFloat() on line 173 of Zend/Currency.php file, instead of toNumber(). Is this the right stuff to do?


Posted by Thomas Weidner (thomas) on 2008-12-09T00:56:59.000+0000

Dependent of ZF-3473

Posted by Thomas Weidner (thomas) on 2009-02-05T14:51:46.000+0000

Fixed with r13990

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.