Two's Complement Notation Integers
Example of conversion to signed binary of a decimal integer:
Let's convert to signed binary the following integer: -200
-200 = -256 + 32 + 16 + 8 = = -1×28 + 0×27 + 0×26 + 1×25 + 1×24 + 1×23 + 0×22 + 0×21 + 0×20 = 1001110002.Example of sign extension of numbers in two's complement representation
Let's store the 8 bit number 11100100 on 6 bits:
We remove the first two 1's and the result is 100100. Note that to store a 8 bit number in 6 bits you can simply truncate the upper 2 bits as long as they are all the same as the left-most bit in the resulting 6 bit number - i.e., the sign doesn't change.