Web Design,Programming,Mobile,iOS/Android,GameDev,IT Businness,eCommerce,Social Media


Monday, 20 May 2013

Binary Numbers - Addition


Binary Numbers
Binary Numbers
Arithmetic operations with binary numbers can be useful especially if you want to learn machine language, or you are programming an electronic chip or maybe a central processing unit CPU.

We can do arithmetic operations with binary numbers just like we do with decimals. Simple enough, arithmetic operations can be very straightforward we just need to follow some rules and concentration. Since we work only with two digits 0 and 1 some operations can be challenging, however a bit of concentration will allow your logic to clear its path. So lets see how electronic machines actually do math on their way.

Before we do some operations take a look at the table below and see how addition on binary numbers is not like normal decimals. Simple enough because in binary 1 + 1 is not equal to 2 right. We only work with two digits 0 and 1 and in binary there is no number 2.

0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 1

This may sound odd, but in binary 1 + 1 = 1. Actually this is not often true. We will see why when we do operations with larger binary numbers. Take a look at the example below.

+    1010

Let us break in detail. We start adding numbers like we do with decimals. Start with the first number and the first digit from the right that is 0. We add that digit with the first right digit of the second number that being 0. And 0 + 0 = 0. So lets continue with the second digits. 1 + 1 = 1 in binary when we have addition like this we write 0 and we carry 1. That is actually 10 but we write 0 and carry 1 just like we do with decimals. Take a look at the picture below where we describe the steps of solving the equation above.

Binary Numbers
The red ones are carried bits. When we carry a bit we add that digit with the digit below it and then do addition with the result. Like for this example in  the first carried bit we do 1+0 = 1 and then we add with the original one which is 1 + 1. Result is 10 but we write 0 and again we carry the bit to the next digit. Carrying bits goes till we have nothing to carry or add. When we end we just write down the number we have left off. The end result is the result of addition done upon two binary numbers.

Lets take another example.

+   01011

The logic goes same here. Even if we have to carry many bits we continue till we have none to carry. If you practice some examples you will get used to adding binary numbers. The problem can be challenging when we carry bits but some concentration will keep you in straight way. Again the picture below shows the steps for the equation above. See how bits are carried along nearest digits and then added with the result.

Binary Numbers

Binary operations can be useful. If you want to understand how electronic machines logic and then you must learn how to operate with binary numbers. Computers brain the CPU does logical operation like this. Every electronic chip uses binary to do tasks that is designed for. For curiosity if you didn't know, every CPU only knows how to Add and Substract. You may ask how can i play my RPG game if the CPU does only addition and substraction. Well that is a very long story to cover, but know everything is done upon addition and substraction.

Suggested Article : Boolean Algebra - Digital Logic

Written by

Thank you for taking your time to browse through our blog. We try to build as much rich content base as we can. We focus in modern technologies, computer science design and business.


Post a Comment


© 2013 smartnoob . All rights resevered. Designed by Templateism