[Math] Simple binary subtraction

binary

$$101110 – 110111$$

Did the 2's complment and cannot get to the answer. The answer is apparently
$$-1001$$

I did 2's complment on the $$110111$$
and performed addition but did not get to the answer.
But I heard that I have to "zero-fill" before i do it or something

Best Answer

$$101110 - 110111 = 101110 + 001001 = 110111$$ with $110111$ being in two's complement (since it has a leading $1$, hence, equivalent to binary $-001001 \; = \;-1001$

The trick I use to go back and forth from two's complement is to switch ALL digits (reverse $1\to 0, 0 \to 1$, then add one bit $1$ ($+000001$ in this case)

Related Question