#47107 [Bgs]: numbers with more than 15 digits are not behaved normally
| From: | mucahitkahveci at gmail dot com | Date: | Fri, 01 May 2009 07:53:46 +0000 |
| Subject: | #47107 [Bgs]: numbers with more than 15 digits are not behaved normally | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-136618@lists.php.net to get a copy of this message | ||
ID: 47107
User updated by: mucahitkahveci at gmail dot com
Reported By: mucahitkahveci at gmail dot com
Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Windows xp sp2
-PHP Version: 5.2.8
+PHP Version: 5.2.2
New Comment:
I understand that, but isn't it a big problem? Since php supports
integers for "maximum value of about two billion" (php manual) in which
it than changes to floating point numbers for numbers bigger than this.
So for any value its bigger than 15 digit its a very very big problem
while querying in a database. For example mysql has bigint type which
supports a maximum of 20 digits. But because of this behaviour of php we
have to use only upto 15 digits!! And if someone skips this detail it
would cause problems that is impossible to solve
Thanks
Previous Comments:
------------------------------------------------------------------------
[2009-01-15 12:48:30] jani@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.
And 32bit issue..etc. etc. No bug.
------------------------------------------------------------------------
[2009-01-14 19:57:52] mucahitkahveci at gmail dot com
Description:
------------
printf('%f', 55555555555555555555);
prints 55555555555555557376.000000
This number (555...) has 20 digits this happen in any number with more
than 15 digits
Reproduce code:
---------------
printf('%f', 55555555555555555555);
Expected result:
----------------
55555555555555555555.000000
Actual result:
--------------
55555555555555557376.000000
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47107&edit=1