binary subtraction assistance
| From: | Mike Alaimo | Date: | Thu, 20 Oct 2011 15:08:52 +0000 |
| Subject: | binary subtraction assistance | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-315369@lists.php.net to get a copy of this message | ||
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