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 26 + 1X 25 + 1X 24 + 1X 23+ 0 X 22 + 1X 21 + 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 25 + 1X 24 + 1X 23 + 1X 22+ 0 X 21 + 1X 20= 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 25 + 0X 24 + 0X 23+ 0 X 22 + 0X 21 + 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 28 + 1 X 27 + 1 X 26 + 1 X 25 + 1X 24 + 1X 23 + 1X 22+ 1 X 21 + 1X 20= 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 22+ 1 X 21 + 1X 20= 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 27 + 0 X 26 + 0 X 25 + 1X 24 + 1X 23 + 1X 22+ 1 X 21 + 1X 20 = 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 28 + 1 X 27 + 0 X 26 + 1 X 25 + 1X 24 + 0X 23 + 1X 22+ 1 X 21 + 0X 20= 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 21 + 1X 20= 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 24 + 1X 23+ 1 X 22 + 1X 21 + 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.