In: Computer Science
2. Convert the following decimal fractions to binary with a
maximum of six places to the right of the binary point: [12]
a. 25.84375 b. 57.55 c. 80.90625 d. 84.874023
a. 25.84375 b. 57.55 c. 80.90625 d. 84.874023
a. 25.84375
Decimal Part (need to do division with 2 untill we get qoutient
=0)
25/2 ---> remainder = 1 , Quotient = 12
12/2 ---> remainder = 0 , Quotient = 6
6/2 ---> remainder = 0 , Quotient = 3
3/2 ---> remainder = 1 , Quotient = 1
1/2 ---> remainder = 1 , Quotient = 0
Write the remainders in reverse direction.
11001
Fraction Part(need to multiplication with 2 untill both fraction
part and decimal part becomes 0)
0.84375 * 2 ---> 1.6875 , fraction = 0.6875 , Integer = 1
0.6875 * 2 ---> 1.375 , fraction = 0.375 , Integer = 1
0.375 * 2 ---> 0.75 , fraction = 0.75 , Integer = 0
0.75 * 2 ---> 1.5 , fraction = 0.5 , Integer = 1
0.5 * 2 ---> 1.0 , fraction = 0.0 , Integer = 1
0.0 * 2 ---> 0.0 , fraction = 0.0 , Integer = 0
Write the integers in normal direction.
110110
Append Fractional part to Decimal part with dot.
25.84375 = 11001.110110
b. 57.55
Decimal Part (need to do division with 2 untill we get qoutient
=0)
57/2 ---> remainder = 1 , Quotient = 28
28/2 ---> remainder = 0 , Quotient = 14
14/2 ---> remainder = 0 , Quotient = 7
7/2 ---> remainder = 1 , Quotient = 3
3/2 ---> remainder = 1 , Quotient = 1
1/2 ---> remainder = 1 , Quotient = 0
Write the remainders in reverse direction.
111001
Fraction Part(need to multiplication with 2 untill both fraction
part and decimal part becomes 0)
0.55 * 2 ---> 1.1 , fraction = 0.1 , Integer = 1
0.1 * 2 ---> 0.2 , fraction = 0.2 , Integer = 0
0.2 * 2 ---> 0.4 , fraction = 0.4 , Integer = 0
0.4 * 2 ---> 0.8 , fraction = 0.8 , Integer = 0
0.8 * 2 ---> 1.6 , fraction = 0.6 , Integer = 1
0.6 * 2 ---> 1.2 , fraction = 0.2 , Integer = 1
We can stop here, since in question it is asked for 6 places.
Write the integers in normal direction.
100011
Append Fractional part to Decimal part with dot.
57.55 = 111001.100011
c. 80.90625
Decimal Part (need to do division with 2 untill we get qoutient
=0)
80/2 ---> remainder = 0 , Quotient = 40
40/2 ---> remainder = 0 , Quotient = 20
20/2 ---> remainder = 0 , Quotient = 10
10/2 ---> remainder = 0 , Quotient = 5
5/2 ---> remainder = 1 , Quotient = 2
2/2 ---> remainder = 0 , Quotient = 1
1/2 ---> remainder = 1 , Quotient = 0
Write the remainders in reverse direction.
1010000
Fraction Part(need to multiplication with 2 untill both fraction
part and decimal part becomes 0)
0.90625 * 2 ---> 1.8125 , fraction = 0.8125 , Integer = 1
0.8125 * 2 ---> 1.625 , fraction = 0.625 , Integer = 1
0.625 * 2 ---> 1.25 , fraction = 0.25 , Integer = 1
0.25 * 2 ---> 0.5 , fraction = 0.5 , Integer = 0
0.5 * 2 ---> 1.0 , fraction = 0.0 , Integer = 1
0.0 * 2 ---> 0.0 , fraction = 0.0 , Integer = 0
Write the integers in normal direction.
111010
Append Fractional part to Decimal part with dot.
80.90625 = 1010000.111010
d. 84.874023
Decimal Part (need to do division with 2 untill we get qoutient
=0)
84/2 ---> remainder = 0 , Quotient = 42
42/2 ---> remainder = 0 , Quotient = 21
21/2 ---> remainder = 1 , Quotient = 10
10/2 ---> remainder = 0 , Quotient = 5
5/2 ---> remainder = 1 , Quotient = 2
2/2 ---> remainder = 0 , Quotient = 1
1/2 ---> remainder = 1 , Quotient = 0
Write the remainders in reverse direction.
1010100
Fraction Part(need to multiplication with 2 untill both fraction
part and decimal part becomes 0)
0.874023 * 2 ---> 1.748046 , fraction = 0.748046 , Integer =
1
0.748046 * 2 ---> 1.496092 , fraction = 0.496092 , Integer =
1
0.496092 * 2 ---> 0.992184 , fraction = 0.992184 , Integer =
0
0.992184 * 2 ---> 1.984368 , fraction = 0.984368 , Integer =
1
0.984368 * 2 ---> 1.968736 , fraction = 0.968736 , Integer =
1
0.968736 * 2 ---> 1.937472 , fraction = 0.937472 , Integer =
1
We can stop here, since in question it is asked for 6 places.
Write the integers in normal direction.
110111
Append Fractional part to Decimal part with dot.
84.874023 = 1010100.110111
Feel free to ask any doubts, if you face any difficulty in understanding.
Please upvote the answer if you find it
helpful