Conversion of Fractions in Various Bases

The decimal system was introduced into Europe in 1202 by Leonardo Fibonacci of Pisa in his Liber Abaci. But this was only true of representation of integers. The decimal representation of fractions did not actually take off until 1585 when the Flemish Simon Stevin published his pamphlet De Thiende simultaneously with its French translation La Disme. Fibonacci himself used base 60 (invented yet by ancient Babylonians) to express fractions (something like 10°13'45''... - certainly reminiscent of the degrees/minutes/seconds notations still in use today.)

As we know, an integer M in base N > 0 is represented as

(1) A = akNk + ak-1Nk-1 + ... + a1N1 + a0.

To include fractions, we, as is customary in the decimal system, allow for negative powers:

(2) a = akNk + ak-1Nk-1 + ... + a1N1 + a0 + a-1N-1 + ... + a-mN-m + ...

By analogy with the decimal system, (2) is shortened to

(3) a = (akak-1...a1a0.a-1a-2...)N,

where all coefficients am satisfy 0≤am<N. The dot between a0 and a-1 (or the integer and fractional parts) is variably known as radix point or N-ary point (binary, ternary, decimal, etc., depending on the radix used.) Separate procedures apply to conversion of the integer (the one to the left from the radix point) and the fractional (which is to the right from the radix point) parts. Here I'll discuss the latter procedure. In the way of example, 1/4 was claimed to equal (.020202...)3 which qualified it as a member of the Cantor set C0. Let's verify this fact.

Thus we are looking for a representation

0.25 = a-13-1 + a-23-2 + a-33-3 + ...

with am either 0,1, or 2. Multiply the identity by 3:

0.75 = a-1 + a-23-1 + a-33-2 + ...

and note that on the left we still have a pure fraction while on the right a-1 is an integer. Two sides may only be equal when a-1 = 0. So we actually have

0.75 = a-23-1 + a-33-2 + ...

Again multiply by 3:

2.25 = a-2 + a-33-1 + ...

If two numbers are equal, their integer and fractional parts should respectively coincide. Thus we have 2 = a-2 and

0.25 = a-33-1 + a-43-2 + ...

The algorithm is simple: keep multiplying by 3 (or radix N in the general case), removing thus obtained integer parts and writing them sequentially. Obviously, in the case of 1/4 and N = 3, we are going to have a periodic fraction 1/4 = (0.020202...)3 with a-3 = 0 and a-4 = 2, and so on.

We can verify the expression for 1/4 through the formula for the sum of a geometric series. For 0 < |q| < 1,

(4) a0 + a0q-1 + a0q-2 + ... = a0/(1 - q)

Indeed,

(0.020202...)3 = 2·3-2 + 2·3-4 + 2·3-6 + ... = 2·9-1 + 2·9-2 + ... = 2·9-1/(1 - 1/9)

which finally gives 1/4. Here is another example: let's represent 1/2 in base 5. 0.5·5 = 2.5. Therefore, a-1 = 2 and the remaining fractional part is still the same .5. Therefore, 1/2 = (0.22222...)5 which again could be verified by the summation formula (4): (0.22222...)5 = (2/5)/(1 - 1/5). Also, (0.002002002...)3 = (2/27)/(1 - 1/27) = 1/13.

You may now verify that

π = (3.1415926535 ...)10
 = (11.00100100001111 ...)2
 = (10.0102110 ...)3
 = (3.066365 ...)7
 = (3.124188 ...)9
 = (3.243F6 ...)16


Related material
Read more...

  • Expansion of Integers in an Integer Base
  • Base (Binary, Decimal, etc.) Converter
  • Base Converter
  • Implementation of Base Conversion Algorithms
  • Scoring: the simplest of the impartial games
  • History of the Binary System
  • Calculation of the Digits of pi by the Spigot Algorithm of Rabinowitz and Wagon
  • Addition and Multiplication Tables in Various Bases
  • |Contact| |Front page| |Contents| |Algebra|

    Copyright © 1996-2018 Alexander Bogomolny

    71472183