How to Build a Computer 10001: Binary

 

We’ve just come off a long saunter through the manufacturing process. We’ll go back soon enough I promise you, but I figured that we could stand a changeup. We’ll be visiting the wild and wonderful world of binary today. Despite what you may have been told there will be math.

The 10 Types of People in This World

The joke runs “… those who understand binary and those who don’t.” Binary is a system of numbers with a different base. “That’s great!” I can hear you say. “What’s a different base mean?” To answer that I’ve also got to explain a thing called “Positional Notation.” With that many syllables it’s got to mean something important, right?

Y’all remember how to do Roman Numerals, right? Rocky IV is the one where he fought Ivan Drago. In MCDXCII Columbus sailed the ocean blue. You can tell what the number means by adding up the value of each letter (with the exception of smaller letters directly before larger letters). It’s easy to learn addition because you never need to carry the one (just slap another X in your final number). It’s much harder to multiply (what’s XLII by VI? I dare you to try it without translating into modern notation). When Archimedes first calculated the value of Pi to 3.14 he was working in Roman Numerals, and not the least part of his accomplishment was extracting square roots that way.

To multiply Roman Numerals you make a little table. I’ve got no idea how you’d go about extracting a square root. Heck, I don’t know how you’d write decimals.

Roman Numerals are a way of writing numbers that don’t use positional notation. “Positional Notation” then refers to any system of numbers where you can tell how large a number is based on where the digits show up. Where a Roman might say MCCCXXXVII it’ll take you a minute to realize he means “one thousand, three hundreds, three tens, a five and two singles” which works out to 1337 in numbers we can understand. The modern notation takes less space to write and more importantly it makes arithmetic easier.

Binary is another system that uses positional notation, just with a different base. Our usual system of numbers is base ten. That is, once you get up to the number 10 you’ve got to switch to using two characters to represent it. Binary is base two. That means you get zero, one, and then you’ve got to start adding numbers. Quick example:

Jenny I’ve got your number! Jenny don’t change your mind!
Jenny I’ve got your number! 1000 110 111 101 11 0 1001!

Just not as catchy that way. But there are ways that binary is more useful than decimal notation. For example, it’s actually easier to add numbers in binary. There are only four rules to remember:

  1. 0+0=0
  2. 1+0=1
  3. 0+1=1
  4. 1+1=0, carry the 1

That’s not why we use it though. We use it because you can easily represent an electrical signal with just two options; on (one) and off (zero).

While I’m on the subject of the utility of non-decimal systems, let’s talk about imperial measurements quickly. It’s an impossible mish-mash of units and conversions, right? Twelve inches to the foot, three feet to the yard. Or the old British currency system; twelve pence to the shilling, twenty shillings to the pound. There’s actually good reason for that. A pound sterling can be divided evenly into a surprising number of fractions A sixth of a pound is three shillings four pence. A sixteenth is one shilling three pence. Makes life easier when you’re doing all the math by hand. But that has very little to do with computers. Let’s get back to numbering systems with

…Those Who Understand Hexadecimal…

There are a couple other number bases that come in handy. The main problem with humans and binary is that the long strings of digits get hard to read. Was that 0101100101 or 1010011010? It makes a difference. One other option is octal, that is, base eight. The other is Hexadecimal, or base sixteen.

Octal counts up to seven and then starts adding digits. Any digit in octal can be represented by three binary digits, or bits. You don’t see much octal around these days; it’s largely been supplanted by hex. I do run across it from time to time though; mainly when I’m changing file permissions on a Linux box.

Broadly speaking, you can do three things with a file. Read, write, and execute. Unless you’re on windows, in which case there’s a separate permission for delete, but we won’t get into that. That translates to three bits, which you can turn on or off independently. If you have a 1 in the read slot that translates to being able to read it. Combine all three permissions and you get eight possible options.

chmod this!

… and F the Rest

Hexadecimal is base sixteen. Now, you might think you’d run out of symbols after nine. You’d be wrong. They just start counting up the alphabet like a bunch of friggen anarchists. “Eight, Nine, A, B, C…” Am I the only one here who gives a bleep about the rules?

*Ahem*. Excuse me. The advantage of hexadecimal is that you can represent four binary bits in one character. Also to conceal your age. I’m twenty-one in hex. You don’t want to do the math? Fine. I was born in 2482 (octal), or MMDCCXXXVIII from the Founding of the City if that’s more to your liking.

