Value of Two's Complement Numbers
For an n-bit 2's complement number the weights of the bits is the same as for unsigned numbers except of the MSB . For the MSB or sign bit, the weight is -2 n-1. The value of the n-bit 2's complement number is given by:
A 2's-complement = (a n-1 ) x (-2 n-1 ) + (a n-2 ) x (2 n-1 ) + ... (a 1 ) x (2 1 ) + a 0
For example, the value of the 4-bit 2's complement number 1011 is given by:
= 1 x -2 3 + 0 x 2 2 + 1 x 2 1 + 1
= -8 + 0 + 2 + 1
= -5