php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49214 Print floating
Submitted: 2009-08-10 20:49 UTC Modified: 2009-08-11 09:08 UTC
From: leeja120 at gmail dot com Assigned:
Status: Not a bug Package: Output Control
PHP Version: 5.2SVN-2009-08-10 (snap) OS: windows xp
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: leeja120 at gmail dot com
New email:
PHP Version: OS:

 

 [2009-08-10 20:49 UTC] leeja120 at gmail dot com
Description:
------------
Print floating

Reproduce code:
---------------
<?PHP

echo 946744073709551614;

?>

Expected result:
----------------
946744073709551614

Actual result:
--------------
946744073709550000

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-08-11 07:05 UTC] 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-11 09:08 UTC] derick@php.net
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.

.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 09:01:29 2024 UTC