#45321 [Opn->Bgs]: Subtract two float no
| From: | johannes@php.net | Date: | Fri, 20 Jun 2008 11:49:09 +0000 |
| Subject: | #45321 [Opn->Bgs]: Subtract two float no | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-125919@lists.php.net to get a copy of this message | ||
ID: 45321
Updated by: johannes@php.net
Reported By: saurabh-goyal at hotmail dot com
-Status: Open
+Status: Bogus
Bug Type: Output Control
Operating System: Windows NT
PHP Version: 5.2.6
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:
------------------------------------------------------------------------
[2008-06-20 10:19:56] saurabh-goyal at hotmail dot com
Description:
------------
<?php
echo 4998937.3273-4998918.4921;
?>
Output :-18.8351999996
But Exactly Output is 18.8352
Reproduce code:
---------------
<?php
echo 4998937.3273-4998918.4921;
?>
Expected result:
----------------
Output :-18.8351999996
Actual result:
--------------
But Exactly Output is 18.8352
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45321&edit=1