Pages

The Binary Number system

Since so much about computers involves binary numbers, we thought we'd take a minute and explain exactly how binary numbers work.

First of all, and contrary to popular opinion, computers are dumber than doorknobs. All they are, are machines for crunching numbers, and in this case nothing more than two values, zeroes and ones. Each value is considered a bit, and eight bits makes up one byte. Computers make use of switches, much like the earliest transistors, to take these zeroes and ones, and send them down a particular path (or gate) depending ontheir value. Modern day computers contain millions of these switches, most located on the CPU, and their values (data) can travel across huge, multi-lane highways called busses. Most busses today are 32-bit, like a 32-lane highway, each lane containing continuous streams of data bits.

OK, so what does this have to do with the binary number system? Plenty, because binary numbers are perfectly suited for this type of data transmission since they themselves are comprised totally of only zeroes and ones. Binary as the name suggests is a numbering system based on powers of two (n2).

Here's a typical 8-bit Binary Value shown with it's respective Actual Numeric Values:

Binary Value = Actual Numeric Value

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

The 8-bit Binary value is shown as 10110101 and it's actual numeric value equals 181.

See how it was done? Look at it this way, in binary, a 0 represents "no" or "off" (the absence of a value) while a 1 represents "yes" or "on" (the presence of a value). Another description might be 0 = "false" and 1 = "true". You get the idea. For the example above, the numeric value was obtained by simple addition (128 + 32 + 16 + 4 + 1 = 181).

Binary values can be read right-to-left, starting with a value of 1, while each value to the left of that doubles sequentially. Using this system, you can create any number, limited only by the number of places you use, in this case eight.

If every value in the 8-bit binary example was a 0, the numeric value would be 0 as well. If every value in the 8-bit binary example was a 1, the numeric value would be 255. Counting 0, an 8-bit binary value gives you a total of 256 possible numeric values.

Here's another example using a 16-bit Binary Value:

Binary = Numeric

1 = 32768
0 = 16348
1 = 8192
1 = 4096
0 = 2048
1 = 1024
0 = 512
1 = 256
1 = 128
0 = 64
1 = 32
1 = 16
0 = 8
1 = 4
0 = 2
1 = 1

The 8-bit Binary value is shown as 1011010110110101 and it's actual numeric value equals 46517.

If every value in the 16-bit binary example was a 0, the numeric value would be 0 as well. If every value in the 16-bit binary example was a 1, the numeric value would be 65536. Counting 0, a 16-bit binary value gives you a total of 65537 possible numeric values.

Do some of these values sound familiar? They should, how about 32-bit, 64 Mbs of RAM, 256 colors, 512 Kb cache?

As you can see, using the binary method some very large numbers can be handled very quickly by the CPU using only two digits, and those numbers increase exponentially every time another place is added.

No comments:

Post a Comment