ZF-6055: Currency doesn't round correctly

Issue Type: Bug Created: 2009-03-18T04:46:07.000+0000 Last Updated: 2009-03-30T06:32:34.000+0000 Status: Resolved Fix version(s): - 1.8.0 (30/Apr/09)

Reporter: Sven Franke (snefit) Assignee: Thomas Weidner (thomas) Tags: - Zend_Currency

Related issues: Attachments:


When is use Zend_Currency, the roundings are working incorrectly (imho).

<pre class="highlight">
$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?



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

<pre class="highlight">
$curr = new Zend_Currency('EUR', 'nl_NL');
 $res = $curr->toCurrency(5.3678, array('display' => Zend_Currency::NO_SYMBOL));

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)

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.