Number Bases
© 1 Nov 2012 Luther Tychonievich
Licensed under Creative Commons: CC BY-NC-ND 3.0
other posts

math

The structure beneath Arabic numerals.

 

Thanks to the success of Arabic numerals and decimal notation, we are all familiar with numbers like 42 and 3.14159…. Due to the popularity of computer circuitry, we’ve all heard about binary and that it is 0s and 1s. I hope to share a bit about how these are related and about the other elements of this field.

Consider a number like 534.12 (in decimal). This notiation means 5×102 + 3×101 + 4×100 + 1×10–1 + 2×10–2. Note that the “‍10‍” here is totally arbitrary and is called the base of the number system. In base 8 (often called “‍octal‍”) the same numerals would mean 5×82 + 3×81 + 4×80 + 1×8–1 + 2×8–2, which is the same number as 348.15625 in decimal.

It is also true, though not obvious, that numbers are not unique in any given base. In decimal, for example,
1
3
= 0.33333… so 3×
1
3
= 0.9999…; but 3×
1
3
is also
3
3
= 1.0. It becomes more obvious if we allow for additional numerals, such as letting “‍a‍” represent ten, “‍b‍” eleven, and so on. Then 1b1 = 1×102 + 11×101 + 1×100 = 2×102 + 1×101 + 1×100 = 211.

It is also true that if a base is a power of another base it can be seen as groupings of digits. We do this already with things like 2,456,233 which can be thought of as a base-1000 number 2×10002 + 456×10001 + 233×10000. Similarly, the binary number 1001010111101010101001 can be grouped like 10,0101,0111,1010,1010,1001 and each group written in base 16 to get 257aa9.

Two bases are particularly bad. These are base 1, which is just tick-marks, and base 0, which can only represent the number 0. But other than that any number goes, even fractions. For example, in base 9.5 the number 42 represents 4×9.51 + 2×9.50, wich is just fourty.

A particular oddity comes from bases between 0 and 1, which just reverse the represenation in bases larger than 1. The base 0.1 reveals this well: 534.12 in base 0.1 is 214.35 = 2×0.12 + 1×0.11 + 4×0.10 + 3×0.1–1 + 4×0.1–2. Thus, in base 0.1 the result of 1 ÷ 3 is …33330

Negative bases are possible too, via the same logic. For example, in base -10 the number 214.35 = 2×(–10)2 + 1×(–10)1 + 4×(–10)0 + 3×(–10)–1 + 4×(–10)–2 = 193.94. With negative bases there’s no need for a sign (+ or –) because that is encoded in the number of digits the number has. Odd-numbered digits are positive while even-numbered digits are negative so 5134 is a negative number (–4926) because its leading digit is in an even place.

Finally, I offer a little javascript base converter. I didn’t make it handle negative bases, but the rest it should do fine.

base:
value:



Looking for comments…



Loading user comment form…