ID: 43241 Updated by: [EMAIL PROTECTED] Reported By: quake5 at gmx dot de -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: MacOS 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: ------------------------------------------------------------------------ [2007-11-11 10:49:03] [EMAIL PROTECTED] This is documented. See "Integer overflow" ( http://br.php.net/integer ) [EMAIL PROTECTED]:~$ php -r 'var_dump(73.82 * 100);' float(7382) [EMAIL PROTECTED]:~$ php -r 'var_dump(73.82 * 100 % 2);' int(1) [EMAIL PROTECTED]:~$ php -r 'var_dump(round(73.82 * 100) % 2);' int(0) ------------------------------------------------------------------------ [2007-11-11 02:44:42] quake5 at gmx dot de Description: ------------ Float Precision/Representation and Modulo Reproduce code: --------------- <?php var_dump(73.82 * 100 % 2); ?> Expected result: ---------------- int(0) Actual result: -------------- int(1) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43241&edit=1
