#34442 [Opn->Bgs]: Incorrect numerical result produced
| From: | derick@php.net | Date: | Fri, 09 Sep 2005 16:38:39 +0000 |
| Subject: | #34442 [Opn->Bgs]: Incorrect numerical result produced | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-84803@lists.php.net to get a copy of this message | ||
ID: 34442
Updated by: derick@php.net
Reported By: thirteenlisk at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: *General Issues
Operating System: Windows XP
PHP Version: 5.0.5
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:
------------------------------------------------------------------------
[2005-09-09 18:22:02] thirteenlisk at gmail dot com
Description:
------------
Using intval() with some numbers produces an incorrect value.
This applies these two specific values: 10.2 and 20.4. (Each is off by
one.)
Reproduce code:
---------------
echo intval(100 * 10.2);
Expected result:
----------------
1020
Actual result:
--------------
1019
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34442&edit=1