Page 53 - Computer Science Class 11 Without Functions
P. 53
Example 21: (0.010011001) to decimal
2
Face Value 0. 0 1 0 0 1 1 0 0 1
Place Value 2 0 2 –1 2 –2 2 –3 2 –4 2 –5 2 –6 2 –7 2 –8 2 –9
–1
–8
–7
–2
–5
–6
–3
–4
= 0 × 2 + 1 × 2 + 0 × 2 + 0 × 2 + 1 × 2 + 1 × 2 + 0 × 2 + 0 × 2 + 1 × 2 –9
1 1 1 1
= + + +
2 2 2 5 2 6 2 9
1 1 1 1
= + + +
4 32 64 512
= 0.25 + 0.03125 + 0.01562 + 0.001953
= (0.29882)
10
Note that the number (0.298828125) is slightly less than (0.3) . Recall that the binary representation of (0.3) being
10
10
10
non-terminating, we had to ignore the bits beyond a certain number of bits (nine bits in the above example). So, when
we convert the truncated binary number to decimal, we do not get back the number (0.3) .
10
Example 22: (1100101.01) to decimal
2
Face Value 1 1 0 0 1 0 1 . 0 1
Place Value 2 6 2 5 2 4 2 3 2 2 2 1 2 0 2 –1 2 –2
6
0
4
5
1
–1
2
3
= 1 × 2 + 1 × 2 + 0 × 2 + 0 × 2 + 1 × 2 + 0 × 2 + 1 x 2 + 0 × 2 + 1 × 2 –2
= 64 + 32 + 0 + 0 + 4 + 0 + 1 + 0 + 1
2 4
= (101.25) 10
Conversion of Fractional Numbers from Decimal to Octal
To convert fractional numbers in the decimal number system to octal, follow the following steps:
1. Multiply the fractional part by 8.
2. Note the integer part.
3. Multiply only the fractional part by 8.
4. In the case of terminating fractions, repeat steps 2 and 3 till the fractional part becomes zero. In the case of
non-terminating fractions, repeat steps 2 and 3 until the desired number of bits after the radix point has been
obtained. Examples 23 and 24 illustrate the conversion of terminating and non-terminating fractions.
5. The integer part from top to bottom forms the octal number.
Example 23: Convert (0.125) to its equivalent octal number.
10
Fraction part Integer part
0.125 × 8 = 1.0 0.0 1
0.0 × 8 = 0.0 0.0 0
(0.125) = (0.1) 8
10
Example 24: Convert (0.740234375) to its equivalent octal number.
10
Fraction part Integer part
0.740234375 × 8 = 5.921875 0.921875 5
0.921875 × 8 = 7.375 0.375 7
0.375 × 8 = 3.0 0.0 3
(0.740234375) = (0.573)
10 8
Number Systems and Encoding Schemes 51

