The standard numbering system used today is based on tens. We have ten digits, 0 - 9. But what if, for example, our digits only went up to four? 0, 1, 2, 3, 4. Then you would start over, using double digits: 10, 11, 12, 13, 14, 20, 21, 22, . . . 43, 44, 100, etc.
If we switched to this numbering system now, it would be quite confusing, since 100 in base-5 would equal our 25, in base-10. When working with numbers with different bases, it is a good idea to label which system a number is based on. Therefore, we use a subscript of the base-number after the value of the actual number.
Binary is just math in base-2. Since there are only 2 digits, 1 and 0, numbers can get quite long. How can you translate a long binary number without sitting there for hours counting your way up? Don't worry, there's a pattern!
Let's look at something we're familiar with, base-10. In base-10, we have place values:
|
thousands |
hundreds |
tens |
ones |
. |
tenths |
hundredths |
= |
Value |
|
|
|
|
0 |
. |
0 |
1 |
= |
10-2 |
|
|
|
|
0 |
. |
1 |
|
= |
10-1 |
|
|
|
|
1 |
. |
|
|
= |
100 |
|
|
|
1 |
0 |
. |
|
|
= |
101 |
|
|
1 |
0 |
0 |
. |
|
|
= |
102 |
|
1 |
0 |
0 |
0 |
. |
|
|
= |
103 |
Look at the values of each number on the chart. Each place value represents a power of ten. The number 6384.410 (remember we use the subscript to determine the base of the number) can be "tracked", or calculated as:
|
103 |
102 |
101 |
100 |
. |
10-1 |
|
6 |
3 |
8 |
4 |
. |
4 |
(6 * 103) + (3 * 102) + (8 * 101) + (4 * 100) + (4 * 10-1)
6000 + 300 + 80 + 4 + 0.4 = 6384.410
This pattern found in base-10 is also in any other numerically based system. So now, let's look at the binary number 11001012. Since we are in base-2, The place values will be in powers of two:
|
26 |
25 |
24 |
23 |
22 |
21 |
20 |
|
1 |
1 |
0 |
0 |
1 |
0 |
1 |
26 + 25 + 22 20 = 64 + 32 + 4 + 1 = 10110.
The most commonly used number systems are 2, 8, 10, and 16. In base-16, also called hexadecimal, we use letters to complete the digits: A = 10, B = 11, C = 12, D = 13, E = 14, and F = 15. A 16 is not needed, as that would be represented by 1016.
Numbers are easy to translate between base-2 and base-8. They are also easy to translate between base-2 and base-16. The number 7, the highest digit in base-8 can be represented by 1112. Each digit in base-8 can be represented by three digits in base-2. Look at another example:
|
|
|
|
Base-8 | ||||||||||||||||||
|
|
|
Base-2 |
It works the same way when changing from hexadecimal to binary:
|
|
|
|
Hexadecimal | ||||||||||||||||||||||||
|
|
|
Binary |
Why do we use binary code so often with computers? It's simple: it's simple! The fact that there are only two digits (0 and 1) works out well with the fact that electricity has only two states: on and off. So, if current is flowing, or on, the digit is considered a 1. If there is no current, meaning it's off (that one tiny portion of the memory, not the whole computer!), then the digit is considered a 0. This binary system of ones and zeros, or on and off, is the basis for the entire computer.