Partial preview of the text
Download Electronics engineering and more Schemes and Mind Maps Electronics in PDF only on Docsity!
3.2 Addition and Subtraction of Signed Numbers We can relate addition and subtraction operations of numbers by the following relationship : (+ A) — (+B) = (+ A) + (-B) and (t A) - (-B) = (+ A) + (+B) iy, +} Therefore, we can change subtraction operation to an addition operation by Chang; the sign of the subtrahend. Let us see how we can represent negative numbers in binay system. 1's Complement Representation The 1's complement of a binary number is the number that results when we change al 1's to zeros and the zeros to ones, Dd Example 3.1: Find 1's complement of (1 1 0 1)>. Solution: 1 1 9 1 © number 9 0 1 0 € 1's complement => Example 3.2: Find 1's complement of 1011 1001. Solution: 101 11 0 0 1 number 01000110 1's complement 2’s Complement Representation The 2's complement is the binary number that results when we add 1 to the 1%, complement. It is given as 2's complement = 1’s complement + 1 The 2’s complement form is used to represent negative numbers. => Example 3.3: Find 2's complement of (1 0 0 1)>. Solution : 1001 number 0110 1’s complement + 1 o1i1i 2's complement wa> Example 3.4: Find 2's complement of (1010 001 1),. Solution : 1010 0011 number 0101 1100 t's complement + 1 0101 1101 2's complement Let us see the subtraction of binary number using 1's complement and 2's complement number representations. Addition of 28 and - 15: + 0 1 4 1 0 0 (28); Sign extension 1 1 0 0 0 0 (-15) 19 a Cany > 1 #0 ) 1 1 0 0 1 Add end-around carry 0 o 1 1 0 1 (13) 46 Case 3 (Greater Negative) : Add (-28)1o and (15)49 We have (011100). — (28);9 and (01111). > (15)o (100011). > (—28),9 Addition of (- 28) and 15 1 0 0 0 1 1 (-28),9 * Sign 4+ 0 0 1 | 1 1 (15)19 extension 1 1 0 0 1 0 (=13)19 Result is in 1's complement form Verification: 10 40 Case 4 (Both Negative) : Add (- 28),) and (- 15)49 We have (011100), —» (28),) and (01111), —> (15),5 (10000), —> 1's complement of 15 (100011), — 1's complement of 28 Addition of (- 28) and (- 15): Sign-extension + 14 1 0 0 0 1 1 + Sign-extension -» 1 1 1 0 0 0 0 Carry 1 1 0 1 0 0 1 1 L 1 Add end-around carry 1 10) 1 0 1 0 0 (~ 43) Result is in 18 complement form Verification: 1 0 1 Le} 4 9 0 sO As BO a4 0 VPA oy MAB) ote : e Here, the magnitude of greater number is 5-bit; however, the magnitude of the result is 6-bit. Therefore, the numbers are sign-extended to 7-bits. e For proper result we suggest to use 1 sign-bit extension to the number having greater magnitude and represent the number having smaller magnitude with extended number of bits.