6

As we all know, not all decimal numbers can be represented in binary (with a finite number of digits).

I'm wondering, can all (finite) binary numbers be represented using (a finite number of) decimal digits? I suspect so, since all "primitives" in binary ("0.5", "0.125", etc) can be represented with a finite number of decimal digits.

So, my question is the following: What characterizes a "compatible base-change"? I.e., what are the mathematical properties that hold for "Base 2 → Base 10" but does not hold for "Base 10 → Base 2"?

(Put formally: What properties must N and M have, in order to ensure that all finite Base-N numbers have a corresponding finite Base-M number?)

Community
  • 1
  • 1
aioobe
  • 413,195
  • 112
  • 811
  • 826

1 Answers1

14

If n is a binary fraction, then n = a / 2k for integers a and k.

That means that n = (a · 5k) / (2k · 5k) = (a · 5k) / 10k

So every binary fraction is a decimal fraction.

In the general case, every fraction to base N is also a fraction to base M if and only if N divides Mk for some k (or, equivalently, if every prime factor of N is also a prime factor of M). An argument similar to the one I gave above for 2 and 10 handles the "if" direction. For the "only if" direction, here's a sketch proof for you to fill in: suppose that 1 / N = a / Mk, then Mk = a · N, therefore N divides Mk.

So binary can be converted to decimal without loss because 2 is factor of 10, but decimal cannot be converted to binary without loss, because 5 is a factor of 10 but not a factor of 2.

Gareth Rees
  • 64,967
  • 9
  • 133
  • 163
  • I can't immediately see the relation between fractions and finite numbers. 1/3 for instance can't be represented using a finite number of decimal digits. – aioobe Jul 05 '11 at 13:13
  • It's just terminology: "binary fraction" means "a fraction with an exact representation in binary" and "decimal fraction" means "a fraction with an exact representation in decimal". – Gareth Rees Jul 05 '11 at 13:15
  • Aha, I read your answer again with this in mind and the answer makes a lot of sense. :-) – aioobe Jul 05 '11 at 13:18
  • 2
    Haha -- the sketch proof hides more details than I thought on first read-through. +1 for graceful glossing. – Chris Cunningham Jul 05 '11 at 19:41