Binary to decimal.

Homework Statement

Not so much a problem as a general wondering. I know how to convert from decimal to binary and binary to decimal apart from when there's a recurring pattern involved. One which I really can't figure out it 0.1001 (repeating). How do you go about converting that to decimal?

None really.

The Attempt at a Solution

I really don't have any attempt as I can't find much about it on the internet. It features in a worked example in our notes and it's never explained. The answer is 0.6 apparently. (Not sure if this would be considered a computing problem or a mathematical one)

Mark44
Mentor

Homework Statement

Not so much a problem as a general wondering. I know how to convert from decimal to binary and binary to decimal apart from when there's a recurring pattern involved. One which I really can't figure out it 0.1001 (repeating). How do you go about converting that to decimal?

None really.

The Attempt at a Solution

I really don't have any attempt as I can't find much about it on the internet. It features in a worked example in our notes and it's never explained. The answer is 0.6 apparently. (Not sure if this would be considered a computing problem or a mathematical one)

The trick here is similar to what you do to convert a repeating decimal fraction to a rational number. For example, if you need to convert .35353535... to a fraction, you multiply by a power of 10 large enough to move the part that repeats to the other side of the decimal point, which in this case would be 102. If we write x = .353535..., then 100x = 35.353535...

Subtracting the equation with x from the equation with 100x, we get
99x = 35 ==> x = 35/99

For your binary fraction, write an equation x = .10011001...2. Get a new equation that you can subtract this one from by multiplying by 24 (or 16).

1 person
Won't you then end up with 15x = 1001, and that equals 66.733... and not 3/5 as it says in my notes. Is there a mistake in the notes or am I misunderstanding you?

Mark44
Mentor
No, you won't. In my work I was careful to note that the fraction was in base-2 (something you neglected to do). You should have gotten 15x = 10012.

This is a bit ungainly, having a decimal number on one side, and a binary number on the other, but at least it's marked to indicate that different bases are being used.

1 person
Got it! Thanks a million.