From:
Operating system: Linux
PHP version: 5.3.3
Package: *General Issues
Bug Type: Bug
Bug description:ban number of loops on float number
Description:
------------
for different float values in loop (while or for) wrong number of loops.
When
number si bigger then 4.4 in condition, then one more loop is doing.
Test script:
---------------
for ($index = 3.1; $index < 4.0; $index += 0.1) {
echo $index.'<br />';
}
for ($index = 3.1; $index < 4.4; $index += 0.1) {
echo $index.'<br />';
}
Expected result:
----------------
number is 4.0
= OUTPUT ==============
3.1
3.2
3.3
3.4
3.5
3.6
3.7
3.8
3.9
end is 3.9
number is 4.4
= OUTPUT ==============
3.1
3.2
3.3
3.4
3.5
3.6
3.7
3.8
3.9
4
4.1
4.2
4.3
end is 4.3
Actual result:
--------------
number is 4.0
= OUTPUT ==============
3.1
3.2
3.3
3.4
3.5
3.6
3.7
3.8
3.9
end is 3.9
number is 4.4
= OUTPUT ==============
3.1
3.2
3.3
3.4
3.5
3.6
3.7
3.8
3.9
4
4.1
4.2
4.3
4.4 < WRONG
end is 4.4 <Â WRONG
--
Edit bug report at http://bugs.php.net/bug.php?id=52689&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=52689&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=52689&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=52689&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=52689&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=52689&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=52689&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=52689&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=52689&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=52689&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=52689&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=52689&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=52689&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=52689&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=52689&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52689&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=52689&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=52689&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=52689&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=52689&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=52689&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=52689&r=mysqlcfg