An example:
$01001 – 11010 = -10001 = -17$
one's complement: $00101$
two's complement: $00110$
so the above statement should evaluate the same as:
$01001 + 00101 = 01110$ (inverting it) $= 10001$ which is almost the same except $+17$ rather than $-17$ so I use the first bit as a sign bit then its just $-1.$
using the two's complement is not much better:
$01001 + 00110 = 01111 = 15$ which again is nowhere near the $-17$.
What in the world am I doing wrong$?$ This seems so simple but I can't get it to work.
Best Answer
I always manage to confuse myself with this process since it is not done manually too often, so refer to this handy algorithmic like approach. In both cases, the number we are subtracting is larger in magnitude.
$1's$ Complement:
This is $-17$.
$2's$ Complement:
This is $-17$.