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. Randy Webster Inactive
    Randy Webster
    @RandyWebster

    I can’t imagine how the Romans did their engineering using Roman numerals.

    • #1
  2. dnewlander Inactive
    dnewlander
    @dnewlander

    Randy Webster (View Comment):

    I can’t imagine how the Romans did their engineering using Roman numerals.

    Very carefully.

    • #2
  3. Arahant Member
    Arahant
    @Arahant

    Hank Rhody, Red Hunter: 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.

    I don’t think so.

    • #3
  4. Arahant Member
    Arahant
    @Arahant

    Same concept, though.

    • #4
  5. Arahant Member
    Arahant
    @Arahant

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

    • #5
  6. Judge Mental Member
    Judge Mental
    @JudgeMental

    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.

    I used base 36 in a program once.  Cramming numbers into the smallest area possible.  In the olden days, every byte counted.

    • #6
  7. DonG Coolidge
    DonG
    @DonG

    did we jump from transistors to binary?  what about gates and latches??  the transition from analog to values to binary values is a key step.

    • #7
  8. Wade Moore Member
    Wade Moore
    @WadeMoore

    Randy Webster (View Comment):

    I can’t imagine how the Romans did their engineering using Roman numerals.

    They didn’t.  They used mainly rules of thumb.  The hardest calc they did was a proportion to scale up an existing structure to a larger size.  Sometimes the structure was over designed and stood for centuries and other times it was not and disappeared from the record.   

    • #8
  9. Sam Rhody Member
    Sam Rhody
    @SamRhody

    You should have saved this post for next month to celebrate OCT-ober.

    • #9
  10. Gary McVey Contributor
    Gary McVey
    @GaryMcVey

    “Jenny I’ve got your number! 1000 110 111 101 11 0 1001!”

    Sheer Rhody brilliance.

    • #10
  11. Randy Webster Inactive
    Randy Webster
    @RandyWebster

    Gary McVey (View Comment):

    “Jenny I’ve got your number! 1000 110 111 101 11 0 1001!”

    Sheer Rhody brilliance.

    The conversion from hex to decimal is a lot easier than the conversion from binary to decimal.

    • #11
  12. Hank Rhody, Red Hunter Contributor
    Hank Rhody, Red Hunter
    @HankRhody

    Arahant (View Comment):

    Hank Rhody, Red Hunter: 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.

    I don’t think so.

    For all that that history professor was wrong about other things I assumed she knew her area of expertise. I feel foolish in retrospect.

    • #12
  13. Hank Rhody, Red Hunter Contributor
    Hank Rhody, Red Hunter
    @HankRhody

    Judge Mental (View Comment):

    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.

    I used base 36 in a program once. Cramming numbers into the smallest area possible. In the olden days, every byte counted.

    I’ve dealt in base 36 too; the way the company writes serial numbers at work it’s 0-9 and then A-Z. One panel might be T2003JANE00. 3JANE would be the unique identifier, T200 and the 00 at the end convey other information.

    • #13
  14. Belt Inactive
    Belt
    @Belt

    If you really, really dig binary you can count up to 1,023 on your fingers.

    • #14
  15. Hank Rhody, Red Hunter Contributor
    Hank Rhody, Red Hunter
    @HankRhody

    Belt (View Comment):

    If you really, really dig binary you can count up to 1,023 on your fingers.

    I did that once. In a long and boring catholic wedding. Had my hands hanging behind my back, over the top of the pew. Accidentally flipped over the (what’s the name for it?) the kneeling cushion. BANG!

    • #15
  16. Gary McVey Contributor
    Gary McVey
    @GaryMcVey

    Damn Prots, always stirring up a commotion ;-)

    Your hands are supposed to be operating rosary beads  as a background operation, a reasonably Hank-esque way of coding a long string of executable prayer instructions in firmware.

    When I was a kid, some scary-looking old Italian ladies had hundred-decade strings of beads, a form of virtue signaling that probably goes back to the Middle Ages. I guess they’d count as Mainframe Catholics. 

    • #16
  17. Basil Fawlty Member
    Basil Fawlty
    @BasilFawlty

    Hank Rhody, Red Hunter (View Comment):

    Belt (View Comment):

    If you really, really dig binary you can count up to 1,023 on your fingers.

    I did that once. In a long and boring catholic wedding. Had my hands hanging behind my back, over the top of the pew. Accidentally flipped over the (what’s the name for it?) the kneeling cushion. BANG!

    A diagram would be helpful here.

    • #17
  18. Percival Thatcher
    Percival
    @Percival

    Now do two’s compliment. I had a boss that needs that bad.

    • #18
  19. Arahant Member
    Arahant
    @Arahant

    Percival (View Comment):

    Now do two’s compliment. I had a boss that needs that bad.

    ?

    • #19
  20. Hank Rhody, Red Hunter Contributor
    Hank Rhody, Red Hunter
    @HankRhody

    Basil Fawlty (View Comment):

    Hank Rhody, Red Hunter (View Comment):

    Belt (View Comment):

    If you really, really dig binary you can count up to 1,023 on your fingers.

    I did that once. In a long and boring catholic wedding. Had my hands hanging behind my back, over the top of the pew. Accidentally flipped over the (what’s the name for it?) the kneeling cushion. BANG!

    A diagram would be helpful here.

    A diagram of hand positions is well past my ability. Let me try to run you through the description.

    Put your right hand in front of your face, palm inward, in the form of a fist. Each of your digits is now a digit, doubly so. Stick your thumb out like you’re hitchhiking. That’s the rightmost place. Since it has a one now you’ve gone from zero to one. Replace you’re thumb and stick your index finger out. That’s a one in the second place and zeros everywhere else. You’re signalling 10, which works out to two in decimal. Stick your thumb out with your index extended and you’ve got  00011, or three.

    If you attempt four you’ll tell your boss what you think of him.

    • #20
  21. Hank Rhody, Red Hunter Contributor
    Hank Rhody, Red Hunter
    @HankRhody

    DonG (View Comment):

    did we jump from transistors to binary? what about gates and latches?? the transition from analog to values to binary values is a key step.

    I have been jumping around a bit. Spent a long time in manufacturing knowhow going through the whole patterning loop. Figured I’d jump straight to math to switch it up for people. 

    I’ll make a note to write up gates and latches sometime.

    • #21
  22. Percival Thatcher
    Percival
    @Percival

    Arahant (View Comment):

    Percival (View Comment):

    Now do two’s compliment. I had a boss that needs that bad.

    ?

    I tried to explain it to him while I was running tests on the protocol analyzer. “no, no … FFFF FFFF FFFF FFFB is -5 …”

    • #22
  23. Major Major Major Major Member
    Major Major Major Major
    @OldDanRhody

    Hank Rhody, Red Hunter (View Comment):

    DonG (View Comment):

    did we jump from transistors to binary? what about gates and latches?? the transition from analog to values to binary values is a key step.

    I have been jumping around a bit. Spent a long time in manufacturing knowhow going through the whole patterning loop. Figured I’d jump straight to math to switch it up for people.

    I’ll make a note to write up gates and latches sometime.

    Maybe throw in some Boolean algebra as well…

    • #23
  24. Basil Fawlty Member
    Basil Fawlty
    @BasilFawlty

    Hank Rhody, Red Hunter (View Comment):
    A diagram of hand positions is well past my ability.

    Actually, I was looking for a diagram of arm positions and how you were able to position your arms in such a way as to reach the kneeler in another pew.

    • #24
  25. Randy Weivoda Moderator
    Randy Weivoda
    @RandyWeivoda

    Gary McVey (View Comment):

    Damn Prots, always stirring up a commotion ;-)

    Your hands are supposed to be operating rosary beads as a background operation, a reasonably Hank-esque way of coding a long string of executable prayer instructions in firmware.

    When I was a kid, some scary-looking old Italian ladies had hundred-decade strings of beads, a form of virtue signaling that probably goes back to the Middle Ages. I guess they’d count as Mainframe Catholics.

    This is what makes Ricochet worth paying for.

    • #25
  26. Arahant Member
    Arahant
    @Arahant

    Percival (View Comment):

    Arahant (View Comment):

    Percival (View Comment):

    Now do two’s compliment. I had a boss that needs that bad.

    ?

    I tried to explain it to him while I was running tests on the protocol analyzer. “no, no … FFFF FFFF FFFF FFFB is -5 …”

    Wasn’t sure what the “compliment” was.

    Gee, Mrs. Two, you’re looking very fine today.

    • #26
  27. Vince Guerra Inactive
    Vince Guerra
    @VinceGuerra

    The part about the color codes was fascinating. Thank you. 

    • #27
  28. Mark Wilson Inactive
    Mark Wilson
    @MarkWilson

    Hank Rhody, Red Hunter: 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.

    We often use hex numbers to read telemetry values off a screen when testing rocket components.  When you have 16 or 32 independent status bits that indicate what mode the device is in, whether it’s initialized, whether it’s in standby or operate, whether there are errors, whether it has acquired GPS satellites, etc., it’s much easier to remember, say, 0A13 and 07BF indicate correct operation than 0000101000010011 and 0001011110111111.

    That way to catch an off-nominal condition you only have to spot that the A is a C, or 7 is a 3, rather than to spot the spurious bit in those long strings — it’s akin to catching a misspelling.

    • #28
  29. OccupantCDN Coolidge
    OccupantCDN
    @OccupantCDN

    Found this great video the other day. A simple binary counter that demonstrates the progression of binary numbers:

     

    • #29
  30. Arahant Member
    Arahant
    @Arahant

    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.

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