Can someone explain 2s complement to me?
I need to know the 2s complement of the following 0 0000101 1101111000.
thanks
Hello, sjenkins!
Can someone explain 2s complement to me?
I need to know the 2s complement of the following: 0 0000101 1101111000.
We need a lot more information . . . but I'll take a wild guess . . .
The "2s complement" is found by subtracting each digit from 2.
The 2-complement of $\displaystyle 0$ is $\displaystyle 2$
The 2-complement of $\displaystyle 0000101$ is $\displaystyle 2222121$
The 2-complement of $\displaystyle 1101111000$ is $\displaystyle 1121111222$
If we have a 8-bit representation of a number, for example 1001 0011. To find det complement you just flip the bits and add 1:
0110 1100 + 1 = 0110 1101.
Example: calculate 123 - 3 (8-bits representation)
123 = 0111 1011
3 = 0000 0011
Complement of 3: 1111 1100 + 1 = 1111 1101
Just add 123 with the complement of 3:
0111 1011 + 1111 1101 = 1 0111 1000
You see that we now have an overflow of 1 bit. We just remove the one bit to the left and get: 0111 1000 = 120
Hope this helps.