From: [EMAIL PROTECTED] Operating system: PHP version: 5CVS-2004-02-03 (dev) PHP Bug Type: Math related Bug description: 0.1 and 0.7 evaluate strangely
Description: ------------ I saw this in a manual note. I don't know if it's really a problem, but others have agreed it's a bug, so... Only when using the floats 0.1 and 0.7 and multiplying by a number large enough to bring the product of the two floats' sums above 1 does a strange evaluation become apparent. Reproduce code: --------------- echo (int)((0.1 + 0.7) * 10); echo intval((0.1 + 0.7) * 10); echo (int)((0.1 + 0.7) * 20); echo (int)((0.1 + 0.8) * 20); echo (int)((0.1 + 0.8) * 10); Expected result: ---------------- 8 8 16 18 9 Actual result: -------------- 7 7 15 18 9 -- Edit bug report at http://bugs.php.net/?id=27138&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27138&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27138&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=27138&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=27138&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=27138&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=27138&r=needscript Try newer version: http://bugs.php.net/fix.php?id=27138&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=27138&r=support Expected behavior: http://bugs.php.net/fix.php?id=27138&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=27138&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=27138&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=27138&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27138&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=27138&r=dst IIS Stability: http://bugs.php.net/fix.php?id=27138&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=27138&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=27138&r=float