# Number Systems

The Decimal, or base 10, system is taught in the early years of school and is second-nature to most people. A digit is a number from 0 through 9. When you write a number, you write it as as series of digits. Essentially, each digit occupies a column. Consider the number "19". The right column contains the digit "9", and the left column contains "1". The "9" is in the "one's column", and the "1" is in the "ten's column". Thus, the "1" really represents the number "10". "19" is merely 10+9. The rightmost column is the least significant digit, because it is always smaller than any column to the left. The leftmost column is the most significant digit, because it is the largest value.

The decimal system is called base 10 because there are ten possible digits (0-9). When 1 is added to 0, the result is 1. When 1 is added to 1, the result is 2, and so on. But when 1 is added to 9, there are no digits we can use that are larger than 9. Therefore, we "carry" the 1 over to the next column on the left, and set the current column to 0. This process is repeated for as many digits as are in the number. Thus 19+1 becomes 20. Any digits can be added together, up to 9+9. We still carry the 1, but the amount for the current column is the remainder: 8. Likewise, when subtracting, if the digit is 0, there is no digit less than 0, so we have to "borrow" from the next greater column. If 1 is subtracted, the digit changes from 0 to 9.

Math can be done with a numeric system in any base. For instance, Octal is base 8. This means that the only valid digits for octal are 0 through 7. The digits 8 and 9 mean nothing in octal. Just as "2F8" or "79T0" are not numbers in decimal, something like "800" is not a number in octal. When 1 is added to 7, in octal, we get 0 with a carry. And if we subtract 1 from 0, we get 7 with a borrow.

Base 2, also known as "binary", is a commonly used base. The Binary system is the simplest numeric system since there are only two digits: 0 and 1. These digits are referred to as bits (from "Binary digITs"). Adding 1 to 1 gives 0 with a carry. Subtracting 1 from 0 gives 1 with a borrow. In all bases, the least significant column is the "ones column". In Binary, the next column to the left is the "twos column", and the next is the "fours column". Just as each column to the left in decimal increases in value by 10 times, and each column to the left in octal increases in value by 8 times, each column to the left in binary increases in value by 2 times.

For bases larger than 10, letters are used as additional digits beyond 9. In the hexadecimal system (base 16) the valid digits (sometimes digits are called "hexits" in hexadecimal) are 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E, and F. For example, if 1 is added to 9, the result is "A". Adding 1 to A gives "B". And so on, up to F. Adding 1 to F gives us 0 with a carry.

Every value in any base has a equivalent value in another base, but the actual digits for the value will be different, in most cases, in each base. To illustrate, the following values are all the same.

Value | Base |
---|---|

F | 16 (hexadecimal) |

15 | 10 (decimal) |

17 | 8 (octal) |

120 | 3 (trinary) |

1111 | 2 (binary) |

# Converting a value to decimal

A value in a given base may be converted to its decimal equivalent value by summing the following equation for each column of the number:

V x B^{C}

where C=column (least significant is column 0), B=base, and V=value for column C.

For example, binary value 101 would be converted to decimal using the following equation:

1x2^{2} + 0x2^{1} + 1x2^{0}

which gives: 4 + 0 + 1 = 5