1 / 7

Binary Arithmetic

Binary Arithmetic. Binary Addition. Example 1: 0 1 0 1 + 0 1 1 0. Addition Rules:. 1. 0 + 0 = 0 + 1 = 1 + 0 = 1 + 1 = 1 + 1 + 1 =. 0. 1. 1. 1. 0. 1. 1. 0 carry 1. 1 carry 1. Example 2: 1 0 1 1 1 + 1 0 0 1 0. 1. 1. 1. 0. 1. 0. 0. 1. OVERFLOW.

annis
Download Presentation

Binary Arithmetic

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Binary Arithmetic

  2. Binary Addition Example 1: 0 1 0 1 + 0 1 1 0 Addition Rules: 1 0 + 0 = 0 + 1 = 1 + 0 = 1 + 1 = 1 + 1 + 1 = 0 1 1 1 0 1 1 0 carry 1 1 carry 1 Example 2: 1 0 1 1 1 + 1 0 0 1 0 1 1 1 0 1 0 0 1 OVERFLOW

  3. Binary Multiplication Example: 1 0 1 X 111 Multiplication Rules: 0 x 0 = 0 x 1 = 1 x 0 = 1 x 1 = 0 0 0 1 0 1 1 1 + 1 0 1 0 1 1 0 1 0 0 1 0 0 0 1 1

  4. Binary Subtraction A computer cannot subtract a number from another. It can only add two numbers Example: Subtract B from A A - B Add –B to A A + (-B) Complementation

  5. Subtraction Rules • Pad with 0’s until both numbers are the same length • Take 2’s complement of the digit to be subtracted • Add the result to the first binary number • Ignore the carry result to preserve the initial size

  6. Step 1: One’s Complement Example: Find the one’s complement of 1001101 Number 1001101 Invert bits 0110010 Step 2: Two’s Complement Adding 1 to the one’s complement of a binary digit Example: Find the two’s complement of 1001101 Number 1001101 One’s complement 0110010 Add 1 + 1 Two’s complement 0110011

  7. Practice Examples Example 1:Find the result of 101 - 10 Step 1: Two’s complement for 010 Number 010 Invert bits 101 Add 1 + 1 Code for -010 = 110 Step 2: Add answer with first number Number 101 Code for -010 = 110 011

More Related