Question

I managed to find and understand algorithm for converting any $x \in \Bbb R$ from a decimal number to binary number.

But I have a hard time finding an algorithm for converting a binary number with infinite bits to a decimal number. I will like to convert $(0.11001100...)_2$ to a decimal number.

Was it helpful?

Solution

Classical formula for proper fraction is $$(0.a_{-1}a_{-2}a_{-3}\cdots)_2 = \left(\sum\limits_{k=1}^{\infty}\frac{a_{-k}}{2^k}\right)_{10}$$ Where for $a_{-k}$ we have $k \in \mathbb{N}$ and $a_{-k}\in \{ 0,1\}$. As you see for indexing is taken negative numbers.

In your example $$(0.11001100...)_2 =\left( \frac{1}{2^1}+\frac{1}{2^2}+\frac{1}{2^5}+\frac{1}{2^6}+ \cdots\right)_{10}$$

OTHER TIPS

Let $x=0.11001100...$. in base $2$. Then $16x=1100.\overline{1100}\implies 15x=12\implies x=4/5$.

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