|
Posted by Jim Michaels on 01/23/06 22:47
How do you know the PHP lexical analyzer or parser is going to lop off a bit
for you? what if it does something else?
your number in hex is 0xFFFF FFFE E58D 315F ^ 0x0000 0000 0000 AB26=0xFFFF
FFFF 8000 AB26
2's complement numbers in hex are represented differently in binary...
this is from pcalc, a program from analogx.com (64-bit programmer's
calculator)
"Tim Roberts" <timr@probo.com> wrote in message
news:3921t1p8r8imnqmgnijdrpkmeknr1t0ooa@4ax.com...
> "Chung Leong" <chernyshevsky@hotmail.com> wrote:
>>
>>How is -4,738,698,913 ^ 43814 = -443,704,711 correct?
>
> First, answer this question: how can you squeeze -4,738,698,913 into a
> 32-bit variable?
>
> 4,738,698,913 would be 1_1A72_CEA1 in hex, but that needs 33 bits. If you
> truncate that to 32 bits, you get 1A72_CEA1. Xor that with 43,814, which
> is AB26 in hex, and you get 1A72_6587, which just happens to be
> 443,704,711.
> --
> - Tim Roberts, timr@probo.com
> Providenza & Boekelheide, Inc.
[Back to original message]
|