Re: bindec/decbin
| From: | Jakub Vrana | Date: | Thu, 26 Feb 2004 15:42:19 +0000 |
| Subject: | Re: bindec/decbin | ||
| References: | 1 2 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969359249@lists.php.net to get a copy of this message | ||
Cornelia Boenigk wrote:
> *bindec() converts a binary number to an integer. The largest number
> that can be converted is 31 bits of 1's or 2147483647 in decimal.*
> bindec() can handle much bigger values, see the example below.
You are right. Since PHP 4.1.0 bindec returns float instead of long
for large numbers. I will add a note about this to the manual.
> *Returns a string containing a binary representation of the given
> number argument. The largest number that can be converted is
> 4294967295 in decimal resulting to a string of 32 1's.*
> decbin doesn't issue an error when called with bigger values. The
> function converts but truncates every bigger value to 32 digits where
> the MSB are truncated.
If nobody objects, I will add this exact paragraph to the manual.
Jakub Vrana