2.4.3 two’s complement
The two’s complement of a binary number is the value obtained by subtracting
the number from a large power of two (specifically, from 2N
for an N-bit two’s
complement).
A two’s-complement system or two’s-complement arithmetic is a system in which
negative numbers are represented by the two’s complement of the absolute value.
First step - invert all bits of subtractor "0" to "1" and "1" to "0".
Second step - add "1" to the result from first step.
Final step - add the result from second step with the denominator.
Example 2-3 Calculate the result of 0010 - 0100
(1) Invert bit of subtractor 0100 >> 1011
(2) Add 1 >> 1011 + 1 = 1100
(3) Add with the denominator >> 0010 + 1100 = 1110
Signed number of 1110 = -2 in decimal