complements are one of the most important aspects of arithmetic operations in digital systems. As we are pretty much familiar with the fact that SUBTRACTION is nothing but a complementED ADDITION, we can carry out a subtraction operation by using the following steps:
Complement of any data is needed primarily to perform SUBTRACTION operations. The following example better clarifies the concept:
Suppose we have to calculate: a = (10 - 6)
We can do it via any of the two ways stated below:
In Digital Architecture Complements are of following two types:
Since complements are of two types, they are significantly different for different number systems. Consider the following table:
Basically in a number system, r represents RADIX or simply the BASE. Thus r's complement means to the complement w.r.t. BASE, similarly (r-1)'s complement means to the complement w.r.t. (BASE-1).
legends | (r-1)'s | r's |
---|---|---|
Formula | ||
Examples | ||
Decimal Numbers | ||
Octal Numbers | ||
Hexadecimal Numbers | ||
Decimal Numbers |
Subtract every digit in the number from (r-1) or (base-1). In contrast:
Retain every LSB zero, then subtract the first non-zero digit from r or Base and finally subtract every digit from (r-1) or (Base-1). In Contrast: