Binary Arithmetic

Slide Note
Embed
Share

Explore the world of binary arithmetic, including addition, subtraction, multiplication, and division. Learn the rules and examples of performing basic binary operations efficiently. Understand how to convert binary numbers to decimal equivalents. Enhance your understanding with visual explanations and step-by-step solutions.


Uploaded on May 13, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. Binary Arithmetic

  2. Binary operations Binary addition Binary subtraction Binary multiplication Binary division

  3. Binary addition Rules for binary addition:

  4. Binary addition

  5. Addition of large binary numbers

  6. Solve 1. (12)10+ (8)10 2. (15)10+ (10)10 3. (35)10+ (48)10 4. (10101)2+ (10110)2 5. (10111)2+ (11000)2

  7. Binary Subtraction

  8. Rules for binary subtraction

  9. Binary subtraction

  10. Subtraction of large binary numbers 11001 - 10111 = 00010

  11. Examples

  12. Binary subtraction Example 1: 0011010 001100 Solution: 1 1 Borrow 0 0 1 1 0 1 0 (-) 0 0 1 1 0 0 0 0 0 1 1 1 0 Decimal Equivalent : 0 0 1 1 0 1 0 = 26 0 0 1 1 0 0 = 12 Therefore, 26 12 = 14 The binary resultant 0 0 0 1 1 1 0 is equivalent to the 14

  13. Logic for binary to decimal 0 0 1 1 0 1 0 =26 26 25 24 23 22 21 20 64 32 16 8 4 2 1 16 8 2 =26

  14. Binary Subtraction Example 2: 0100010 0001010 Solution: 1 1 Borrow 0 1 0 0 0 1 0 = 3410 (-) 0 0 0 1 0 1 0 = 1010 0 0 1 1 0 0 0 = 2410

  15. Binary subtraction subtract 1010101.10 from 1111011.11 1 borrow 1111011.11 1010101.10 0100110.01

  16. Binary subtraction using 1 s and 2 s complement method

  17. How to find 1s Complement of given number 1 s complement of a number is found by changing all 1 s to 0 s and all 0 s to 1 s. Ex: 1 s complement of a number 10111 is = 01000 Solve---- Find 1 s complement of a. 11010 = 00101 b. 101101= 010010 c. 1010= 0101 d. 1111=0000 e. 1011001=0100110

  18. How to find 2s Complement of given number The 2 s complement of a number is obtained by adding 1 to the LSB of 1 s complement of that number 2 s complement = 1 s complement + 1 Ex: obtain 2 s complement of a number (10110010)2 Solution:

  19. Solve Find 2 s complement of following numbers. a. (1101)2 0010=1=0011 b. (10111)2 01000+1=01001 c. (101101)2 010010+1=010011 d. (1011111)2 010000+1=010001 e. (101111101)2 010000010+1=010000011

  20. Subtraction using 1scomplement A) For subtracting a smaller number from a larger number, the 1scomplement method is as follows: 1. Determine the 1scomplement of the smaller number. 2. Add the 1scomplement to the larger number. 3. Remove the final carry and add it to the result. This is called the end-around carry.

  21. Binary subtraction using 1s complement method To perform subtraction (A)2 - (B)2 Step 1: convert number to be subtracted (B)2to its 1 s complement. Step 2: Add first number (A)2and 1 s complement of (B)2 using rules of binary addition. Step 3: if final carry is 1 then add it to the result of addition obtained in step 2 to get final result. **If final carry in step 2 is 1 then result obtained in step 2 is Positive and in its true form no conversion required. Step 4: if final carry in step 2 is 0 then result obtained in step 2 is negative and in 1 s complement form. So convert it to its true form.

  22. Binary subtraction using 1s complement 10---------------------------------- 10 -3 - 11-----1 complement of 11 +00 --- ----- -1 10 result 1 s complement of result 01 final result carry 0 so result sign is negative 0

  23. 3 11 11 -2 10---------01 ---------- 1 0 0 1 ------------ 01

  24. Binary subtraction using 1s complement 9 1001 1001 - 15 1111 1 s complement ------- ------- -6 1001 1 s complement of result 0110 ---6 carry is 0 so result sign is negative +0000 0

  25. Binary Subtraction Questions Using 1s Complement Question 1: (110101)2 (100101)2 Solution: (1 1 0 1 0 1)2= 5310------- minuend. (1 0 0 1 0 1)2= 3710 subtrahend Now take the 1 s complement of the subtrahend and add with minuend. 1 carry 1 1 0 1 0 1 (+) 0 1 1 0 1 0 0 0 1 1 1 1 1 + 1 carry 0 1 0 0 0 0 Therefore, the solution is 010000 (010000)2= 1610

  26. Binary Subtraction Questions Using 1s Complement Question 2: (101011)2 (111001)2 43-57= -14 Solution: Take 1 s complement of the subtrahend 1 1 1 1 0 1 0 1 1 (+) 0 0 0 1 1 0 (1 s complement) 1 1 0 0 0 1 Now take the 1 s complement of the resultant since it does not carry 1 The resultant becomes 0 0 1 1 1 0 Now, add the negative sign to the resultant value Therefore the solution is (001110)2.

  27. Binary subtraction using 2s complement method To perform subtraction (A)2 - (B)2 Step 1: convert number to be subtracted (B)2to its 2 s complement. Step 2: Add first number (A)2and 2 s complement of (B)2 using rules of binary addition. Step 3: if final carry is 1 then the result Positive and in its true form no conversion required. Step 4: if final carry in step 2 is 0 then result obtained in step 2 is negative and in 2 s complement form. So convert it to its true form. ** Carry always be discarded.

  28. Binary subtraction using 2s complement 5 101 -7 111 1 s comple.---000 ---- + 1 -2 ------ 2 s complement 001 +101 ------- result 110 1 s complement 001 + 1 -------- 2 s complement 010 final result Carry is 0 so result is negative 0

  29. 13 1101 -10 1010 0101 ------- 1 03 --------- 0110 1101 -------------- 1 0011

  30. Subtraction using 2s complement 33 100001 -45 101101 1 s 010010 ----- + 1 -12 ------------ 2 s 010011 +100001 ------------ 110100 result 1 s 001011 + 1 ------------- 2 s 001100 final result 0

  31. Solve the following binary subtraction using 1 s and 2 s complement method 15-23 25-18 23-18 18-9

  32. 10111 10111 -10010 01101 1 s 1 --------- 01110 10111 ----------- 100101

  33. Binary Multiplication

  34. Multiplication (1 of 3) Decimal (just for fun) 35 x 105 175 000 35 3675

  35. Multiplication Binary, two 1-bit values A B 0 0 0 1 A 0 0 1 1 B 0 1 0 1

  36. Example Binary Multiplication A = 910 = 10012 A3A2A1A0 B = 810 = 10002 B3B2B1B0 1001 1000 ------------------ 0000 multiply by B0 + 0000 multiply by B1 + 0000 multiply by B2 + 1001 multiply by B3 -------------- 1001000 Cross check 1 0 0 1 0 0 0 64 32 16 8 4 2 1 place value of result bits 64+8=72

  37. Perform the following multiplication in binary number system: 10112 1012 1 0 1 1 1 0 1 --------- 1 0 1 1 + 0 0 0 0 + 1 0 1 1 carry 1 ------------------- 1 1 0 1 1 1

  38. Perform the following multiplication in binary number system: 101.12 11.12 1 0 1 .1 1 1 .1 ---------------- 1 0 1 1 + 1 0 1 1 + 1 0 1 1 Carry 1 1 1 1 --------------------- 1 0 0 1 1. 0 1

  39. Multiplication Binary, two n-bit values As with decimal values E.g., 1110 x 1011 1110 1110 0000 1110 10011010

  40. Binary Multiplication Perform the following multiplication in binary number system: 1510 810 Perform the following multiplication in binary number system: 10012 11012 Perform the following multiplication in binary number system: 111.112 101.12

  41. Solve (205)10 x (3)10 (1110101)2 x (1001)2 (110)2 x (10)2 (1111101)2 x (101)2 (15)10 x (8)10

  42. Binary Division

  43. Binary Division:110 10 10) 110 ( 11 - 10 ---------- 010 - 10 ------------ 000

  44. Binary division Ex: (25)10 (5)10

  45. Perform the division 111110.1 101 1100.1 quotient 101)111110.1 5)62.5(12.5 -101 -5 -------------- --------- 0101 12.5 - 101 - 10 ------------- -------- 0000101 02.5 - 101 - 2.5 -------------- -------- 0000000 remainder 000

  46. Solve (205)10 (3)10 (1110101)2 (1001)2 (110)2 (10)2 (1111101)2 (101)2

  47. 100)1100(11 100 --------------- 0100 100 ---------------- 0000

More Related Content