13
Chapter 2:
Laying the Foundation
you like. You can have a base-3 numbering system, a base-11 numbering system, and
so on. Humans have come to favor the base-10 system, probably because we have ten
fingers and thus tend to think in tens. Computers, on the other hand, have only two
digits with which they can work--1 and 0--so they need to use a different numbering
system. The natural numbering system for a computer to use would therefore be the
base-2 numbering system, and, in fact, that's what they do use. This system is called
the binary numbering system. Computers use only 1s and 0s at their most basic level
because they understand only two states: on and off. In the binary numbering system, a
1 represents on, and a 0 represents off.
Recall that in the decimal numbering system, the position of each number is
important. It is the same in the binary numbering system, except that each position
doesn't correspond to powers of 10, but instead to powers of 2. Here are the values of
the lowest eight positions used in the binary numbering system:
128
64
32
16
8
4
2
1
So, suppose that you encounter the following binary number:
1
0
1
0
1
1
0
1
You would follow the same steps that you use to understand a decimal numbering
system number. In this example, the binary number represents 128 + 32 + 8 + 4 + 1, or
173 in the decimal system. You can also write (or calculate) this number as follows:
(128 × 1) + (64 × 0) + (32 × 1) + (16 × 0) + (8 × 1) + (4 × 1) + (2 × 0) + (1 × 1)
So, two main things separate the decimal numbering system from the binary
numbering system:
The binary system uses only 1s and 0s to represent every value.
The value of numerals in the different positions varies.
You might be wondering how you can tell whether you're reading a binary number
or a decimal number. For instance, if you're reading a book about computers and you see
the number 10101, how do you know whether it's supposed to represent ten thousand
one hundred and one or twenty-one? There are several ways that you can tell:
Usually, binary numbers are shown with at least eight positions (a full byte),
even if the leading digits are 0s.
If you're looking at a bunch of numbers and see only 1s and 0s, it's a pretty
good bet that they are binary numbers.
Binary numbers don't use the decimal point to represent fractional values, so
10100.01 should be assumed to be a decimal system number.