#41583 [Opn->Bgs]: number_format() return unexpected number for big number
| From: | tony2001@php.net | Date: | Mon, 04 Jun 2007 10:17:52 +0000 |
| Subject: | #41583 [Opn->Bgs]: number_format() return unexpected number for big number | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-113339@lists.php.net to get a copy of this message | ||
ID: 41583
Updated by: tony2001@php.net
Reported By: info at qwerq dot com
-Status: Open
+Status: Bogus
Bug Type: Strings related
Operating System: windows XP
PHP Version: 4.4.7
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:
------------------------------------------------------------------------
[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