ôô

How Do Computers Add? Part 3

Have you ever wondered how computers and calculators—both of which are nothing more than mindless boxes of plastic, wires, and other strange parts—manage to add numbers? And so quickly! Math Dude explains the final part of the story.

By
Jason Marshall, PhD
4-minute read
Episode #147

How Do Computers Add? Part 3Every great story must come to an end. And the story of our quest to understand how computers and calculators add is no exception. Although it seems almost impossible, somehow these mindless boxes of plastic, wires, and other odds-and-ends work together to do our mathematical bidding. So far we've talked about binary numbers, Boolean algebra, logic gates, and how the XOR gate can be used for the first steps of addition. But we still haven't managed to wrap up the thorny problem of understanding how computers use this stuff to solve actual real world addition problems. Until today..

Review: Exclusive OR

The crux of our story to this point is that the tiny electronic components known as logic gates can be used to perform Boolean operations on one or more input bits (which can be either 1 for TRUE or 0 for FALSE) and spit out a binary TRUE or FALSE output bit as the result. We’ve learned about the three fundamental logic gates that implement the AND, OR, and NOT operations of Boolean algebra, and last time we learned about the all important exclusive OR gate—aka XOR.

The first important thing to know about exclusive OR gates is that they return TRUE exclusively when one or the other of their input bits—but not both—are TRUE. That means that 0 XOR 1 and 1 XOR 0 both return 1 while 0 XOR 0 and (this is the kind of strange one) 1 XOR 1 both return 0. The second big thing to know about XOR is that these output values are exactly the same as the values of the right-most bit (called the “sum bit”) when adding two binary numbers. In other words, the right-most bit in the simple binary addition problems 0 + 0 = 0, 1 + 0 = 1, 0 + 1 = 1, and 1 + 1 = 10 match the output of the XOR operation applied to the two input bits. Which means that the XOR operation gives us the sum bit in binary addition.

Pages

About the Author

Jason Marshall, PhD

Jason Marshall is the author of The Math Dude's Quick and Dirty Guide to Algebra. He provides clear explanations of math terms and principles, and his simple tricks for solving basic algebra problems will have even the most math-phobic person looking forward to working out whatever math problem comes their way.