Integer Representation
signed numbers:
When an integer binary number is positive, the sign is represented by 0 and the magnitude by a positive binary number. When the number is negative, the sign is represented by 1 but the rest of the number may be represented in one of three possible ways:
1. Signed-magnitude representation
2. Signed-1' s complement representation
3. Signed 2' s complement representation
These Topics Are Also In Your Syllabus | ||
---|---|---|
1 | Input - output Register | link |
2 | Complete Computer Description | link |
You May Find Something Very Interesting Here. | link | |
3 | Design of Basic Computer | link |
4 | Control Logic Gates | link |
5 | Types Of Systems | link |
The signed-magnitude representation of a negative number consists of the magnitude and a negative sign. In the other two representations, the negative number is represented in either the 1's or 2's complement of its positive value. As an example, consider the signed number 14 stored in an 8-bit register. + 14 is represented by a sign bit of 0 in the leftmost position followed by the binary equivalent of 14: 00001110. Note that each of the eight bits of the register must have a value and therefore 0' s must be inserted in the most significant positions following the sign bit. Although there is only one way to represent + 14, there are three different ways to represent - 14 with eight bits.
In signed-magnitude representation 1 0001110
In signed-1's complement representation 1 11 10001
In signed-2's complement representation 1 11 10010
The signed-magnitude representation of - 14 is obtained from + 14 by complementing only the sign bit. The signed-1's complement representation of - 14 is obtained by complementing all the bits of + 14, including the sign bit. The signed-2' s complement representation is obtained by taking the 2' s complement of the positive number, including its sign bit.
These Topics Are Also In Your Syllabus | ||
---|---|---|
1 | Arithmetic Addition | link |
2 | ARITHMETIC SUBTRACTION | link |
You May Find Something Very Interesting Here. | link | |
3 | Overflow | link |
4 | FLOW CONTROL | link |
5 | Decimal Fixed-Point Representation | link |
The signed-magnitude system is used in ordinary arithmetic but is awkward when employed in computer arithmetic. Therefore, the signed-complement is normally used. The 1' s complement imposes difficulties because it has two representations of 0 (+0 and - 0). It is seldom used for arithmetic operations except in some older computers. The 1's complement is useful as a logical operation since the change of 1 to 0 or 0 to 1 is equivalent to a logical complement operation. The following discussion of signed binary arithmetic deals exclusively with the signed-2's complement representation of negative numbers.