Number bases

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

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