ID: 43746 Updated by: [EMAIL PROTECTED] Reported By: phil at phymoky dot com -Status: Open +Status: Bogus Bug Type: Math related Operating System: Windows 2000 PHP Version: 5.2.5 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-01-04 05:46:18] phil at phymoky dot com Description: ------------ unexpected result in round() Reproduce code: --------------- <?php echo round(1234567, -5); // is 1.2E+6 echo round(1334567, -5); // is 1300000 echo round(1134567, -5); // is 1100000 ?> Expected result: ---------------- 1200000 1300000 1100000 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43746&edit=1
