ID:               42694
 Updated by:       [EMAIL PROTECTED]
 Reported By:      carrotcake1029 at gmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Math related
 Operating System: Windows Vista Home Premium
 PHP Version:      5.2.4
 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.




Previous Comments:
------------------------------------------------------------------------

[2007-09-19 13:13:19] smlerman at gmail dot com

It's most likely because the number you're using is greater than the
maximum for a 32-bit signed integer, resulting in an integer overflow.
Try it with a smaller number and see what happens.

------------------------------------------------------------------------

[2007-09-18 07:08:32] carrotcake1029 at gmail dot com

Description:
------------
I wrote my own little function that can take numbers and make turn them
into numbers of other bases.  When I ran a few tries with binary, I
began to notice that PHP's decbin() was not matching up with mine. 
Easily proven, mine was correct.

Reproduce code:
---------------
echo dec2base(4728937489, 2) . "\n";
echo decbin(4728937489);

function dec2base($int, $base)
{
        while ($int >= 1)
        {
                $ret .= $int % $base;
                $int = $int / $base;
        }
        return strrev($ret);
}

Expected result:
----------------
100011001110111011101110000010001
100011001110111011101110000010001

Actual result:
--------------
100011001110111011101110000010001
11001110111011101110000010001


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=42694&edit=1

Reply via email to