Saturday, 25 February 2012

All the Ones

We were driving into Guardamar yesterday and had taken some paper and cardboard with us to put into the appropriate container on the way (you do sort your rubbish, don't you?). There are containers for different types of rubbish just near the exit of El Raso, so I parked the car next to them. As I was switching off the ignition, I noticed the kilometre counter.

A bingo caller would have shouted, "All the ones, onety-onety-onety-one," or words to that effect. However, I understand that there are only 10 types of people in the world: those who understand binary and those who don't.

Well, you might not understand the binary numbering system, but you use it in some way every day, I'll bet. Just about everything is digitised nowadays, from the mobile phone (oh bane of my life), the lowly weather station, the kitchen scales (assuming their not a decent set of analogue ones), the mp3 player, the iPad, iPod, iWhatever, to the now common-or-garden home desktop computer, and even the CERN supercollider.

Yup, they're all based on just two numbers, zero and one.

All computer technology relies on what are basically no more than switches that can have one of two states: on and off, or, one and zero (and sometimes even "yes" and "no"). And with these two digits, any other number can be formed. Okay, you're used to using ten digits to form numbers, 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. This is the decimal system, but there are other numbering systems out there, the best-known being octal, hexadecimal, and binary.

So, how does binary work? Simple!

First, a quick look at our normal decimal system to understand how we count. We start at 0, meaning nothing, then we go 1,2,3… up to 9, but when we want to go further, we have no free digits, so we say something like, "Right, I now have one lot of ten, so I'll put down a 1, and nothing else, so I'll put down a 0," giving us 10. We then continue up to our next change from 9 to the next number and have to say, "Now I have 2 lots of ten and nothing else,"which gives us 20.

And when we run out of digits for the "tens position" all we have to do is start a new position for the hundreds and so on.

Binary works just like that, but new positions have to be created much more frequently, every time the count reaches 2, in fact. So we go 0, 1… er end of available digits, so 10, 11… er end of available digits, so 100, 101, 110, 111… er end of available digits… and so on.

Now, if we look at a decimal number, say 563, then it can be broken down as follows:

3 = 10 to the power 0 (which is 1) x 3, giving 3
6 = 10 to the power 1 (which is 10) x 6, giving 60
5 = 10 to the power 2 (which is 100) x 5, giving 500

Add them up and you get the full number. In fact, the position of the digit, counting from right to left, indicates the "power" of the "base number" of the system. The base number of the decimal system is ten. This is how all number systems work.

Applying this to the binary system (whose base number is 2), then the decimal equivalent of 101 binary is:

1 = 2 to the power 0 (which is 1) x 1, giving 1
0 = 2 to the power 1 (which is 2) x 0, giving 0
1 = 2 to the power 2 (which is 4) x 1, giving 4

Add them up and you get 5. So binary 101 is the same as decimal 5.

What about binary 111111?


1 = 2 to the power 0 (which is 1) x 1, giving 1
1 = 2 to the power 1 (which is 2) x 1, giving 2
1 = 2 to the power 2 (which is 4) x 1, giving 4
1 = 2 to the power 3 (which is 8) x 1, giving 8
1 = 2 to the power 4 (which is 16) x 1, giving 16
1 = 2 to the power 5 (which is 32) x 1, giving 32

Add them up and you get decimal 63.

(Sadly my car counts in decimal, not binary, so I must accept that it has been driven 111,111 kilometres and not just 63.)

To explain exactly how these ones and zeroes become transformed, not just into decimal numbers, but also into letters, symbols, colours, sound, and everything else digital, would take a whole book, even though it is really quite simple. Believe me, it might look impressive, but its all just ones and zeroes.

No comments:

Post a Comment