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:
|
• 101101 + 11001 = 1000110:
|
• 1011001 + 111010 = 10010011:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
• 1110 + 1111 = 11101:
|
• 10111 + 110101 = 1001100:
|
• 11011 + 1001010 = 1100101:
|
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:
|
• 1010110 − 101010 = 101100:
|
• 1000101 − 101100 = 11001:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
• 100010110 − 1111010 = 10011100:
|
• 101101 − 100111 = 110:
|
• 1110110 − 1010111 = 11111:
|