#37943 [NEW]: decimal counting error

From: Date: Wed, 28 Jun 2006 09:13:16 +0000
Subject: #37943 [NEW]: decimal counting error
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-98883@lists.php.net to get a copy of this message
From: atbjk at yahoo dot com Operating system: windows PHP version: 4.4.2 PHP Bug Type: *General Issues Bug description: decimal counting error Description: ------------ there is a prob when adding decimal together, they do not print the trialing zero. Reproduce code: --------------- for ($i=0; $i<23; $i++) { echo 0.0001+($i*0.0001).'<br>'; } Expected result: ---------------- 0.0001 0.0002 0.0003 0.0004 0.0005 0.0006 0.0007 0.0008 0.0009 0.0010 0.0011 0.0012 0.0013 0.0014 0.0015 0.0016 0.0017 0.0018 0.0019 0.0020 0.0021 0.0022 0.0023 Actual result: -------------- 0.0001 0.0002 0.0003 0.0004 0.0005 0.0006 0.0007 0.0008 0.0009 0.001 0.0011 0.0012 0.0013 0.0014 0.0015 0.0016 0.0017 0.0018 0.0019 0.002 0.0021 0.0022 0.0023 -- Edit bug report at http://bugs.php.net/?id=37943&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37943&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=37943&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37943&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=37943&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=37943&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=37943&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=37943&r=needscript Try newer version: http://bugs.php.net/fix.php?id=37943&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=37943&r=support Expected behavior: http://bugs.php.net/fix.php?id=37943&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=37943&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=37943&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=37943&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37943&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=37943&r=dst IIS Stability: http://bugs.php.net/fix.php?id=37943&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=37943&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=37943&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=37943&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=37943&r=mysqlcfg

« previous php.bugs (#98883) next »