Bug #52894 [Bgs]: number_format fails with large values
| From: | info at tellmatic dot org | Date: | Tue, 21 Sep 2010 12:48:49 +0000 |
| Subject: | Bug #52894 [Bgs]: number_format fails with large values | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-154529@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52894&edit=1
ID: 52894
User updated by: info at tellmatic dot org
Reported by: info at tellmatic dot org
Summary: number_format fails with large values
Status: Bogus
Type: Bug
Package: *Math Functions
Operating System: linux
PHP Version: 5.2.14
Block user comment: N
New Comment:
number_format should 'format' numbers, not recalculate, or? thats how i
understand the function.
Previous Comments:
------------------------------------------------------------------------
[2010-09-20 18:24:37] rasmus@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.
.
------------------------------------------------------------------------
[2010-09-20 17:53:57] info at tellmatic dot org
Description:
------------
wrong output, not as give, drifts a lot!
Test script:
---------------
number_format("1234.560000", 50, '.', '');
Expected result:
----------------
expected output should be 1234.56 with additional 48 zeros! and not a
'random value'.
Actual result:
--------------
== 1234.55999999999994543031789362430572509765625000000000
????
can't be!
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52894&edit=1