ZF-4729: Zend_Currency toCurrency precision error.
Description
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?
Comments
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