# Convert HEX to BIN

How to convert the number $fada.cafe_{16}$ to binary?

I used Wolfram understand it, but when I type $fada.cafe_{16}$, it changes to $fada.cafdfffffd..._{16}$. Why that?

-
This question and some of its answers will help to explain how to do it. – Old John Dec 11 '13 at 20:06

The numbers $\mathtt{fada.cafe}_{16}$ and $\mathtt{fada.cafdfffffd}..._{16}$ are very close to each other. In http://en.wikipedia.org/wiki/IEEE_floating_point you can see that IEEE double precision arithmetic is accurate to 52 binary digits. And the difference between the two numbers you wrote here is after the 13th HEX digit, that is, the 13*4=52nd BIN digit.

One possibility is that Wolfram converts them to base 10 when reading in the number, and then converts them to base 16 again, loosing a digit in the process. But that's speculation on my part.

-
So $\mathtt{fada.cafe}_{16}$ is $1111101011011010.1100101011111110_2$ ? – Richard Dec 11 '13 at 23:29
Yes it is. And if you write out the other number you will see it is almost the same: $\mathtt{1111101011011010.110010101111110111111111111111111101}_2$. – Stephen Montgomery-Smith Dec 11 '13 at 23:54
The difference is $\mathtt{0.000000000000000000000000000000000101}_2$ (recorded for posterity). – Stephen Montgomery-Smith Dec 16 '13 at 3:48

Hint: Each hexadecimal digit is represented in binary by four binary digits.

So you can replace the last $e$ with $1110$.

-