I have a problem with the subtraction of 2s complement.
I tried subtracting (-22) - 12 = (-22) + (-12)
this is what I get:
-22 = 1110 1010
-12 = 1111 0100
1110 1010
+ 1111 0100
= (1)1101 1110
If I understand it correctly, the overflow indicates that it's a negative number but 1101 1110
isn't 34
?
I don't see where I'm wrong ...
Thanks !
Your answer is:
111011110 = -(2^8-(2^7+2^6+2^4+2^3+2^2+2))=-34
you can calculate it another way
111011110 = -(000100001 +1)= -(000100010)=-34