|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #47901 Need to define "large numbers" in base_convert limitations
Submitted: 2009-04-05 14:24 UTC Modified: 2009-11-19 13:14 UTC
From: exploringbinary at gmail dot com Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS: Windows
Private report: No CVE-ID: None
 [2009-04-05 14:24 UTC] exploringbinary at gmail dot com
The documentation for base_convert says "base_convert() may lose precision on large numbers...". Can you define exactly what "large number" is?  Without knowing the limit, it's hard to trust the results.

I know you can't specify a single limit, because it could vary by implementation. It still would be useful to define a limit for the most common implementations, like 32 bit unsigned integers or IEEE double floating-point. 

In the case of IEEE double floating-point, my guess is that the limit is 2^53, meaning that all integers less than or equal to 2^53 will be converted correctly. (All integers from 0 to 2^53 can fit in an IEEE double.) 

Related bug reports:
Bug #23564 base_convert() ignores last character
Bug #35874 base_convert is off on numbers greater than 13 decimal places 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-11-19 11:14 UTC]
There's a link to Floating point numbers.
 [2009-11-19 13:14 UTC] exploringbinary at gmail dot com
Yes, I know there's a link. My bug report quotes text from the paragraph that contains it. There is nothing within that link, that I can see, that addresses my concern. If you see something there, please be specific.
 [2016-03-02 02:53 UTC] exploringbinary at gmail dot com
In my article I define the limits for safe base_convert() conversions. You can consider drawing from it to update your documentation.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Jul 17 13:01:29 2024 UTC