Wednesday, November 26, 2014
Bits of Binary: How to add binary numbers
Addition is probably one of the most common operations when using binary numbers. And it's really easy to do. We'll see how easy in this episode of Bits of Binary at the House of Hacks.
How to convert between decimal and binary.
Bits of binary playlist
For a written transcript, go to How to add binary numbers.
Music under Creative Commons License By Attribution 3.0.
Intro/Exit: "Hot Swing" by Kevin MacLeod at http://incompetech.com
Incidental: "Zap Beat" by Kevin MacLeod at http://incompetech.com
One plus one equals... huh? I'll talk about how this actually makes sense, today at the House of Hacks.
Hi Makers, Builders and Do-It-Yourselfers. Harley here.
In the last episode of Bits of Binary, I showed how to convert between decimal and binary numbers. In this episode in the series, we'll look at how to add binary numbers together.
Remember in grade school when you had to memorize this addition chart?
Well, OK, maybe you didn't have to memorize it, but I sure did.
This table is a matrix with the 10 numbers found in the decimal system, 0 through 9, on both the row and column headers. Each cell contains the sum of its row and column header. This gives us the sums for all the single digit combinations. 0+0=0 all the way up to 9+9=18. Multi-digit numbers can be added by simply thinking of them as multiple single digit combinations.
Well, binary has something similar, but much, much smaller. Since there are only two numbers in the binary system, 0 and 1, the table only has two rows and two columns. And it looks like this.
Or if you want to write it a slightly different way as equations, it looks like this.
Once you know this table, the process of adding in binary is exactly the same as adding in decimal. For example let's look at the decimal numbers: 321 + 181. Staring with the units: 1+1 = 2, 2+8 = 10 so write 0 and carry a 1, 1 + 3 = 4 + 1 = 5.
Similarly, in binary we'll look at 1011 + 10. Starting with the units on the right: 1 + 0 = 1, 1 + 1 = 10 so write 0 and carry a 1, 1 + 0 = 1, 1 + 0 = 1 again.
That's it. Addition is short and sweet. Thanks for watching this episode of Bits of Binary. In the next episode, we'll look at how to subtract binary numbers.
I've created a playlist over here that will be filled in as new episodes in this series are added.
Thanks to everyone who has subscribed to this channel and liked the videos.
Be sure to leave a comment if you have any thoughts or questions on this topic.
And until next time, go make something. It doesn't have to be perfect, just have fun!