Express the following 2’s complement number in decimal form, assume leftmost bit is the sign bit.
d. 100000001 e. 101 f. 00011111
g. 101001010 h. 11 i. 10001
To solve this, first thing we need to keep in mind is that if the signed bit is '0', the number is positive and if the signed bit is '1', the number is negative. If the number is positive, simply convert it to decimal. If the number is negative, first make it positive by inverting its digits and adding 1 and then find its decimal.
The decimal form of the given 2's complement numbers are given below :
a. Since the leftmost bit of 1000110 is 1, so the number is negative.
Now change the sign to get the magnitude of the number.
1 0 0 0 1 1 0
0 1 1 1 0 0 1
+ 1
= 0 1 1 1 0 1 0
Now convert this magnitude to decimal.
0 X 2^{6} + 1X 2^{5} + 1X 2^{4} + 1X 2^{3}+ 0 X 2^{2} + 1X 2^{1} + 0 X 2 ^{0} = 32 + 16 + 8 + 2 = 58
And since the original number was negative, the final result in decimal form is -58.
b. Since the leftmost bit of 011101 is 0, so the number is positive.
Now simply convert it to decimal.
0 X 2^{5} + 1X 2^{4} + 1X 2^{3} + 1X 2^{2}+ 0 X 2^{1} + 1X 2^{0}= 16 + 8 + 4 + 1 = 29
And since the original number was positive, the final result in decimal form is +29.
c. Since the leftmost bit of 111111 is 1, so the number is negative.
Now change the sign to get the magnitude of the number.
1 1 1 1 1 1
0 0 0 0 0 0
+ 1
= 0 0 0 0 0 1
Now convert this magnitude to decimal.
0X 2^{5} + 0X 2^{4} + 0X 2^{3}+ 0 X 2^{2} + 0X 2^{1} + 1 X 2 ^{0} = 1
And since the original number was negative, the final result in decimal form is -1.
d. Since the leftmost bit of 100000001 is 1, so the number is negative.
Now change the sign to get the magnitude of the number.
1 0 0 0 0 0 0 0 1
0 1 1 1 1 1 1 1 0
+ 1
= 0 1 1 1 1 1 1 1 1
Now convert this magnitude to decimal.
0 X 2^{8} + 1 X 2^{7} + 1 X 2^{6} + 1 X 2^{5} + 1X 2^{4} + 1X 2^{3} + 1X 2^{2}+ 1 X 2^{1} + 1X 2^{0}= 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255
And since the original number was negative, the final result in decimal form is -255.
e. Since the leftmost bit of 101 is 1, so the number is negative.
Now change the sign to get the magnitude of the number.
1 0 1
0 1 0
+ 1
= 0 1 1
Now convert this magnitude to decimal.
0X 2^{2}+ 1 X 2^{1} + 1X 2^{0}= 2 + 1 = 3
And since the original number was negative, the final result in decimal form is -3.
f. Since the leftmost bit of 00011111 is 0, so the number is positive.
Now simply convert it to decimal.
0 X 2^{7} + 0 X 2^{6} + 0 X 2^{5} + 1X 2^{4} + 1X 2^{3} + 1X 2^{2}+ 1 X 2^{1} + 1X 2^{0} = 16 + 8 + 4 + 2 + 1 = 31
And since the original number was positive, the final result in decimal form is +31.
g. Since the leftmost bit of 101001010 is 1, so the number is negative.
Now change the sign to get the magnitude of the number.
1 0 1 0 0 1 0 1 0
0 1 0 1 1 0 1 0 1
+ 1
= 0 1 0 1 1 0 1 1 0
Now convert this magnitude to decimal.
0 X 2^{8} + 1 X 2^{7} + 0 X 2^{6} + 1 X 2^{5} + 1X 2^{4} + 0X 2^{3} + 1X 2^{2}+ 1 X 2^{1} + 0X 2^{0}= 128 + 32 + 16 + 4 + 2 = 182
And since the original number was negative, the final result in decimal form is -182.
h. Since the leftmost bit of 11 is 1, so the number is negative.
Now change the sign to get the magnitude of the number.
1 1
0 0
+ 1
= 0 1
Now convert this magnitude to decimal.
0 X 2^{1} + 1X 2^{0}= 1
And since the original number was negative, the final result in decimal form is -1.
i. Since the leftmost bit of 10001 is 1, so the number is negative.
Now change the sign to get the magnitude of the number.
1 0 0 0 1
0 1 1 1 0
+ 1
= 0 1 1 1 1
Now convert this magnitude to decimal.
0X 2^{4} + 1X 2^{3}+ 1 X 2^{2} + 1X 2^{1} + 1 X 2 ^{0} = 8 + 4 + 2 + 1 = 15
And since the original number was negative, the final result in decimal form is -15.
Note : If you still have any doubt/query regarding the solution then let me know in comment. If it helps, kindly give an upVote to this answer.
Get Answers For Free
Most questions answered within 1 hours.