#20925 [Opn->Csd]: base_convert does not convert a number back to itself
| From: | sniper@php.net | Date: | Tue, 10 Dec 2002 23:15:38 +0000 |
| Subject: | #20925 [Opn->Csd]: base_convert does not convert a number back to itself | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-27297@lists.php.net to get a copy of this message | ||
ID: 20925
Updated by: sniper@php.net
Reported By: alberto.vassena@infinito.it
-Status: Open
+Status: Closed
Bug Type: Math related
Operating System: 2.4.19-16mdk
PHP Version: 4.2.3
New Comment:
Fixed in CVS. (and in PHP 4.3.0-dev)
Previous Comments:
------------------------------------------------------------------------
[2002-12-10 16:00:32] alberto.vassena@infinito.it
I am expecting that a number with a base X is converted to itself if
the base is unchanged.
<?php
$number = "987654321";
$after = base_convert($number, 10, 10);
echo "\nBefore: $number";
echo "\nAfter : $after\n\n";
?>
987654321 gives back, in fact, 987654321.
Unfortunately, this is not always true:
<?php
$number = "9876543210";
$after = base_convert($number, 10, 10);
echo "\nBefore: $number";
echo "\nAfter : $after\n\n";
?>
9876543210 gives back 1286608618
The 4.2.3 version I have been using is the one that comes with the
Mandrake 9.0 distribution.
I have been keeping it regularly updated on the web (now is Dec 12th,
2002).
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=20925&edit=1