In more practical uses, Hexadecimal codes are often used to represent colors. Let me pull up Microsoft Paint (the preferred graphic tool of all fine artists)

You see I’ve selected a lovely and extraordinarily masculine pink to illustrate my point.

Each pixel on your monitor has eight bits of red, green, and blue making it up. Eight bits is enough information to get you any number between zero and 255. Or 0 to FF, in hexadecimal. If you were to write that pink in the picture it’d be 111111110111100011001000. Kind of a lot to take in. If I were to write it in hex though it’s FF (the red portion) 78 for green and C8 for blue, or FF78C8 all together. I couldn’t look at that string and tell you that it’d produce a pinkish color but at least I can recognize six characters more easily than a string of twenty-four binary digits.

You can construct any color in that square of options by specifying a six digit hex string. To get a bright red you can use FF0000. Blue is 0000FF, and I’m sure you can work out green from there. 00FFFF is more of an aqua, as it’s blending blue and green. If you want all black you do 000000, all white is FFFFFF. Grays come on the scale whenever all three colors are balanced; 888888 gives you a medium dark gray.

Color mixing is probably where you’re most likely to find hex numbers. If you dig deep enough into the technical details of other systems they’ll pop out. This week has largely been a discussion of how the math works. Next week we’ll be getting into more practical bits about how you actually do things with these numbers in “Long Integers for Long Cats” or “Bigendians, Littlendians, or Why You Should Give Boiled Eggs the Miss and go for the Bacon.”

This is part one zero zero zero one of my ongoing series on How to Build a Computer, the Vegas Wedding way. You may find previous parts under the tag How to Build a Computer. This week’s post has been brought to you by Dime Aduzzin, the Ten Cent King. His automats and vending machines provide everything you need to live the good life with the maximum of modern convenience. Put one thin dime in the machine and get a pair of socks out. Where else can you get value like that except from the Ten Cent King?

[First – Silicon] [Previous – Strippers] [Next – Quantum Mechanics]

Published in Science & Technology
This post was promoted to the Main Feed by a Ricochet Editor at the recommendation of Ricochet members. Like this post? Want to comment? Join Ricochet’s community of conservatives and be part of the conversation. Join Ricochet for Free.

There are 36 comments.

Become a member to join the conversation. Or sign in if you're already a member.
  1. Judge Mental Member
    Judge Mental
    @JudgeMental

    Arahant (View Comment):

    OccupantCDN (View Comment):
    Found this great video the other day. A simple binary counter that demonstrates the progression of binary numbers:

    That is cool. I like how they flip the subsequent digits.

    You could do the same for base 10 with a ten sided wheel.  Same lever action would work, fixed to the nines.

    • #31
  2. Arahant Member
    Arahant
    @Arahant

    Judge Mental (View Comment):
    You could do the same for base 10 with a ten sided wheel. Same lever action would work, fixed to the nines.

    Let’s take it to base 36!

    • #32
  3. Randy Webster Inactive
    Randy Webster
    @RandyWebster

    Arahant (View Comment):
    That is cool. I like how they flip the subsequent digits.

    I don’t think you can say digits.  I think “digit” implies base 10.

    • #33
  4. Arahant Member
    Arahant
    @Arahant

    Randy Webster (View Comment):

    Arahant (View Comment):
    That is cool. I like how they flip the subsequent digits.

    I don’t think you can say digits. I think “digit” implies base 10.

    Bits, then.

    • #34
  5. Mark Wilson Inactive
    Mark Wilson
    @MarkWilson

    Arahant (View Comment):

    Randy Webster (View Comment):

    Arahant (View Comment):
    That is cool. I like how they flip the subsequent digits.

    I don’t think you can say digits. I think “digit” implies base 10.

    Bits, then.

    I thought “bit” is short for “binary digit”.

    • #35
  6. Misthiocracy, Joke Pending Member
    Misthiocracy, Joke Pending
    @Misthiocracy

    Arahant (View Comment):

    I do love your humor in the examples. Personally, I use base 36. That way I can say I’m 1I years old.

    Go full Mesopotamian and use base 60.

     

    • #36
Become a member to join the conversation. Or sign in if you're already a member.