ZF-6055: Currency doesn't round correctly
Description
When is use Zend_Currency, the roundings are working incorrectly (imho).
$currency = new Zend_Currency('EUR', 'nl_NL');
echo $currency->toCurrency('5.678', array('presicion' => 2));
I think it should display the number as: 5,68 but it is displayed as 5,67.
When looking in the code, the toCurrency uses the Zend_Locale_Format::toNumber(). Should it be using the toFloat() function instead?
S.
Comments
Posted by Thomas Weidner (thomas) on 2009-03-18T06:49:57.000+0000
Use the correct option...
precision instead of presicion
Posted by Sven Franke (snefit) on 2009-03-19T00:19:30.000+0000
So I made a typo in the example... whoooo.
BUT!.... In my actual code it was/is the correct option (so no typo) thus the problem remains.
Posted by Thomas Weidner (thomas) on 2009-03-19T01:09:43.000+0000
Looks for me as a duplication of ZF-3473 and ZF-5908. Using your example within my testbed I see no failed rounding using your input.
Are you sure that you are using trunk as you stated within the issue creation and not a fixed release ?
Posted by Sven Franke (snefit) on 2009-03-19T01:53:04.000+0000
Did I state trunk? Hmz, must be sleeping :(
I was using 1.7.6, but I get the same results in 1.7.7.
This is the code that I use (just for testing!)
Going to test against trunk
Posted by Sven Franke (snefit) on 2009-03-19T02:01:44.000+0000
Ok, I see that the code is working on trunk library.
When can we expect 1.7.8? ;-)
Sorry for the troubles! (and thanx for the solution).
I'll better my life by searching and filling the fields correctly.
Posted by Thomas Weidner (thomas) on 2009-03-30T06:32:34.000+0000
Fixed for the next minor release (small BC break environment related)