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

Use the correct option...

precision instead of presicion

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.

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 ?

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!)


$curr = new Zend_Currency('EUR', 'nl_NL');
 $res = $curr->toCurrency(5.3678, array('display' => Zend_Currency::NO_SYMBOL));
 Zend_Debug::dump($res);

Going to test against trunk

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.

Fixed for the next minor release (small BC break environment related)