# 3.8 How computers work with numbers

Today's mass media wrap computers in a damaging myth. The message of TV thrillers seems to be that computers are inscrutable, subtle devices, far beyond the ordinary person's comprehension. Only spectacularly gifted, young, ‘cool’ people seem to be capable of working with them successfully. For such individuals, a few clicks on the keyboard work miracles. The myth suggests that when we less gifted mortals use a computer and something goes wrong, it's our fault. We're simply too stupid for the machine. Figure 8 probably sums up many people's view of working with computers.

Of course, there is a tiny core of truth to this myth. The computer that sits on your desk is the result of 60 years of innovation and research. Its hardware – the electronic circuits that make it work – is a masterpiece of engineering skill. But in other ways, the media fiction turns the facts upside down. Far from being immensely complex machines, in many ways computers are very *simple*. Some of the problems in working with them come from poorly designed software. However, most difficulties arise *not* from our stupidity when faced with the computer's intricacy. They come from the difficulty of lowering our subtle human intelligences to the very basic level of the machine.

I've already stated that the computer's world is one of numbers. There are no sights and smells, no love and hate, no complex relationships, hopes and fears. Just numbers. But what kind of numbers? I have just looked at how *we* handle numbers. However, as you may already know, computers use a different system.

The inner world of the computer is impoverished in many ways, and when it comes to numbers this is spectacularly true. In contrast to our system of ten digits, a computer uses only *two* digits, 0 and 1. These correspond to tiny differences in voltage in the computer's electronic memory. Now let's use the ideas from the decimal and octal systems to consider how an arithmetic based on only two digits might work.

With only two digits to play with, simple counting doesn't get us very far. We can count from zero to one and then we've run out of digits. Clearly, we have to follow the strategy of the decimal system and create a new column. But we can't have a column to count groups of ten, as we do in base 10 arithmetic. We can only have the digits to count as far as one, so we will have to make our new column count groups of *two*. Therefore, in this new system the number

1

represents one, and the number

10

is not ten but *two*: one group of two plus zero. So the number

11

represents *three* in this new system: *one* group of two plus *one*. Now we've run out of columns and digits again, and we will have to make another column. Since we have got as far as three, the next column will have to count groups of *four*. So the number

100

represents *four*, one group of four, plus *no* groups of two plus *zero*.

## Exercise 4

What is the decimal number represented by the following numbers in the new system?

101

111

### Discussion

5 (

*one*group of four, plus*no*groups of two plus*one*).7 (

*one*group of four, plus*one*group of two plus*one*).

## Exercise 5

What decimal numbers will be represented by columns 4, 5 and 6 in the new system?

### Discussion

Column 4 represents a group of eight.

Column 5 represents a group of sixteen.

Column 6 represents a group of thirty-two.

Again you should be able to see a pattern. Each column counts groups that are two times bigger than groups counted in the column immediately to its right, as shown below.

Groups of 32 | Groups of 16 | Groups of 8 | Groups of 4 | Groups of 2 | Ones |
---|---|---|---|---|---|

2×2×2×2×2×1 (2^{5}) | 2×2×2×2×1 (2^{4}) | 2×2×2×1 (2^{3}) | 2×2×1 (2^{2}) | 2×1 (2^{1}) | 1s |

## Exercise 6

What is the decimal equivalent of the following numbers in the new system?

101001

11010001

100010110

### Discussion

41

209

278

Given that our own system of arithmetic based on the digits 0 to 9 is called a base 10 system, it follows that the system I've just been discussing is a **base 2** system, usually called the **binary system**, from the Latin *binarius* meaning ‘two by two’.

Obviously, it takes much more space to represent a number in a binary, rather than a decimal, system. This doesn't matter to a computer, though, since space is unimportant in its digital world. And cleverly designed software means that nowadays even computer scientists rarely have to work directly with binary numbers.