ZF-4729: Zend_Currency toCurrency precision error.


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?


Dependent of ZF-3473

Fixed with r13990