Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 2009-01-02 23:14:38

courteous
Member
Registered: 2008-09-21
Posts: 2

Base conversions

How do you convert, let's say 6.47 (base-10), into both binary and ternary system?

Offline

#2 2009-01-03 05:19:35

mathsyperson
Moderator
Registered: 2005-06-22
Posts: 4,900

Re: Base conversions

In base 10, you have thousands, hundreds, tens and units. But this continues after the decimal point and you have tenths, hundredths and so on.

Similarly, base 2 has eights, fours, twos, units, but then it continues with halves, quarters, etc.
To convert a number from base 10 to base 2, write it in terms of powers of two.

eg.
3.25 = 2 + 1 + 1/4, so 3.25 (base 10) = 11.01 (base 2)

One important point: in the same way that you can get endless decimals in base 10 (1/3 = 0.333...), you might get some endless decimals when converting between bases.

So for 6.47, you'd try to write it in powers of 2:

4
4+2 = 6
6+1/4 = 6.25
6.25 + 1/8 = 6.375
6.375 + 1/16 = 6.4375
6.4375 + 1/32 = 6.46875
...

You can get very close to what you're trying to convert, but it will take an infinite amount of fractions to actually get there, so the base 2 decimal form will have to be non-terminating.

I'd say your best plan is to round it. To five decimal places, 6.47 (base 10) = 110.01111 (base 2).


Base 3 conversion is very similar. Write the original number in terms of nines, threes, ones, thirds, ninths and so on, then write the base 3 form using that.

Last edited by mathsyperson (2009-01-03 10:08:10)


Why did the vector cross the road?
It wanted to be normal.

Offline

#3 2009-01-03 09:59:00

JaneFairfax
Member
Registered: 2007-02-23
Posts: 6,868

Re: Base conversions

mathsyperson wrote:

4
4+2 = 6
6+1/4 = 6.25
6.25 + 1/8 = 6.375
6.25 + 1/16 = 6.4375
6.25 + 1/32 = 6.46875
...

Aren’t you missing some terms? neutral

Offline

#4 2009-01-03 10:09:25

mathsyperson
Moderator
Registered: 2005-06-22
Posts: 4,900

Re: Base conversions

Aah, sorry. Edited now.
I knew what I was doing, I just didn't type it. tongue


Why did the vector cross the road?
It wanted to be normal.

Offline

#5 2009-01-03 10:41:17

JaneFairfax
Member
Registered: 2007-02-23
Posts: 6,868

Re: Base conversions

I was trying find a geometric series involving powers of
to express complicated rational numbers in base 2. Some are straightforward, e.g.

Unfortunately I couldn’t get

. I got

but I couldn’t do the division.

Offline

#6 2009-01-03 11:33:48

mathsyperson
Moderator
Registered: 2005-06-22
Posts: 4,900

Re: Base conversions

This way works:

So now we can convert fractions into base 2 if some multiple of their denominator is one less than a power of 2.

Edit: In fact, by also using Jane's method for 1/6, we can convert a fraction if it can be written as

I'm fairly sure all fractions can do this (based on the fact that they can if the 2's are replaced by 10's).


Why did the vector cross the road?
It wanted to be normal.

Offline

#7 2009-01-05 08:27:05

courteous
Member
Registered: 2008-09-21
Posts: 2

Re: Base conversions

JaneFairfax wrote:

This can't be legal multiplication?

Last edited by courteous (2009-01-05 08:28:27)

Offline

#8 2009-01-05 09:29:56

mathsyperson
Moderator
Registered: 2005-06-22
Posts: 4,900

Re: Base conversions

No, that bit's fine. You can see why if you think of it terms of the fractions:

0.1 x 0.010101...

0.0010101...


Why did the vector cross the road?
It wanted to be normal.

Offline

Board footer

Powered by FluxBB