#42581 [Opn->Bgs]: strange echo of float vals
| From: | derick@php.net | Date: | Thu, 06 Sep 2007 21:49:51 +0000 |
| Subject: | #42581 [Opn->Bgs]: strange echo of float vals | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-117243@lists.php.net to get a copy of this message | ||
ID: 42581
Updated by: derick@php.net
Reported By: ger dot kirill at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: Math related
Operating System: Windows, Linux
PHP Version: 5.2.4
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:
------------------------------------------------------------------------
[2007-09-06 15:59:29] ger dot kirill at gmail dot com
Description:
------------
Just look into the code below. Note: could not be reproduced with *any*
numbers. Use ones used in example to reproduce.
Reproduce code:
---------------
echo intval(144.2*100);//14419
Expected result:
----------------
14420
Actual result:
--------------
14419
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42581&edit=1