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

Reply via email to