Binary Addition Rules Adding Binary Numbers 0 + 1 = 1 1 + 0 = 1 0 + 0 = 0 1 + 1 = 0 (carry one) 1 + 1 + carry = 1 (carry one)
Example 111111 1011011 +100111 --------------10000010 carries result *** The last carry is placed at the left hand side
Let’s try this… 10110 + 10010 11111 + 10101 11110 + 11110 101011 + 11100 100001 + 111 11111 + 11110 101000 110100 111100 1000111 111101
Let’s try this… 11100 + 1111 10111 + 11101 11010 + 10101 111011 + 10011 1111101 + 1011 101011 110100 101111 1001110 10001000
Subtracting Binary Numbers Binary Subtraction Rules take the second value (the number to be subtracted) and apply TWO'S COMPLEMENT (change 1 for 0 and 0 for 1) add 1 to the result (of two’s complement) add the complemented value to the first value; during addition we disregard the last carry
Example 11101011 - 1100110
Let’s try this… 11001000 - 110111 1001101 - 10110 1100100 - 110010 100001 – 111 100101100 - 1100100 10010001 110111 110010 11010 11001000
Let’s try this… 11111000 - 100111 1101111 - 10100 1100000 - 110111 100000 – 101 111101100 - 1100111 11010001 1011011 101001 11011 110000101
Multiplying Binary Numbers Binary multiplication can be achieved in a similar fashion to multiplying decimal values. Multiply each digit using the standard method; Add the results using the binary addition rules
Example 1011 x 111 Notice the pattern in the partial products, as you can see multiplying a binary value by two can be achieved by shifting the bits to the left and adding zeroes to the right.
Let’s try this… 11001 x 11 10011 x 101 100100 x 110 11111 x 101 101100 x 100 1001011 1011111 11011000 10011011 10110000
Seatwork: 11001 + 111111 10011 - 1011 111100 - 11110 111111 x 111 101111 x 1011 1011000 1000 11110 110111001 1000000101
Dividing Binary Numbers Binary division can be achieved in a similar fashion to dividing decimal values. Divide the divisor from the dividend Use the simple subtraction rules whenever necessary, as follows: 0 – 0 = 0 1 – 1 = 0 1 – 0 = 1 0 – 1 = 1 (with borrow)
Example 11 r = 10 11 )1011 -11 101 -11 10 <-- remainder, R
Let’s try this… 100 / 10 111 / 11 1010 / 100 1101 / 11 10111 / 10 10 10 r 1 10 r 10 100 r 1 1011 r 1
Compute the ff.: 10111101 + 11111 1111001 + 101010 10110110 - 101110 101111011 - 110111 1010101 x 101 1100110 x 11 1001001 / 111 111000110 / 1010
Compute the ff.: 11011100 10100011 10001000 101000100 110101001 100110010 1010 r 11 101101 r 100