Alternative Radices: Positional Notation

Increasing (and decreasing) the radix exponent as we move left (and right).

Example scenario

Imagine a culture influenced by the Hindu-Arabic base-10 system (in particular, we’ll be using Arabic numerals for convenience), but with a counting system based on units of 5 (“hands”). In our hypothetical culture, we might count “1”, “2”, “3”, “4”—and then “1 hand”. We could continue from there: “1 hand and 1”, “1 hand and 2”, and so on. Eventually, we get to “4 hands and 4”; then where do we go?

Some creative person might next say “1 hand of hands”, to represent the quantity that today we would write as 25. We could then continue: “1 hand of hands and 1”, “1 hand of hands and 2”, “1 hand of hands and 3”, “1 hand of hands and 4”—and then, “1 hand of hands and 1 hand”, “1 hand of hands and 1 hand and 1”, and so on.

Apart from the awkwardness of all those “and”s, our imaginary culture actually has a form of positional notation:

hands of hands hands ones base-10 representation
    1 1
    2 2
    3 3
    4 4
  1 0 5
  1 1 6
  1 2 7
  1 3 8
  1 4 9
  2 0 10
 
  4 4 24
1 0 0 25
1 0 1 26
1 4 4 49
2 0 0 50
4 4 4 124

You’ve probably noticed that in the table above, the “hands” column shows multiples of 5, from 0 to 4, while the “hands of hands” column shows multiples of 25.

Definition

When expressing an integer in positional notation with the radix $b$, the right-most digit is the coefficient of $b^0$. Raising any number (such as $b$) to the 0th power gives a value of 1, so we often call this the “ones digit”. The next digit to the left is the coefficient of $b^1$, the next is the coefficient of $b^2$, and so on.

Examples

Base-10

The base-10 number 729 can be thought of as

\[\begin{aligned} 729 &= 9 \cdot 10^0 + 2 \cdot 10^1 + 7 \cdot 10^2 \\ &= 9 \cdot 1 + 2 \cdot 10 + 7 \cdot 100 \\ &= 9 + 20 + 700 \\ &= 729 \end{aligned}\]

Base-16

When using a different number base, all that really changes is the radix $b$. Of course, since we’re used to a base-10 system, with the digits 0–9, we have to include some new digit symbols if we use a base higher than 10. In hexadecimal (base-16), we use the letters A–F to represent the base-10 values 10–15, in that order.

Let’s take the value $\text{2D9}_{16}$—or, in the form recognized by the Java compiler, 0x2D9—as an example (note that $\text{D}_{16} = 13_{10}$):

\[\begin{aligned} \text{2D9}_{16} &= 9 \cdot 16^0 + 13 \cdot 16^1 + 2 \cdot 16^2 \\ &= 9 \cdot 1 + 13 \cdot 16 + 2 \cdot 256 \\ &= 9 + 208 + 512 \\ &= 729 \end{aligned}\]

Base-2

The very simplicity of binary, or base-2, can make it more confusing: how can we convey much information with just the digits 0 and 1, even with many binary digits (bits)? But let’s try it with the value $101101101_2$ (in Java, we’d write this as the literal 0b1011011001):

\[\begin{aligned} 1011011001_2 &= 1 \cdot 2^0 + 1 \cdot 2^3 + 1 \cdot 2^4 + 1 \cdot 2^6 + 1 \cdot 2^7 + 1 \cdot 2 ^ 9 \\ &= 1 + 8 + 16 + 64 + 128 + 512 \\ &= 729 \end{aligned}\]

Of course, it doesn’t matter in what order we do any of the additions in the examples above; the important part is that the exponent in each term corresponds to the digit position, with the right-most position having an exponent of 0, and each successive position increasing by 1 in the exponent. So far, we’ve listed the terms to be added in right-to-left order (i.e. with increasing exponents); below, we’ll mostly use left-to-right.

Non-integral values

We can extend positional notation to non-integer values by using a separator character (e.g. a period), with digits to the right of the separator representing coefficients of the radix raised to negative exponents, where $a^{-b} = \frac{1}{a^b}$, when $a \neq 0$.

In fact, this is exactly what we do already when we write base-10 numbers with values after the decimal point. For example:

\[\begin{aligned} 1.75 &= 1 \cdot 10^0 + 7 \cdot 10^{-1} + 5 \cdot 10^{-2} \\ &= 1 \cdot 1 + 7 \cdot \frac{1}{10^1} + 5 \cdot \frac{1}{10^2} \\ &= 1 + 7 \cdot \frac{1}{10} + 5 \cdot \frac{1}{100} \\ &= 1 + 7 \cdot 0.1 + 5 \cdot 0.01 \\ &= 1 + 0.7 + 0.05 \end{aligned}\]

Let’s try a base-2 example:

\[\begin{aligned} 1.11_2 &= 1 \cdot 2^0 + 1 \cdot 2^{-1} + 1 \cdot 2^{-2} \\ &= 2^0 + \frac{1}{2^1} + \frac{1}{2^2} \\ &= 1 + \frac{1}{2} + \frac{1}{4} \\ \end{aligned}\]

Now, let’s express those last fractions in base 10:

\[\begin{aligned} \hphantom{1.11_2} &= 1 + 0.5 + 0.25 \\ &= 1.75 \end{aligned}\]

Clearly, $1.11_2 = 1.75_{10}$.

In fact, the internal representations of the float and double types used by Java (and many other programming languages) incorporate a base-2 fractional value (the mantissa) like the one in this example, along with an exponent (the number of digit positions that the fractional value should be shifted, right or left), and a sign bit.