How to convert $\pi$ to base 16?
According to this Wikipedia article $\pi$ is approximately 3.243F in base 16 (i.e. hexadecimal).
Can someone explain this? (Note: I understand how to convert an integer to base 16)
Thanks
Solution 1:
One way to convert any decimal fraction to base $16$ is as follows (taking $\pi$ as an example).$$\pi=\color{blue}3.141592...$$
Take the whole number part and convert it to base $16$ as usual. In this case $\color{blue}3$ will remain as $3$. So we have so far got $3.14159..._{10}=\color{red}{3...._{16}}$
This now leaves us with $0.141592...$ - Multiply this by our new base to get $$\color{red}{16}\times0.14159...=\color{blue}2.26544...$$Now again convert the whole number part to our new base as usual - in this case the $\color{blue}2$ remains as a $2$. So we have so far got $3.14159..._{10}=\color{red}{3.2..._{16}}$
This now leaves us with $0.26544...$ - Multiply this by our new base to get $$\color{red}{16}\times0.26544...=\color{blue}4.24704...$$Now again convert the whole number part to our new base as usual - in this case the $\color{blue}4$ remains as a $4$. So we have so far got $3.14159..._{10}=\color{red}{3.24..._{16}}$
This now leaves us with $0.24704...$ - Multiply this by our new base to get $$\color{red}{16}\times0.24704...=\color{blue}3.95264...$$Now again convert the whole number part to our new base as usual - in this case the $\color{blue}3$ remains as a $3$. So we have so far got $3.14159..._{10}=\color{red}{3.243..._{16}}$
You can continue this process for as many digits as you require.
Solution 2:
Note that: $$10000\pi=31415.92653\dots$$ which means that the decimal version of $\pi$ begins $3.1415\dots$.
Similarly: $$16^4\pi=205887.46145\dots$$ Since $205887$ is $3243F$ in hexadecimal, the hexadecimal version begins $3.243F\dots$.