I am finishing an assignment related to complement calculations. The question is as follows:
Convert the following decimal numbers to eight-bits binary and perform the subtraction by using ones' and twos' complement arithmetic.
28 - 41
By using 1s complement I can get the answer -13 with the workings below
0 0 0 1 1 1 0 0
+ 1 1 0 1 0 1 1 0
------------------
1 1 1 1 0 0 1 0
Signed-magnitude in Binary: 10001101
Decimal representation: -13
For 2s complement, I understand that I should add 1 after replacing the digits but when I do the calculation, the answer doesn't make sense at all.
00101001 ---> 11010110 (Ones complement) ---> 11010111 (Twos complement)
0 0 0 1 1 1 0 0
+ 1 1 0 1 0 1 1 1
-----------------
1 1 1 1 0 0 1 1
Signed-magnitude in Binary: 10001100
Decimal representation: -12
This is most likely caused by the addition of 1. But referring to the lecture notes and the online tutorials I don't think I should make a subtraction afterwards. Did I do anything wrong during the calculation? :-(
You need to consider your result as twos complement as well, so subtract $1$, getting $11110010_2$, then complement, getting $1101_2=13_{10}$ Arithmetic works staying withing twos complement.