Sunday, May 19, 2013

Binary Addition


Addition [edit]

Let's look at an example of adding in decimal:
 25
+43
---
 68
This is pretty simple, we just add up each column, but what happens if we have can't fit the result in one column. We'll have to use a carry bit:
 98
+57
---
155
11
Hopefully you're good with that. Now let's take a look at how it's done in binary with a very quick example, with a check in denary:
 01010 (1010)
+00101 (510)
------
 01111 (1510)
This seems pretty straight forward, but what happens when we have a carry bit? Well pretty much the same as in denary:
 01011 (1110)
+00001 (110)
------
 01100 (1210)
   11


1010 + 0001
Answer :
 1010
+0001 ----
 1011

01001001 + 00110000
Answer :
 01001001 
+00110000
 --------
 01111001

01010100 + 00110000
Answer :
 01010100 
+00110000
 --------
 10000100

01001010 + 00011011
Answer :
 01001010 
+00011011
 --------
 01100101

01111101 + 00011001
Answer :
 01111101 
+00011001
 --------
 10010110

00011111 + 00011111
Answer :
 00011111 
+00011111
 --------
 00111110

10101010 + 01110000
Answer :
 10101010 
+01110000
 --------
100011010
Note we have some overflow, this will come in useful when doing subtraction




1 comment:

  1. Thank you for sharing such detailed information on trending courses. Pursuing advanced diploma may lead to high paying jobs.

    ReplyDelete