home

Number bases

number base of a numeral system defines the symbols and notations used to represent a value.

For example, base 2 provides two distinct symbols that are then combined to represent larger quantities.

Convert to decimal

Given some numeric representation with digits \(a_{n}\ a_{n-1}\ a_{n-2} \ldots a_0\) in base \(b\), the decimal conversion can be found via \[ a_{n} \times b^{n} + a_{n-1} \times b^{n-1} + \ldots + a_{0} \times b^0 \]

This may also be extended to cover non-integers with a negative exponent for the fractional digits. \[ \left( a_{n}\ a_{n-1} \ldots a_{0}\ .\ a_{-1}\ a_{-2} \ldots a_{-m}\right)_{b} = \sum_{i=-m}^{n} a_{i} \times b^i \]

For example, \(16.4_{16}\) is equivalently expressed as \(1 \times 16^{1} + 6 \times 16^{0} + 4 \times 16^{-1}\) or \(22.25_{10}\).

Convert from decimal

To convert a decimal value to an alternate base, \(b\), repeatedly divide by \(b\) and build the value right-to-left with the remainder until the quotient is \(0\).

For example, to express \(52\) in base 2: \[ \begin{align*} 52 \div 2 &= 26R0 \rightarrow & 0_{2} \\ 26 \div 2 &= 13R0 \rightarrow & 00_{2} \\ 13 \div 2 &= 6R1 \rightarrow & 100_{2} \\ 6 \div 2 &= 3R0 \rightarrow & 0100_{2} \\ 3 \div 2 &= 1R1 \rightarrow & 10100_{2} \\ 1 \div 2 &= 0R1 \rightarrow & 110100_{2} \end{align*} \]

Repeated division by base for integer component. Repeated multiply by base for fractional component.

Conversion from binary to \(2^n\)

Segment into groupings of size \(n\).

\[ \begin{array}{llllllll} & & & 1 & 1 & 1 & 1 & 1_{2} \\ \times & & & & & & 1 & 1_{2} \\ \hline \\ & & & 1 & 1 & 1 & 1 & 1 \\ + & & 1 & 1 & 1 & 1 & 1 & 0 \\ \hline & 1 & 0 & 1 & 1 & 1 & 0 & 1_{2} \\ \end{array} \]

Historic notation

Additive systems - Bakairi - Attic numerals

vs positional