using 4-bit numbers calculating -3 + -3 in two's complement, my calculation yields -2.
3 in binary is 0011
making both one's complement by flipping all the digits since both are negative
1100 && 1100
adding one to them, since we are using two's complement
1101 + 1101 =
11010
first one is overflow, and are tossed away in two's complement. So are left with 1010, which is minus two in decimal. Can someone explain what is done wrong in this process?
EDIT
My problem seems more specifically how to interpret the result of a two's complement calculation. I treat the result as following:
The result is 1010. In my world, the first bit is a sign bit, indicating that the number is negative. The following 0 means there is 0 of -4's the following 1 means there is 1 of -2's the following 0 means there is 0 of -1's
therefore, I interpret it like the result is -2
1010
is-6
, which is the correct answer.1110
is-2
. – Aadit M Shah1101
should then be-5
but you said it yourself that it's-3
. – Aadit M Shah