In: Computer Science
Complete the matrix below (use 4 bits)
Signed Integer |
Signed Magnitude |
1’s Complement |
2’s Complement |
Excess-7 |
|
5 |
|||||
-3 |
SOL:
1) Given signed integer = 5
signed magnitude representation :
The signed magnitude representation = 0101
we put 0 in the MSB because given number is a positive sign
0 indicates positive number
1's complement represntation:
The signed magnitude, 1's complement represntation and 2's complement represntation all are same for the positive number
Given number is 5 which is positive
so 1's complement representation = 0101
2's complement representation:
The signed magnitude, 1's complement represntation and 2's complement represntation all are same for the positive number
Given number is 5 which is positive
so 2's complement representation = 0101
Excess-7 :
To convert to Excess-7 code we need to add the7 to 5
7+5 =12
Binary equivalent of (12) = (1100)2
So Excess -7 code is 1100 = (12)10
2) Given signed integer = -3
signed magnitude representation:
The signed magnitude representation = 1011
we put 1 in the MSB because given number is negative
1's complement representation:
The given number is negative so signed magnitude,1's complement and 2's complement values will differ
For 1's complement we interchange 1's and 0's except the MSB which is a sign bit
so The 1's complement representation = 1100
2's complement representation:
he given number is negative so signed magnitude,1's complement and 2's complement values will differ
For 2's complement we will keep the number as it is untill we encounter first 1 after that we interchange 1's and 0's except the MSB which is a sign bit
so The 2's complement representation = 1101
Excess-7 code:
To convert to Excess-7 code we need to add the 7 to -3
so 7+(-3) = 4
Binary equivalent of 4 is (0100)2
so Excess 7 code is 0100
signed integer | signed magnitude | 1's complemet | 2's complement | Excess-7 |
5 | 0101 | 0101 | 0101 | 1100 |
-3 | 1011 | 1100 | 1101 | 0100 |