Re: binary subtraction assistance

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Check http://nl3.php.net/manual/en/function.bindec.php

Probably you have a 32-bit CPU. See the link why that's a problem.

Loran

On Thu, 20 Oct 2011 11:08:52 -0400, michaelalaimo@xxxxxxxxx (Mike
Alaimo) wrote:

>Hello,
>
>I have two binary numbers which are quite long.  128 bits to be exact.
>
>When converting the two items to decimal i get the same result.  The
>binary numbers are quite different, so I am not getting the expected
>results.
>
>Here is my code:
>
>$b1 = '00100000000000010000110110111000100001011010001100000000000000001111111111111111111111111111111111111111111111111111111111111111';
>$b2 = '00100000000000010000110110111000100001011010001100000000000000000000000000000000000000000000000000000000000000000000000000000000';
>
>$dec1 = bindec($b1);
>$dec2 = bindec($b2);
>
>echo $dec1."\n";
>echo $dec2;
>
>I get 4.2540766452641E+37 for both $dec1 and $dec2.
>
>What can I do to resolve the problem?
>
>Mike

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux