From: pcmadnessltd at yahoo dot co dot uk Operating system: ubuntu 10.04 pae PHP version: 5.4.19 Package: Unknown/Other Function Bug Type: Bug Bug description:position inaccurate a.xyz
Description: ------------ position inaccurate when adding 0.001 to a value possible solution round($num, 3); Test script: --------------- echo '<table>'; $ii =0; for($i =1; $i<= 10000; $i++) { echo '<tr>'; echo '<td>'; echo $ii; echo '</td>'; echo '</tr>'; $ii = $ii +0.001; } echo '</table>'; Expected result: ---------------- 1.459 1.46 1.461 1.462 1.463 1.464 1.465 1.466 ... 2.369 2.370 2.371 2.372 2.373 2.374 2.375 ... 3.278 3.279 3.280 3.281 Actual result: -------------- 1.459 1.46 1.4609999999999 1.4619999999999 1.4629999999999 1.4639999999999 1.4649999999999 1.4659999999999 ... 2.3689999999999 2.3699999999999 2.3709999999998 2.3719999999998 2.3729999999998 2.3739999999998 2.3749999999998 ... 3.2769999999998 3.2779999999998 3.2789999999997 3.2799999999997 and so on -- Edit bug report at https://bugs.php.net/bug.php?id=65676&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=65676&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=65676&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=65676&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=65676&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=65676&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=65676&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=65676&r=needscript Try newer version: https://bugs.php.net/fix.php?id=65676&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=65676&r=support Expected behavior: https://bugs.php.net/fix.php?id=65676&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=65676&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=65676&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=65676&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65676&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=65676&r=dst IIS Stability: https://bugs.php.net/fix.php?id=65676&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=65676&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=65676&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=65676&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=65676&r=mysqlcfg