The Binary System


Although it is one of the most important concepts in computer history I noticed I never wrote anything about it. Shockingly I might add. So here you have it, the binary system. As most of you already know this is a numeral system, basically just a way to write down numbers by using only 2 digits: 0 and 1.

This will ring a bell if you ever followed a computer class. You were probably told that computers work with binary code and that they work with a sort of on or off switch system. 0 being off 1 being on. Let’s take a look at the decimal system for a moment, which you are normally using (I suppose, unless you are some sort of a genius that enjoys counting in hexadecimal). Each digit holds 10 values and the place value increases by a power of ten (which basically means it goes from 1 to 10’s to 100’s, etc).

Binary works, of course, differently, each place digit holds a value of twice as much as the previous digit. The best way to show you, as usual is by an example. So let’s take a look at the values a byte can contain for instance. A byte contains 8 bits, each of these bits can be either 1 or 0. If the byte contains the (decimal) value 2 it will look like this:

0000 0010

Important to know is that the value of the bits increase from RIGHT to LEFT. Meaning that the 8th bit (as we would normally look at it) has the value 1 and the first bit has the value 128. A little confused? Don’t worry, you’ll get it soon enough.

The value table for a byte will look as follows:

128 64 32 16 8 4 2 1

Recap of what was said earlier, the lowest value is on the RIGHT and each place digit (the next digit) holds a value twice as high as the previous digit.

If you want a byte to have the value 3 it will look like this in binary (for your convenience I added the value mapping)

128 64 32 16   8  4   2  1
0    0    0    0   0   0   1  1

The value of each bit is added to get the total value of the byte. Which means that 1 byte can have a maximum value of 255. And if you ever played with IPv4 IP address this will probably also ring a bell ;-).

If the byte needs to have the value 123 then it looks like:

128 64 32 16   8  4   2  1
0    1    1    1   1   0   1  1

You get the point… :)

Oh there is 1 more thing you should know…

There are 10 sorts of people…
Those who can count in binary and those who can’t

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: