158x Filetype PPT File size 0.43 MB Source: ualr.edu
Complements • Subtraction of numbers requires a different algorithm than addition. • Adding a complement of a number is equivalent to subtraction. • We will discuss two complements: Diminished Radix Complement Radix Complement • Subtraction will be accomplished by adding a complement. SYEN 3330 Digital Systems Chapter 5-2 Page 2 Diminished Radix Complement Given a number in Base having digits, the ( )'s N r n r-1 complement (called the Diminished Radix Complement) is defined as: ( n ) - r - 1 N Example: For = 10, = 1234 , = 4 (4 digits),we have: r N 10 n ( n - ) = 10,000 -1 = 9999 r 1 10 The 9's complement of 123410 is then: 999910 - 123410 = 876510 SYEN 3330 Digital Systems Chapter 5-2 Page 3 Binary 1's Complement For = 2, = 01110011 , = 8 (8 digits), we have: r N 2 n ( n - ) = 256 -1 = 255 or 11111111 r 1 10 2 The 1's complement of 011100112 is then: 111111112 - 011100112 ---------------- 100011002 NOTE: Since the 2n-1 factor consists of all 1's and since 1 - 0= 1 and 1 - 1 = 0, forming the one's complement consists of complementing each individual bit . SYEN 3330 Digital Systems Chapter 5-2 Page 4 Radix Complement Given a number in Base having digits, the 's N r n r complement (called the Radix Complement) is defined as: n r - N for N 0 and 0 for N = 0 Note that the Radix Complement is obtained by adding 1 to the Diminished Radix Complement. Example: For r = 10, N = 123410, n = 4 (4 digits), we have: n = 10,000 r 10 The 10's complement of 123410 is then 10,000 - 1234 = 8766 or 8765 + 1 (9's complement plus 1) 10 10 10 SYEN 3330 Digital Systems Chapter 5-2 Page 5 Binary 2's Complement For = 2, = 01110011 , = 8 (8 digits), we have: r N 2 n ( n ) = 256 or 100000000 r 10 2 The 2's complement of 01110011 is then: 2 1000000002 - 01110011 2 ---------------- 100011012 Note that this is the 1's complement plus 1. SYEN 3330 Digital Systems Chapter 5-2 Page 6
no reviews yet
Please Login to review.