(r's) Complement :
The r's complement of an n-digit number N in base r is defined as r' - N for N * D and D for N = D. Comparing with the (r - I)'s complement, we note that the r's complement is obtained by adding I to the (r - I)'s complement since r' - N = [(r' - I) - N] + I. Thus the ID's complement of the decimal 2389 is 76ID + I = 7611 and is obtained by adding I to the 9' s complement value. The 2's complement of binary I01 I00 is 010011 + I = 0I0I00 and is obtained by adding I to the I's complement value.
Since ID' is a number represented by a I followed by n D's, then ID' - N, which is the ID's complement of N, can be formed also be leaving all least significant D's unchanged, subtracting the first nonzero least significant digit from ID, and then subtracting all higher significant digits from 9. The I0's complement of 246700 is 753300 and is obtained by leaving the two zeros unchanged, subtracting 7 from I0, and subtracting the other three digits from 9.
Similarly, the 2's complement can be formed by leaving all least significant 0's and the first I unchanged, and then replacing I's by 0's and 0's by I's in all other higher significant bits. The 2's complement of 1101 100 is 00I0I00 and is obtained by leaving the two low-order 0's and the first I unchanged, and then replacing I's by 0's and 0's by I's in the other four most significant bits.
In the definitions above it was assumed that the numbers do not have a radix point. If the original number N contains a radix point, it should be removed temporarily to form the r's or (r - I)'s complement. The radix point is then restored to the complemented number in the same relative position. It is also worth mentioning that the complement of the complement restores the number to its original value. The r's complement of N is r' - N. The complement of the complement is r' - (r' - N) = N giving back the original number.
Frequently Asked Questions
- DATA TYPES
- NUMBER SYSTEM
- CONVERSION - INTRODUCTION
- OCTAL AND HEXADECIMAL NUMBER CONVERSION
- OCTAL AND HEXADECIMAL NUMBER CONVERSION -2
- Error Detection Codes-2
- Register Transfer Language
- Register Transfer Language -2
- Register Transfer
- Register Transfer -2
- Bus and Memory Transfers
- Bus and Memory Transfers -2
- Three-State Bus Buffers
- Memory Transfer
- Binary Adder