COMPUTER ARITHMETIC IS A BRANCH OF COMPUTER ENGINEERING.

Computer Arithmetic


Introduction

• Recap:


• Binary numbers are a number system with base 2.
• Information represented inside a computer takes binary values.
• Previous lecture dealt with the conversions between different number systems.
• This lecture deals with basic mathematical operations (such as addition, subtraction, multiplication and division) for binary numbers.


                       

Binary Addition


• Addition in the decimal number system.
• Add values rightmost position (least significant).
• If this addition is grater than 10, 1 is carried to the 2nd position and added.
• This process is carried for all the positions.
• Binary addition follows the same set of rules.
• If the addition is greater that 2, 1 is carried to the 2nd next position.


                            

Binary Subtraction


• Similar to subtraction in the decimal number system.
• Inverse of addition.
• If the values cannot be subtracted, borrow from the next position.
• Subtraction table,
• 0 − 0 = 0
• 1 − 0 = 1
• 1 − 1 = 0
• 0 − 1 = 1 with a borrow of 1.

Multiplication & Division


• Similar to multiplication and division in the decimal number system.
• Rules of binary multiplication,
• 0 × 0 = 0
• 0 × 1 = 0
• 1 × 0 = 0
• 1 × 1 = 1.
• Rules of binary division,
• 0 ÷ 1 = 0
• 1 ÷ 1 = 1.

Self studying


• How these values are represented in a computer.
• How much space each value takes when storing.
• What happens if a binary operation provides a result which exceeds the allocated space (Overflow)?
• What happens if an operation provides a result that is too small for the allocated space (Underflow)?
• How are negative numbers represented in a computer?

Complimentary Arithmetic


• Complements are used in digital computers for simplifying,
                • the subtraction operation
                • the logical manipulation.
• Two types of compliments for each base 𝑏 system.
                • 𝑟’𝑠 compliment
                • (𝑟 − 1)’𝑠 compliment
                • Example: For binary numbers, 2’s complement and 1’s complement.
• Given a number 𝑁 in base 𝑟 having 𝑛 digits, (𝑟 − 1)’s complement of 𝑁,
                                              𝑁′ = 𝑟𝑛 − 1 − 𝑁
• Given a number 𝑁 in base 𝑟 having 𝑛 digits, 𝑟’s complement of 𝑁,
                                             𝑁′ = 𝑟𝑛𝑁 for 𝑁 ≠ 0; 0 otherwise
• Comparing (𝑟 − 1)’s compliment, 𝑟’s compliment can be obtained by adding 1 to the (𝑟 − 1)’s compliment.


                              

Summary


• Perform basic binary operations (addition, subtraction, multiplication and division).
• Explain overflow and underflow.
• Explain how signs works in binary representations in a computer.
• To perform complement operations r’s complement and (r-1)’s complement.

Next Lecture:- Differentiation

Comments