ZF-7170: Error rounding float value with Zend_Locale_Format::toNumber()
Description
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"
Comments
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.