Signed numbers




In decimal number system, we can easily represent the positive and negative number by (+) and (-) sign respectively. But in the digital system, we use, ‘0’ and ‘1’, these symbols to represent the sign of the number.
We can represent the sign of the number in two ways:

1.    Signed Magnitude Form
2.    Complement Form

1) Signed Magnitude Form

In signed magnitude form, we add an extra bit to the number at LHS of MSB (Most Significant Bit). The extra bit added is called the sign bit.
The sign bit we add is either 0 or 1 depending on if the number is positive or negative. If the number is positive, we add 0 as the sign bit and if the number is negative, we add 1 as the sign bit.

Example: Represent 12 and -12 as a binary number.
12 -> 0 1100
-12 -> 1 1100

2) Complement Form

 Digital computers and systems use the complement form to perform arithmetic calculations as performing them using signed magnitude form is complex.
We have two complement forms:

1’s complement form
2’s complement form

If the number is positive then, the magnitude is represented in its true binary form and a sign bit 0 is added to the LHS of the MSB. For a positive number, the representation is the same in signed magnitude, 1's and 2's complement form.
The advantage of using a complement form to perform arithmetic operations is the reduction in the hardware. Instead, of having separate hardware for addition and subtraction only additional adders are needed.

1's Complement Representation


The 1's complement of a number can be obtained by replacing each "0 bit with 1 bit" and "1 bit with 0 bit" in the binary number.

Example: Represent (-12)10 in its 1's complement form.
(12)10 in binary form can be represented as (1100)2.
Now, to represent its negative sign, we will add a sign bit 1.
Thus, (-15)10 = (1,1100)2. To represent it in 1's complement form, we will replace each 1 with 0 and each 0 with 1, excluding the sign bit. Therefore,


Hence, (-12)10 in its 1's complement form is 10011.

2's Complement Representation


We can get the 2's complement of a number by finding the 1's the complement of number and adding 1 to the LSB of the respective 1's complement.

Example: Represent (-12)10 in its 2's complement form.
1's complement representation of (-12)10 is given as 10011. Now, we have to add a bit 1 to the LSB in the above 1's complement form to get  2's complement. 

Hence, 2’s representation of (12)10 is given as 10100.

Post a Comment

0 Comments