Converting .11111 to binary w/o converting to fraction

In summary, to convert a recurring decimal to binary, divide/mult by 2 to convert the integer/decimal part to binary, and loop until the decimal is repeating or the calculator overflows.
  • #1
catsarebad
72
0

Homework Statement


Imagine any recurring decimal in base 10, call it X.
examples:
.1111111111...
.2222222222...
.23232323...

my question is - can you convert it to binary without rewriting X in fractional form. I know how to do it in fractional form. I know how to convert it to fractional form as well.

However, I'm curious if one can proceed to solve this problem without converting to fractional form like a/b where a and b are integers.

Homework Equations


- divide/mult by 2 to convert integer/decimal part to binary

The Attempt at a Solution


The reason I ask this is because I know (and can) convert recurring decimals from binary to decimal. However, I'm not aware of any trick that does the other way around (w/o making use of fractions) and if there is one I would like to know how its done.

Thanks.
 
Physics news on Phys.org
  • #2
Hi catluvr. I'm not exactly sure what you seek, or why. But what is special about converting a recurring decimal? It won't generally be an exact equivalent, so I don't see any difference from converting any old decimal fraction into a binary fraction.

Anyway, this gives me the opportunity to pass on a technique I came up with :smile:
though I'm sure others have thought of it, too.

I'll take as an example 0.425718125(10) because I already know it has an exact binary form, I'm working backwards as a check. :approve:

You probably know about the method for converting a decimal integer into binary by repeatedly dividing by 2? Well, there's a similar technique for converting a decimal fraction into a binary fraction by repeatedly multiplying by 2, and taking note of the digit to the right of the decimal point.

EDIT I just noticed this is a homework question, so that means you are supposed to figure out the details for yourself. So I have deleted the example I provided below, to leave something you can figure out for yourself ...

< example redacted >

You can keep going until you run out of digits or your calculator overflows, then stop. :smile:
 
Last edited:
  • #3
I listed it as HW pretty much because I couldn't find anywhere else to put it. It isn't really a homework. It is just me being curious.

I do know how to convert integer to binary (divide by 2 and collect remainders). I also know how to convert fractional part (decimals) to binary (multiply by 2 and collect "1", and "0" in 0th place).

so to reiterate what i was saying:

I know how to convert 2/3 to binary (mult by 2 and collect "1" and "0" in 0th place)

however, the question is is there a way to convert 0.66666666666666666666666... (which is 2/3) to binary without converting it to fraction (2/3) first?

TL;DR want to convert 0.666666666666666666666... to binary without making use of the fact that it is 2/3
 
  • #4
Show me how you convert 0.66666666 to binary by a method you know.
 
  • #5
When you ask "can you convert it to binary without rewriting X in fractional form", I have to assume you have ways of representing that repeating decimal and ways of working with repeating decimals in general. So this is not normal C programming, were repeating decimals are simply truncated to a limited precision.

So here is what you do:
Let R be your repeating decimal.
Store the fractional part of R into R(0).
Let n be 0.
Loop:
-- Store 2*R(n) into R.
-- Store the fractional part of R into R(n+1).
-- Store the non fractional part of R (a 0 or 1) to B(n). This will be your output.
-- Let m be 0.
-- Loop:
-- -- If m is greater than n, break from this loop.
-- -- If R(m) equals R(n+1), then:
-- -- -- You are done.
-- -- -- You have a repeating binary value from B(m) to B(n).
-- -- -- Exit this procedure.
-- -- Else
-- -- Set m to m+1.
-- End of Loop.
-- Set n to n+1.
End of Loop.

The outer loop cannot exit. If there is a repeating decimal, there will be a repeating binary. If the decimal is not repeating, it will loop forever.
 
  • #6
Here's the [itex]0.\overline{6}[/itex] example:

