Week 5: DATA REPRESENTATION
BINARY ADDITION
and
SUBSTRACTION
Topics:
Binary Addition
Binary Subtraction
Study
Topics
Week 5 Course Guide
| Home

BINARY ADDITION
Binary addition is easier than decimal addition. You are adding
the numbers 0 and 1 together two digits at a time. The rules are the same
as with decimal addition except when you are adding together 1 + 1 which
is a 2 in decimal and a 10 in binary. (1 in the 2’s position and a 0 in
the 1’s position). Just like with decimal addition, you will bring down
the 0 and carry the 1 to the next position.
Rules of Binary Addition
0 0 1 1
+0 +1 +0 +1
0 1 1 0 (total 2 which is 01 in binary - bring down the 0
and carry 1 to the next position)
The only other situation you will see when adding two binary
numbers together is the add together 3 one bits. You are adding two one
bits and have a 1 carry bit from the previous position.
1
1
+ 1
-
(total 3 which is 11 in binary – bring
down the 1 and carry 1 to the next position)
For example: Add the two 8-bit binary numbers
01010011
+ 11010100
Position1: (1 + 0) = 1 Position 2: (1 + 0) = 1 Position 3: (0 + 1) =
1
01010011 01010011 01010011
+ 11010100 + 11010100 + 11010100
1 11 111
Position 4: (0 + 0) = 0 Position 5: (1 +1) = 10 Position 6:
(0 + 0 + 1) = 1
(bring down the 0, carry the 1)
01010011 01010011 01010011
+ 11010100 + 11010100 + 11010100
0111 00111 100111
Position 7: (1 + 1) = 10 Position 8: (1 + 0 + 1)
01010011 01010011
+ 11010100 + 11010100
0100111 100100111
For example: Add the two 8-bit binary numbers
01001101
+ 01101101
Position 1: (1 + 1) = 10 Position 2: (1 + 0 + 0) = 1 Position
3: (1 + 1) = 10
01001101 01001101 01001101
+ 01101101 + 01101101 + 01101101
0 10 010
Position 4: (1 + 1 + 1) = 11 Position 5: (1 + 0 + 0) = 1 Position 6:
(0 + 1) = 1
01001101 01001101 01001101
+ 01101101 + 01101101 + 01101101
1010 11010 111010
Position 7: (1 + 1) = 10 Position 8: (1 + 0 + 0) = 1
01001101 01001101
+ 01101101 + 01101101
0111010 10111010
BINARY SUBTRACTION
Binary subtraction involves adding a positive and negative
number together. You will convert the negative number to a negative form
and then add the two numbers together. It is difficult to tell the value
of a number when it is in a negative form. Step 5 will allow you to verify
the answer to the problem, if the number is negative.
Steps of two’s complement subtraction (8 bit numbers)
-
Convert the numbers to binary
-
Complement the bits of the bottom number
-
Add one to the bottom number
-
Add the two numbers together
-
If there are 8 bits in the result, the answer is negative. Flip the bits
and add one to check the result.
If there are 9 bits in the result, the answer is positive. Drop the
rightmost bit.
For example:
4510
- 2410
2110
-
Convert the decimal numbers to binary.
45 = 001011012
24 = 000110002
-
Complement the bits of the bottom number. (Change the 1 bits to 0 and the
0 bits to 1)
24 = 000110002 (Original number)
24 = 111001112 (Complemented number)
-
Add one to the complemented bottom number
111001112
000000012
11101000 (new bottom number)
-
Add the top number and new bottom number together.
001011012
111010002
100010101
-
There are 9 bits in the result, the answer is positive. Drop the rightmost
bit.
Check the result by converting the binary number to a decimal
number.
000101012 = 2110
For example:
5010
- 6410
-1410
-
Convert the decimal numbers to binary.
50 = 001100102
64 = 010000002
-
Complement the bits of the bottom number. (Change the 1 bits to 0 and the
0 bits to 1)
64 = 010000002 (Original number)
64 = 101111112 (Complemented number)
-
Add one to the complemented bottom number
101111112
000000012
11000000 (new bottom number)
-
Add the top number and new bottom number together.
001100102
110000002
111100102
-
There are 8 bits in the result, the answer is negative. Flip the bits and
add 1 to the number. Check the result by converting the binary number to
a decimal number.
111100102 = original number = -1410
000011012
000000012
000011102
Result = 000011102 = 1410 This last step was
performed only to check the answer to see that it was a 1410.
The original number 111100102 is the way the number is stored
inside the computer system.

STUDY TOPICS
-
List the characteristics of numbering systems
-
List the characteristics of each numbering system
-
Describe the purpose of each numbering system
-
Convert each number type to binary
-
Add binary numbers
-
Subtract binary numbers
Week 5 Course Guide
| Home
|