0% found this document useful (0 votes)
9 views

Computer Arithmetic

Uploaded by

ayatbahaa21
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Computer Arithmetic

Uploaded by

ayatbahaa21
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

COMPUTER ARITHMETIC

PhD : AYAT BAHAA ABDULHUSSEIN


BINARY OVER DECIMAL

• Information is handled in computer by


electronic/ electrical component
• Electronic component operate in binary
mode (can only indicate two state – on (1)
or off (0)
• Binary number system has only two digits (0
and 1 ) and is suitable for expressing two
possible states.
• Arithmetic rules / process possible with
binary numbers.

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

Example : subtract 𝟎𝟏𝟏𝟏𝟎 𝟐 from 10101 𝟐

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

Example : Find the complement of 𝟑𝟕 𝟏𝟎

solution
The number has 2 digits, and the value of base is 10

So , the complement of 𝟑𝟕𝟏𝟎 = 𝟔𝟐𝟏𝟎

Computer Arithmetic 10
EXAMPLE 2 OF COMPLEMENT OF A NUMBER

Example : Find the complement of 𝟔 𝟖

solution
The number has 1 digits, and the value of base is 8

So , the complement of 𝟔𝟖 = 𝟏𝟖

Computer Arithmetic 11
COMPLEMENT OF BINARY NUMBER

Complement of a binary number can be obtained by transforming all it’s


0’s to 1’s and all its 1’s to 0’s

Example

Computer Arithmetic 12
COMPLEMENTARY METHOD OF SUBTRACTION
Involves following 3 steps :

Complementary subtraction is an additive approach of subtraction

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

• As in the decimal number system (or in any other number


system ) , division by zero is meaningless
• The computer deals with this problem by raising an error
condition called ‘Divide by zero’ error

Computer Arithmetic 22
RULES FOR BINARY DIVISION

1. Start from the left of dividend


2. Perform a series of subtractions in which the divisor is
subtracted from the dividend
3. If subtraction is possible , put a 1 in the quotient and
subtract the divisor from the corresponding digits of
dividend
4. If subtraction is not possible (divisor greater than
remainder), record a 0 in the quotient
5. Bring down the next digit to add to the remainder digits.
Proceed as before in a manner similar to long 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

• Most computers use the additive method for perform


multiplication and division operation because it simplifies
the internal circuit design of computer system

Computer Arithmetic 27
ADDITION- SUBTRACTION MULTIPLICATION

In this method, multiplication is performed using addition


and subtraction. Let's take an example:
Example: Multiply 5 by 4 using addition and subtraction
Solution
5 * 4 = 5 + 5 + 5 + 5 = 20

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

Additive division could refer to the process of repeatedly


subtracting the divisor from the dividend until the dividend
becomes less than the divisor. The number of subtractions
gives the quotient

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

In this example, we subtracted 5 from 20 four times, so the


quotient is 4.

32
THANK YOU
Ayat Bahaa ABDULHUSSEİN

[email protected]

Computer Arithmetic 33

You might also like