Introduction                                                                                                                                   Print this page
<< Previous |  First |  Last |  Next >>       


An n-bit 2's complement number can converted to an m-bit number where m>n by appending m-n copies of the sign bit to the left of the number. This process is called sign extension. Example: To convert the 4-bit 2's complement number 1011 to an 8-bit representation, the sign bit (here = 1) must be extended by appending four 1's to left of the number:

1011 4-bit 2's-complement = 11111011 8-bit 2's-complement

 

To verify that the value of the 8-bit number is still -5; value of 8-bit number

= -27 + 26 + 25 + 24 + 23 +2 +1

= -128 + 64 + 32 + 16 +8 +2+1

= -128 + 123 = -5

Similar to decimal number addition, two binary numbers are added by adding each pair of bits together with carry propagation. An addition example is illustrated below:

<< Previous |  First |  Last |  Next >>