ZF-7170: Error rounding float value with Zend_Locale_Format::toNumber()

Issue Type: Bug Created: 2009-07-01T06:40:43.000+0000 Last Updated: 2009-07-02T00:39:23.000+0000 Status: Resolved Fix version(s): Reporter: Sasa Stamenkovic (umpirsky) Assignee: Thomas Weidner (thomas) Tags: - Zend_Locale

Related issues: Attachments:


I tried to round 98.99999625 value with Zend_Locale_Format::toNumber() and I get result 98, I expected 99.00.

Here is the code which reproduces this bug:

$result = Zend_Locale_Format::toNumber(98.99999625, array('precision' => 2)); Zend_Debug::dump($result);

Dump result:

string(5) "98.00"


Posted by Thomas Weidner (thomas) on 2009-07-01T07:10:51.000+0000

Running your code I receive: string '98,99' (length=5)

Your result is not reproducable for me.

Posted by Sasa Stamenkovic (umpirsky) on 2009-07-01T09:20:00.000+0000

ZF 1.8.4 Thomas?

Posted by Sasa Stamenkovic (umpirsky) on 2009-07-01T23:50:58.000+0000

And set sv_SE locale.

Posted by Thomas Weidner (thomas) on 2009-07-02T00:39:22.000+0000

Closing as non-issue.

Use toFloat() when you want to have float values. Set a locale when you want to use a specific locale.

Please read the manual and the API doc for details.

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.