From: Operating system: Linux Ubuntu PHP 5.3.5-1ubuntu7 PHP version: 5.3SVN-2011-06-04 (snap) Package: Math related Bug Type: Bug Bug description:Weird float values on increment
Description: ------------ PHP produces much more decimals than expected when a variable is incremented in a for loop. On my computer, it happens around [54,66] and [84,100]. This might be related to the http://bugs.php.net/bug.php?id=50095 bug. Test script: --------------- for($i=0;$i<100;$i+=0.1) echo "$i\n"; Expected result: ---------------- 0 0.1 0.2 ... 99.8 99.9 Actual result: -------------- 0 0.1 0.2 ... 54 54.1 54.200000000001 54.300000000001 ... 66.300000000001 66.400000000001 66.5 66.6 ... 83.9 84 84.099999999999 84.199999999999 ... 99.899999999999 99.999999999999 -- Edit bug report at http://bugs.php.net/bug.php?id=54994&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54994&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54994&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54994&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=54994&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54994&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=54994&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=54994&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=54994&r=needscript Try newer version: http://bugs.php.net/fix.php?id=54994&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=54994&r=support Expected behavior: http://bugs.php.net/fix.php?id=54994&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=54994&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=54994&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=54994&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54994&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=54994&r=dst IIS Stability: http://bugs.php.net/fix.php?id=54994&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=54994&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=54994&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=54994&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=54994&r=mysqlcfg
