ID: 35667 Updated by: [EMAIL PROTECTED] Reported By: gerald dot hoch at net-man dot at -Status: Open +Status: Bogus Bug Type: Math related Operating System: win32 PHP Version: 5.1.1 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: ------------------------------------------------------------------------ [2005-12-14 12:34:37] gerald dot hoch at net-man dot at Description: ------------ I have some troubles with following round() function. I think the operation +1 produces the problem. Reproduce code: --------------- var_dump(round(65536.335,2)); var_dump(round(65535.335 + 1,2)); Expected result: ---------------- float(65536.34) float(65536.34) Actual result: -------------- float(65536.34) float(65536.33) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=35667&edit=1
