# Converting decimal fractions to base N

I find converting from base N to base 10 very easy. I have no problem converting integers in base 10 to base N but when I have to find, for example, 0.5 base 3. I am not sure how I am supposed to do it. I can't do division with remainders any more.

How is this done?

## 4 Answers

Instead of using division with remainder as you do for integers, you can use multiplication for the decimal part:

$0.5 * 3 = 1.5$

Use the integer part as your first digit after the comma, and repeat with the decimal part:

$0.5 * 3 = 1.5$

You see that this will continue forever, so we have $0.5_{10} = 0.\overline{1}_3$.

Another example: $$0.4 * 3 = 1.2\\ 0.2*3 = 0.6\\ 0.6*3=1.8\\ 0.8*3=2.4\\ 0.4*3 = 1.2$$

And now we're repeating already, so $0.4_{10} = 0.\overline{1012}_3$

• This is a good method. Here's another example showing how it works for base 4: math.stackexchange.com/a/911718/139123 – David K Feb 22 '16 at 1:50
• This is exactly what I wanted, thank you. – SumMathGuy Feb 22 '16 at 8:38

The principle is the same as for integers. To convert $0.5$ in base $10$ to base $3$, we'll be running through (negative) powers of $3$ and successively subtracting them from the given number.

How many times can $\frac13$ fit into $0.5$? Once, so the first digit after the decimal point is $1$.

$0.1..._3$

Subtract $\frac13$ from $0.5$ to get $0.1666$. How many times can $\frac19$ fit into $0.1666$? Once, so the next digit is again $1$.

$0.11..._3$

Subtract $\frac19$ from $0.1666$ to get $0.0555$. How many times can $\frac1{27}$ fit into $0.0555$? Once, so the next digit is again $1$.

$0.111..._3$

Continue along this vein and you will see that $0.5$ in base $3$ is $0.\bar1_3$. This corresponds to the geometric series $\frac13 + \frac19 + \frac1{27} + \ldots = \frac12$.

• This seems to take a long time. With integers, I am doing the same thing but dividing by N and finding the quotient and remainder, the remainder becomes part of my answer and the quotient becomes the next step (until finished). So I am doing the same thing but it is easier psychologically. – SumMathGuy Feb 21 '16 at 14:32
• Sure, that comes down to the same thing (although I think you reversed the role of remainder and quotient). Either way, in the end, most non-integers are going to take infinitely long to convert... :) – Théophile Feb 21 '16 at 14:50
• No, I don't think so. E.g. if I were to convert 132 to base 4: 132/4 = 33 r 0 33/4 = 8 r 1 8/4 = 2 r 0 2/4 = 0 r 2. The answer is therefore 2010, right? I mean that is the right result so if not, that is tremendous luck. – SumMathGuy Feb 21 '16 at 15:00
• @SumMathGuy it's the same thing going on, you just go from smallest to largest power rather than largest to smallest. This happens to work because there are no negative powers in the number (i.e. it's an integer). For a number with no positive powers (a decimal between 0 and 1), you can do something similar, but multiply instead of divide: $0.5\times 3 = 1.5 = 0.5\text{ r } 1$, so $1$ is the first digit, and so on. As a bonus, it's really obvious this way that the decimal repeats. However, for a general non-integer number you have to do the integral and fractional parts separately. – David Z Feb 21 '16 at 23:04

To convert 23 (base 10) to base 3, what do you do?

You write down powers of 3: 27, 9, 3, 1, and see what's the largest one that's no bigger than 11. That's 9, so you divide, to get 2 with a remainder of 5, and write

2XX

Now the next power that's less than 4 is 3, so you divide (quotient 1, remainder 2) and you have

21X

Finally, there's 1: you divide, get 2 with remainder 0, and your answer is

212 (base 3)

What about converting a fraction?

You write down powers of 3: 1/3, 1/9, 1/27, etc.

Since 1/3 fits into 1/2, you get

.1XXXXX

with a remainder of 1/6. 1/9 is less than 1/6, so you get

.11XXX

with a remainder of 1/6 - 1/9 = 1/18

Now 1/27 is less then 1/18, so you get a 1 in the 1/27ths place, and you have

.111XX

and you continue in this manner (until you feel the approximation is good enough).

You can do several things. $\frac 12$ will not terminate in base $3$, but you can multiply it by some large power of $3$ and convert the whole part. So $\frac 12=\frac {40.5}{81}, 40_{10}=1111_3, \frac 12 \approx 0.1111_3$ You can note the repeat and say $\frac 12=0.\overline 1_3$ You can just do long division in base $3$ for fractions.

• Couldn't you convert it like 5/10 is (5 in base 3)/(10 in base 3) (or something similar)? – SumMathGuy Feb 21 '16 at 15:37
• If you are happy with a fraction, you can write $(1/2)_3$, for example. I thought you wanted a decimal, as $0.5$ is in that form. – Ross Millikan Feb 21 '16 at 15:57