#39900 [Opn->Bgs]: intval error
| From: | tony2001@php.net | Date: | Wed, 20 Dec 2006 12:54:11 +0000 |
| Subject: | #39900 [Opn->Bgs]: intval error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-106634@lists.php.net to get a copy of this message | ||
ID: 39900
Updated by: tony2001@php.net
Reported By: alexsum at ua dot fm
-Status: Open
+Status: Bogus
Bug Type: *Math Functions
Operating System: Windows 2000 XP
PHP Version: 5.2.0
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:
------------------------------------------------------------------------
[2006-12-20 12:42:28] alexsum at ua dot fm
Description:
------------
why
in "echo $n*100-intval($n)*100" output :92
but
in "echo intval($n*100-intval($n)*100)" output ^91
Reproduce code:
---------------
intval(142.92*100-intval($n)*100)
Expected result:
----------------
92
Actual result:
--------------
91
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39900&edit=1