Question

The Number is given as : (C012.25)Hexadecimal I have to convert it into octal . So I converted it into Binary First and got the result as : 1100000000010010.01000000 (Since each bit in hexadecimal represents 4 bit in binary so C=1100,0=0000,1=0001,2=0010 and for 0.25=.01000000 ) The Solution mentions the Binary conversion as 1100000000010010.00100101

Please guide me about the what was done wrong ! Also if I got the binary representation...How can I convert the binary no's fractional part (0.00100101) into octal .

Was it helpful?

Solution

Here is how to convert the fractional part from hexadecimal to binary: $$ (0.25)_{16} = \frac{2}{16} + \frac{5}{16^2} = \frac{0 \cdot 8 + 0 \cdot 4 + 1 \cdot 2 + 0 \cdot 1}{16} + \frac{0 \cdot 8 + 1 \cdot 4 + 0 \cdot 2 + 1 \cdot 1}{16^2} = \\ \frac{0}{2} + \frac{0}{4} + \frac{1}{8} + \frac{0}{16} + \frac{0}{32} + \frac{1}{64} + \frac{0}{128} + \frac{1}{256} = (0.00100101)_2 $$ As you can see, we simply replace $2$ with its base 2 representation, and then adjoin the base 2 representation of $5$. I included this calculation to show why this works.

Note also that $(0.25)_{16} \neq 1/4$.

Licensed under: CC-BY-SA with attribution
Not affiliated with cs.stackexchange
scroll top