Computer Arithmetic
Computer Arithmetic
Computer Arithmetic 2
BINARY ARITHMETIC
• Binary arithmetic is simple to learn as binary
number system has only two digits 0 and 1
• Following slides show rules and example for four
basic arithmetic operating using binary number.
Computer Arithmetic 3
BINARY ADDITION
Rule for binary addition is as follows :
Computer Arithmetic 4
BINARY ADDITION EXAMPLE 1
Example : Add binary numbers 10011 and 1001 in both decimal and
binary form
Binary Decimal
10011 1+1 = 0 19
+ 1001 1+(1+0) = 0
1+(0+0)=1 +9
_______ 0+1=1
1 ____
11100
28
In this example , carry are generated for first and second columns.
Computer Arithmetic 5
BINARY ADDITION EXAMPLE 2
Example : Add binary numbers 100111 and 11011 in both decimal and
binary form
Binary Decimal
100111 39
1+1 =0
+ 11011 1+(1+1) = 1 +27
_______ 1 + (1+0) =0
1+(0+1)=0 ____
1000010 1+(0+1) =0
66
1+1 =01
In this example , carry are generated for first and second columns.
Computer Arithmetic 6
BINARY SUBTRACTION
Rule for binary subtraction is as follows :
Computer Arithmetic 7
BINARY SUBTRACTION EXAMPLE 1
Binary
10101 1-0 = 1
0-1 = 1
- 01110 0-1 =1
1-1=0
_______ 0-0=0
00111
Computer Arithmetic 8
COMPLEMENT OF A NUMBER
Computer Arithmetic 9
EXAMPLE 1 OF COMPLEMENT OF A NUMBER
solution
The number has 2 digits, and the value of base is 10
Computer Arithmetic 10
EXAMPLE 2 OF COMPLEMENT OF A NUMBER
solution
The number has 1 digits, and the value of base is 8
So , the complement of 𝟔𝟖 = 𝟏𝟖
Computer Arithmetic 11
COMPLEMENT OF BINARY NUMBER
Example
Computer Arithmetic 12
COMPLEMENTARY METHOD OF SUBTRACTION
Involves following 3 steps :
Computer Arithmetic 13
EXAMPLE 1 OF COMPLEMENTARY SUBTRACTION
Example : subtract 56 10 from 92 10 using complementary method
solution
Computer Arithmetic 14
EXAMPLE 2 OF COMPLEMENTARY SUBTRACTION
Example : subtract 35 10 from 18 10 using complementary method
solution
Computer Arithmetic 15
Break
Computer Arithmetic 16
EXAMPLE 1 OF COMPLEMENTARY SUBTRACTION WITH
BINARY
Example : subtract 0111000 2 from 1011100 2 using complementary method
solution
Computer Arithmetic 17
EXAMPLE 2 OF COMPLEMENTARY SUBTRACTION WITH
BINARY
Example : subtract 100011 2 from 010010 2 using complementary method
solution
Computer Arithmetic 18
BINARY MULTIPLICATION
Table for binary multiplication is as follows :
Computer Arithmetic 19
EXAMPLE 1 OF BINARY MULTIPLICATION
Example : Multiply the binary number 1010 2 and 1001 2
solution
Computer Arithmetic 20
BINARY DIVISION
Table for binary division is as follows :
Computer Arithmetic 21
BINARY DIVISION
Computer Arithmetic 22
RULES FOR BINARY DIVISION
Computer Arithmetic 23
EXAMPLE 1 OF BINARY DIVISION
Example : Divide 01111100 2 by 0010 2
Solution
Remove the zero’s in the Most Significant Bit in both the dividend and divisor,
that doesn’t change the value of the number
24
EXAMPLE 1 OF BINARY DIVISION
Example : Divide 01111100 2 by 0010 2
Solution
Step 1: First , look at the first two numbers in the dividend and compare with
the divisor. Add the number 1 in the quotient place. Then subtract the value,
you get 1 as remainder.
Step 2: Then bring down the next number from the dividend portion and do
the step 1 process again
Step 3: Repeat the process until the remainder becomes zero by comparing
the dividend and the divisor value.
Step 4: Now, in this case, after you get the remainder value as 0, you have
zero left in the dividend portion, so bring that zero to the quotient portion.
25
EXAMPLE 1 OF BINARY DIVISION
Example : Divide 101101 2 by 101 2
Solution
26
ADDITIVE METHOD
Computer Arithmetic 27
ADDITION- SUBTRACTION MULTIPLICATION
28
REPEATED ADDITION (ADDITIVE METHOD) FOR
MULTIPLICATION
This method involves repeatedly adding one number to itself
a certain number of times to achieve multiplication.
Example: Multiply 3 by 4 using repeated addition
Solution
3 * 4 = 3 + 3 + 3 + 3 = 12
29
ADDITIVE DIVISION
30
ADDITIVE DIVISION
Example: Divide 33 by 6 using additive division.
Step 1: Subtract 6 from 33
33 - 6 = 27
Step 2: Subtract 6 from 27
27 - 6 = 21
Step 3: Subtract 6 from 21
21 - 6 = 15
Step 4: Subtract 6 from 15
15 - 6 = 9
Step 5: Subtract 6 from 9
9-6=3
Step 6: Subtract 6 from 3
3 - 6 = -3
The result is -3, but since we 've reached a Negative Number and can't subtract 6
anymore without going further into the negatives, we stop here.
So, 33 ÷ 6 = 5 with a remainder of 3.
31
ADDITIVE DIVISION
Example: Divide 20 by 5 using additive division.
20 ÷ 5 = 4
20 - 5 = 15
15 - 5 = 10
10 - 5 = 5
5-5=0
32
THANK YOU
Ayat Bahaa ABDULHUSSEİN
Computer Arithmetic 33