[itex]R=0.\overline{6}[/itex]
[itex]R_{0}=R=0.\overline{6}[/itex]
[itex]n=0[/itex]
[itex]R=2\cdot R_{n} = 1.\overline{3}[/itex]
[itex]R_{n+1} =[/itex] Fractional part of [itex]R = 0.\overline{3}[/itex]
[itex]B_{n} =[/itex] Non Fractional part of [itex]R = 1[/itex]
Compare [itex]B_{0} to B_{1}[/itex] Not equal
[itex]n=n+1=1[/itex]
[itex]R=2\cdot R_{n} = 0.\overline{6}[/itex]
[itex]R_{n+1} =[/itex] Fractional part of [itex]R = 0.\overline{6}[/itex]
[itex]B_{n} =[/itex] Non Fractional part of [itex]R = 0[/itex]
Compare [itex]B_{0} to B_{2}[/itex] Equal, so we are done

Answer is in array B and values n and m:
[itex]B_{0} = 1[/itex]
[itex]B_{1} = 0[/itex]
[itex]m = 0[/itex]
[itex]n = 1[/itex]
So the overline will cross both digits of the binary value.
It will look like this: [itex]0.\overline{10}[/itex].
 
Last edited:
  • #7
NascentOxygen said:
Show me how you convert 0.66666666 to binary by a method you know.

0.666666666... = 2/3

2 * 2/3 = 4/3 = 1+1/3
2 * 1/3 = 2/3 = 0+2/3
2 * 2/3 = 1+ 1/3
repeat

hence 0.66666666... = 0.101010101010101010...

now show me how to convert 0.666666... to binary without converting it to fraction and thus making use of what i did above.

i'm also not looking for a script either.

i couldn't think of a way to do it hence why I'm curious if there is even a way.
 
  • #8
2*.6666666666666666666...
gives:
1.33333333333333333333...
the 1 becomes the first bit of the binary value which is .1xxxxxxx...--subtract the 1 and get:
.333333333333333333333...
Now 2*.33333333333333333...
gives:
0.666666666666666666666...
the zero becomes the next bit of the binary value which is now .10xxxxxx...
subtract the zero and get:
.666666666666666666666...
Now 2*.66666666666666666...
gives:
1.3333333333333333333333...
the 1 becomes the next bit of the binary value which is now .101xxxxxxx...

et cetera.
 
  • #9
i'm not sure why i over-thought this problem so much lol. the was staring at the solution the entire time.

thanks for doing that. cheers.
 
  • #10
how to convert 0.666666... to binary
Keep multiplying it by 2. If the digit to the right of the decimal point is 5 or greater write 1, otherwise write 0.

0.666666
1.333332
2.666664
5.333328
10.666656
21.333312
42.666624
85.333248

.10101010

You can keep this up until you calculator display overflows.
 
  • #11
My method is a bit more complete because is provides a way of recognizing when you are done and what portion of the binary fraction is repeated.
 

1. What is the process for converting .11111 to binary without converting to a fraction?

The process for converting .11111 to binary without converting to a fraction involves multiplying the decimal number by 2 and recording the whole number part of the result. Then, the decimal part of the result is again multiplied by 2 and the process is repeated until the decimal part becomes 0 or starts to repeat.

2. Can you provide an example of converting .11111 to binary?

Yes, for .11111, the process would look like this:

.11111 x 2 = .223 (whole number = 0)

.223 x 2 = .446 (whole number = 0)

.446 x 2 = .892 (whole number = 0)

.892 x 2 = 1.784 (whole number = 1)

.784 x 2 = 1.568 (whole number = 1)

Therefore, .11111 in binary is 0.0000111.

3. Why is it important to know how to convert .11111 to binary without converting to a fraction?

Knowing how to convert .11111 to binary without converting to a fraction is important because it allows for a better understanding of how binary numbers work and how they are used in computing and digital systems. It also helps in performing calculations and working with binary numbers in a more efficient manner.

4. Is there an easier way to convert .11111 to binary without converting to a fraction?

There is no simpler or easier way to convert .11111 to binary without converting to a fraction. The process of multiplying by 2 and recording the whole number part of the result is the most efficient and accurate method for converting decimal numbers to binary numbers.

5. Can .11111 be converted to a terminating binary number?

No, .11111 cannot be converted to a terminating binary number because it is a repeating decimal in binary form. This means that the binary representation of .11111 would go on infinitely, with the 1s and 0s repeating in a pattern.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
8
Views
5K
Replies
4
Views
941
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
901
  • General Math
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
20
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
10K
  • General Math
Replies
1
Views
1K
Back
Top