#49214 [Opn->Bgs]: Print floating
| From: | derick@php.net | Date: | Tue, 11 Aug 2009 09:08:49 +0000 |
| Subject: | #49214 [Opn->Bgs]: Print floating | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-140902@lists.php.net to get a copy of this message | ||
ID: 49214
Updated by: derick@php.net
Reported By: leeja120 at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: Output Control
Operating System: windows xp
PHP Version: 5.2SVN-2009-08-10 (snap)
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:
------------------------------------------------------------------------
[2009-08-11 07:05:15] sjoerd-php at linuxonly dot nl
Thank you for your report.
The behavior you describe, although it is somewhat strange, is not a
bug. It is documented:
"If PHP encounters a number beyond the bounds of the integer type, it
will be interpreted as a float instead."
"The size of a float is platform-dependent, although a maximum of
~1.8e308 with a precision of roughly 14 decimal digits is a common value
(the 64 bit IEEE format)."
------------------------------------------------------------------------
[2009-08-10 20:49:09] leeja120 at gmail dot com
Description:
------------
Print floating
Reproduce code:
---------------
<?PHP
echo 946744073709551614;
?>
Expected result:
----------------
946744073709551614
Actual result:
--------------
946744073709550000
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=49214&edit=1