×

Index

Software Engineering Tutorial

Discrete Mathematics Tutorial

Digital Electronics Tutorial

r's and (r-1)'s Complement of Numbers

In this tutorial, we will learn about the r's complement and (r-1)'s complement of the numbers with the help of examples. By Saurabh Gupta Last updated : May 10, 2023

For a number system having its base/radix as r, we can define two types of complement for the corresponding number system which are as follows:

1) (r-1)'s complement

The (r-1)'s complement of a number in any number system with base r can be found out by subtracting every single digit of a number by r-1.

For Example: In the binary number system, the base is 2. Hence, its (r-1)'s i.e., (2-1 =1)'s complement can be obtained by subtracting each bit from 1, i.e., 1's complement for 001 can also be calculated by subtracting 001 from 111 which will be (111-001) = (110)2.

Similarly, in the octal number system, the base is 8 so its 7's complement can be calculated by subtracting each bit by 7, i.e., 7's complement for 347 in octal number system can be calculated by subtracting 347 from 777 which will yield (777 – 347) = (430)8.

2) r's complement

The r's complement of a non-zero number in any number system with base r can be calculated by adding 1 to the LSB of its (r-1)'s complement.

For Example: In binary number system, 2's complement of 001 can be calculated by adding 1 to the LSB of its 1'complement (i.e., 110 + 1) = (111)2.

Similarly, in octal number system, 8's complement of 347 can be calculated by adding 1 to the LSB of its 7'complement (i.e., 430 + 1) = (431)8.

9's and 10's complement in Decimal Number System

We already know that the decimal number system has its base as 10, As we have already discussed above, 9's complement of decimal number can be found out by subtracting its each by 9.

Example 1: Calculate 9's complement of (2457)10

Solution: 9999 – 2457 = (7542)10

Now, 10's complement of a decimal number can be calculated by adding 1 to the LSB of the 9's complement.


Example 2: Calculate 10's complement of (2457)10

Solution: 10's complement for (2457)10 is calculated by adding 1 to (7542)10 which is the 9's complement. Therefore, 10's complement of (2457)10 is (7543)10.




Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.