#41583 [Bgs]: number_format() return unexpected number for big number
| From: | info at qwerq dot com | Date: | Mon, 04 Jun 2007 12:34:35 +0000 |
| Subject: | #41583 [Bgs]: number_format() return unexpected number for big number | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-113350@lists.php.net to get a copy of this message | ||
ID: 41583
User updated by: info at qwerq dot com
Reported By: info at qwerq dot com
Status: Bogus
Bug Type: Strings related
Operating System: windows XP
PHP Version: 4.4.7
New Comment:
Thanks your information and that link was very helpful, so I guess it's
not PHP bug but it's my fault. :)
Previous Comments:
------------------------------------------------------------------------
[2007-06-04 10:17:52] tony2001@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.
------------------------------------------------------------------------
[2007-06-04 10:05:45] info at qwerq dot com
Description:
------------
My PHP version is 5.1.6 specifically, number_format() return unexpected
result for big number
Reproduce code:
---------------
echo number_format(2000000000000000000000000, 0,'.',' ');
Expected result:
----------------
2 000 000 000 000 000 000 000 000
Actual result:
--------------
2 000 000 000 000 001 200 000 000
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41583&edit=1