CompAddict

Welcome to our blogger...:-)

Monday 22 October 2012

Chapter1 Number Operation 1.3 Binary addition Number operation .


CHAPTER1:NUMBER OPERATION.
1.3..Number Operation (Binary addition and Binary subtraction) .
By: ABDULADHEM SAGHIR MESFER ALAZAM   B031210406.
Binary addition
What are the Rules in binary addition operation ?
Essentially, there are four (4) rules we should follow in binary addition as in table 3-1

Binary Rules
Sum
Carray
0+0=0
0
0
0+1=1
1
0
1+0=1
1
0
1+1=1
0
1




Examples
Here are some examples of binary addition. These are computed without regard to the word size, hence there can be no sense of "overflow." Work through the  columns right to left, add up the ones and express the answer inbinary. The low bit    goes in the sum, and the high bit carries to the next column left. 
 10001 + 11101 = 101110:
1
1
1
0
0
0
1
+
1
1
1
0
1
1
0
1
1
1
0
 101101 + 11001 = 1000110:
1
1
1
1
1
0
1
1
0
1
+
1
1
0
0
1
1
0
0
0
1
1
0
 1011001 + 111010 = 10010011:
1
1
1
1
1
0
1
1
0
0
1
+
1
1
1
0
1
0
1
0
0
1
0
0
1
1
 1110 + 1111 = 11101:
1
1
1
1
1
1
0
+
1
1
1
1
1
1
1
0
1
 10111 + 110101 = 1001100:
1
1
1
1
1
1
0
1
1
1
+
1
1
0
1
0
1

1
0
0
1
1
0
0
 11011 + 1001010 = 1100101:
1
1
1
1
1
0
1
1
+
1
0
0
1
0
1
0
1
1
0
0
1
0
1



Binary subtraction:
There are four (4) rules we should follow in binary subtraction as in table 3-2

Binary Rules
Sum
Borrow
0-0=0
0
0
0-1=1
1
10
1-0=1
1
0
1-1=1
0
1

Examples
Here are some examples of binary subtraction. These are computed without regard to the word size, hence there can be no sense of "overflow" or "underflow". Work the columns right to left subtracting in each column. If you must subtract a one from a zero, you need to “borrow” from the left, just as in decimal subtraction.
 1011011 − 10010 = 1001001:
1
0
1
1
0
1
1
1
0
0
1
0
1
0
0
1
0
0
1
 1010110 − 101010 = 101100:
0
0
×1
10
×1
10
1
1
0
1
0
1
0
1
0
1
0
1
1
0
0
 1000101 − 101100 = 11001:
0
1
1
×1
×10
×10
10
1
0
1
1
0
1
1
0
0
1
1
0
0
1
 100010110 − 1111010 = 10011100:
0
1
1
1
10
×1
×10
×10
×10
×1
10
1
1
0
1
1
1
1
0
1
0
1
0
0
1
1
1
0
0
 101101 − 100111 = 110:
0
10
1
0
×1
×1
10
1
1
0
0
1
1
1
1
1
0
 1110110 − 1010111 = 11111:
0
10
1
10
10
1
×1
×1
×10
×1
×1
10
1
0
1
0
1
1
1
1
1
1
1
1