Bug #53343 [Opn->Bgs]: iteration bug with variable assignation
| From: | rasmus@php.net | Date: | Thu, 18 Nov 2010 10:47:43 +0000 |
| Subject: | Bug #53343 [Opn->Bgs]: iteration bug with variable assignation | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-156151@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=53343&edit=1
ID: 53343
Updated by: rasmus@php.net
Reported by: kanea at free dot fr
Summary: iteration bug with variable assignation
-Status: Open
+Status: Bogus
Type: Bug
Package: *General Issues
Operating System: w7
PHP Version: 5.3.3
Block user comment: N
Private report: N
New Comment:
Floating point values have a limited precision. Hence a value might
not have the same string representation after any processing. That also
includes writing a floating point value in your script and directly
printing it without any mathematical operations.
If you would like to know more about "floats" and what IEEE
754 is, read this:
http://docs.sun.com/source/806-3568/ncg_goldberg.html
Thank you for your interest in PHP.
.
Previous Comments:
------------------------------------------------------------------------
[2010-11-18 11:44:10] kanea at free dot fr
Description:
------------
iterations give aproximation beetween two val, but . Every time there
value are
the same :
4.38 .. 10
Test script:
---------------
for ($A = 0.8; $A < 5 * 3.1416; $A+=0.01) {
echo $A."<br />";
}
Expected result:
----------------
0.08
0.09
...
15.68
15.69
15.7
Actual result:
--------------
0.8
0.81
...
4.36
4.37
4.38
4.3899999999999
4.3999999999999
...
9.9899999999998
9.9999999999998
10.01
10.02
...
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=53343&edit=1