Friday, August 26, 2011

The World of 1s and 0s


There’s an old joke that goes like this:  There are 10 kinds of people in the world; those who understand binary and those who don’t.
Well, you don’t have to be one of the latter anymore, because today, I’ll show you how it works.

First up, the smallest unit in computer memory is a bit.  Eight bits make up one byte.  A thousand bytes make up a kilobyte.  And so on and so forth.

Every bit contains just one of two possibilities, a 1 or a 0.  On or off, if you will.  (You’ll notice that on power switches, the “on” side has a little line—this is actually a 1)

One byte, aka 8 bits, can be one of 255 possibilities.  Every bit in an 8-bit byte contains a yes/no answer for a different number.  Binary works in multiples of 2.  Every bit represents 2 to the power of a different number.  These numbers, from right to left, are 0 to 7.  Thus, the far right number represents 1 (aka 2 to the power of 0) and the far left represents 128 (aka 2 to the power of 7).

Say we have this binary number:  01001101.  To work out what number it is, you add all the bits’ values together.  In this case, 0 + 64 (2 to the power of 6) + 0 + 0 + 8 (2 to the power of 3) + 4 (2 to the power of 2) + 0 + 1 (2 to the power of 0) = 77.

Normally, when writing binary, you can leave out any leading zeros, since they do not alter the value.  The computer doesn’t do that, but humans often do, when writing them down.  Ergo, 10 would be 00000010, aka 2.

Congratulations, now you are part of the people who understand binary (hopefully).

3 comments:

  1. Computer Science classes back in high school tried to teach me that, and I never got it! Now I do! Thanks, Jake! :)

    P.S. Glad to hear the book made it!

    ReplyDelete
  2. Heh; Me - 1, high school - 0!

    (Unfortunately, binary isn't very useful for a martial arts instructor.)

    ReplyDelete
  3. Nah, but it's still fun to know!

    And thought you should know, the opening six sentences of ORACLE is up, just for you. :)

    ReplyDelete