Converting .11111 to binary w/o converting to fraction

  • Thread starter Thread starter catsarebad
  • Start date Start date
  • Tags Tags
    Binary Fraction
Click For Summary

Discussion Overview

The discussion revolves around the conversion of recurring decimal numbers in base 10 to binary representation without first converting them into fractional form. Participants explore various methods and techniques for achieving this, focusing on both theoretical and practical aspects of the conversion process.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Homework-related

Main Points Raised

  • One participant expresses curiosity about converting recurring decimals directly to binary without using fractional representation, noting their familiarity with existing methods for conversion.
  • Another participant questions the necessity of focusing on recurring decimals, suggesting that converting any decimal fraction to binary follows similar principles.
  • A participant describes a technique involving repeated multiplication by 2 to convert decimal fractions to binary fractions, emphasizing the importance of tracking the fractional part.
  • One participant provides a detailed algorithmic approach to handling repeating decimals, outlining a loop structure to identify when a binary representation begins to repeat.
  • Another participant illustrates the conversion of 0.666666... to binary using a step-by-step multiplication method, while also seeking an alternative approach that avoids recognizing the decimal as a fraction.
  • Some participants share their own methods and examples, demonstrating the conversion process while acknowledging the challenges of working with repeating decimals.
  • One participant reflects on their initial overthinking of the problem after realizing the simplicity of the solution presented by others.

Areas of Agreement / Disagreement

Participants generally agree on the methods for converting decimals to binary but express differing views on the necessity and implications of focusing specifically on recurring decimals. The discussion remains unresolved regarding whether a method exists that avoids fractional representation entirely.

Contextual Notes

Some methods discussed rely on specific assumptions about the nature of repeating decimals and their binary equivalents. The conversation also highlights the limitations of calculator precision in performing these conversions.

catsarebad
Messages
69
Reaction score
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
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:
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
 
Show me how you convert 0.66666666 to binary by a method you know.
 
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.
 
Here's the 0.\overline{6} example:

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

Answer is in array B and values n and m:
B_{0} = 1
B_{1} = 0
m = 0
n = 1
So the overline will cross both digits of the binary value.
It will look like this: 0.\overline{10}.
 
Last edited:
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.
 
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.
 
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.
 

Similar threads

  • · Replies 8 ·
Replies
8
Views
5K
  • · Replies 2 ·
Replies
2
Views
3K
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
11K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 20 ·
Replies
20
Views
3K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 4 ·
Replies
4
Views
4K