ID: 39088 Updated by: [EMAIL PROTECTED] Reported By: msajko at yahoo dot com -Status: Open +Status: Bogus Bug Type: Documentation problem Operating System: Windows XP PHP Version: Irrelevant 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: ------------------------------------------------------------------------ [2006-10-09 07:54:14] msajko at yahoo dot com Description: ------------ round(555.305,1) = 555.3 round(555.305,2) = 555.3 !!!? (555.31 is correct) round(555.305,3) = 555.305 problem appears in Windows binary, on debian binary it works just fine Reproduce code: --------------- echo round(555.305,2) ."\n"; echo (round(555.305,2)*1)."\n"; Expected result: ---------------- 555.31 555.31 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=39088&edit=1
