Building a Computer 111: Negative Numbers

We have started building a 4-bit adder using Wandel’s plans. Photos to come! It’s amazing what you can do with a coping saw and some pine planks. It won’t look as nice as Wandel’s but I hope that it works. We have even been cutting the holes with the coping saw since I don’t have the proper drill bit. So far they have come out rounder than I expected. Straight lines are hard to do with a coping saw, but…meh they should be straight enough.

Anyway, we got some notebooks to write down our ideas and plans in. Tonight the nine-year-old set to work on how we can represent negative numbers in our binary machine. (I clued him in that this seemed to be the way to go to get a subtractor.) Since we are building a 4-bit machine currently I had him work with 4-bit numerals. This means that any carries into the fifth palce just roll off and are lost. I told him to try to find a numeral that when added to 0001 (using the algorithm that we know) gives 0000. What ever that numeral is it should represent -1. He soon found that 1111 works. Then he set to work adding 1111 iteratively to get -2, -3, etc.

The numerals he is working out for the negatives are what computer scientists call two’s complement. Computer folks will probably tell you that the name two’s complement derives from the fact that -n is represented by 2^N-n , where N is the number of bits. This seems like a silly reason to call it two’s complement to me (two-to-the-N’s compliment, OK). Mathematicians will probably tell you that the name is a joke, deriving from another negative-number convention called one’s complement. What’s really happening (or what a mathematician like me would say is really happening) is that–since working with N-bit numbers means you are working modulo 2^Ntwo’s compliment is completely natural; that is, it plays very nicely with arithmetic operations such as + and -.

Anyway, two’s compliment not only has nice properties with respect to arithmetic operations, it has a pretty clean description in terms of flipping bits. I’ll get to that later as I’m planning on having my kids discover it soon…which will lead us to want to have some other logic gates…

While the nine-year-old was at this, the seven-year-old was busy diagramming the marble adder in her notebook, while the four-year-old drew a picture of a computer in hers.

Also I’ve begun to read my book. Thoughts on it to come.

This entry was posted in computers. Bookmark the permalink.

One Response to Building a Computer 111: Negative Numbers

  1. Pingback: Building a Computer 1100: Multiplication and Subtraction with an Adder « MATH with my KIDS

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s