php.net |  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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: exploringbinary at gmail dot com
New email:
PHP Version: OS:

 

 [2009-04-05 14:24 UTC] exploringbinary at gmail dot com
Description:
------------
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 



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-11-19 11:14 UTC] vrana@php.net
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 http://www.exploringbinary.com/the-safe-range-for-phps-base-convert/ 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: Mon Nov 25 01:01:31 2024 UTC