ID: 45300 Updated by: [EMAIL PROTECTED] Reported By: gernovich at ya dot ru -Status: Open +Status: Bogus Bug Type: *General Issues Operating System: win xp PHP Version: 5.2.6 New Comment:
Floating point values have a limited precision. Hence a value might not have the same string representation after any processing. That also includes writing a floating point value in your script and directly printing it without any mathematical operations. If you would like to know more about "floats" and what IEEE 754 is, read this: http://docs.sun.com/source/806-3568/ncg_goldberg.html Thank you for your interest in PHP. Previous Comments: ------------------------------------------------------------------------ [2008-06-18 12:50:03] gernovich at ya dot ru Description: ------------ Convertion problem with float types. The problem is also affected on round() and ceil(), but number_format() not no mathematical function. Reproduce code: --------------- $a = -0.014; print round($a,1)."\n"; // -0 bogus print number_format($a, 1)."\n"; // -0.0 bug Expected result: ---------------- -0 0.0 Actual result: -------------- -0 -0.0 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=45300&edit=1
