Number Systems: Module-1:Lecture-4
Number Systems: Module-1:Lecture-4
Module-1:Lecture-4
Number Systems
CONTENTS
Module-1 (Part-1)
Number Systems 2
CONTENTS
Lecture-4
❖ (b-1)’s Complement
▪ 1’s Complement
▪ 9’s Complement
❖ b’s Complement
▪ 2’s Complement
▪ 10’s Complement
Number Systems 3
COMPLEMENT OF NUMBERS
✓ In general, complements are used to simplify the subtraction operation and for logical
manipulation.
✓ There are two types of complement method in any base-b number system.
▪ b’s Complement (Radix Complement)
▪ (b-1)’s Complement (Diminished Radix Complement)
✓ In base-2 number system
▪ 2’s complement
▪ 1’s complement
✓ In base-10 number system
▪ 10’s complement
▪ 9’s complement
Number Systems 4
DIMINISHED RADIX [(b-1)’s] COMPLEMENT
✓ If a number N having n digits with base b, then the (b-1)’s complement is given by
𝒃𝒏 − 𝟏 − 𝑵
✓ For binary number, it is 1’s complement and can be represented as
𝟐𝒏 − 𝟏 − 𝑵
✓ For Example: 1’s complement of (10101)2
⇒ 𝟑𝟐 − 𝟏 − 𝟏𝟎𝟏𝟎𝟏 𝟐
Number Systems 5
DIMINISHED RADIX [(b-1)’s] COMPLEMENT
Note:
✓ The 1’s complement of a binary number can be obtained by changing each 0’s to 1’s and
each 1’s to 0’s.
✓ For example: 1’s complement of (11101)2
1 1 1 0 1
0 0 0 1 0
Number Systems 6
DIMINISHED RADIX [(b-1)’s] COMPLEMENT
𝟏𝟎𝒏 − 𝟏 − 𝑵
✓ For Example: 9’s complement of (54230)10
⇒ 𝟏𝟎𝟎𝟎𝟎𝟎 − 𝟏 − 𝟓𝟒𝟐𝟑𝟎
⇒ 𝟗𝟗𝟗𝟗𝟗 − 𝟓𝟒𝟐𝟑𝟎
⇒ 𝟒𝟓𝟕𝟔𝟗
Number Systems 7
DIMINISHED RADIX [(b-1)’s] COMPLEMENT
Note:
✓ The 9’s complement of a decimal number can be obtained by subtracting each digit from 9.
✓ For example: 9’s complement of (12345)10
9 9 9 9 9
−1 2 3 4 5
8 7 6 5 4
Number Systems 8
RADIX (b’s) COMPLEMENT
✓ If a number N having n digits with base b, then the b’s complement is given by
𝒃𝒏 − 𝑵 = 𝒃𝒏 − 𝟏 − 𝑵 + 𝟏 = (b-1)’s Complement + 1
𝟐𝒏 − 𝑵
✓ For Example: 2’s complement of (10111)2
1’s complement of (10111)2 = (01000)2
𝟐𝟓 − 𝟏𝟎𝟏𝟏𝟏 𝟐
2’s complement of (10111)2
⇒ 𝟑𝟐 − 𝟏𝟎𝟏𝟏𝟏 𝟐
= 1’s complement of (10111)2 + 1
⇒ 𝟏𝟎𝟎𝟎𝟎𝟎 𝟐 − 𝟏𝟎𝟏𝟏𝟏 𝟐 ⇒ 𝟎𝟏𝟎𝟎𝟏 𝟐 = (01000)2 + 1 = (01001)2
Number Systems 9
RADIX (b’s) COMPLEMENT
Number Systems 10
RADIX (b’s) COMPLEMENT
Note:
✓ The 2’s complement of a binary number can be obtained by leaving the least significant 0’s
and the first 1 unchanged and then remaining bits, replace 1’s with 0’s and 0’s with 1’s.
1 1 1 0 1 0 0 1 0 0 0 0 0
unchanged unchanged
0 0 0 1 1 0 0 1 0 0 0 0 0
Number Systems 11
RADIX (b’s) COMPLEMENT
𝟏𝟎𝒏 − 𝑵
✓ For Example: 10’s complement of (54230)10
Number Systems 12
RADIX (b’s) COMPLEMENT
Note:
✓ The 10’s complement of a decimal number can be obtained by leaving the least significant
0’s unchanged and the first least non-zero element should be subtracted from 10 and other
digits from 9.
✓ For example: 10’s complement of (2860010)10
2 8 6 0 0 1 0
unchanged
9 9 9 9 9 10 0
− 2 8 6 0 0 1 10’s complement of
(2860010)10 = (7139990)2
7 1 3 9 9 9 0
Number Systems 13
SUBTRACTION WITH COMPLEMENT
✓ In digital hardware, complement method for subtraction provides more efficient results
compared to borrow concept method.
✓ Here, the subtraction is pursued for unsigned numbers using the following method
▪ Subtraction of unsigned numbers with b’s Complement
▪ Subtraction of unsigned numbers (b-1)’s Complement
Number Systems 14
SUBTRACTION WITH b’s COMPLEMENT
2. If M ≥ N, the sum will produce an end carry bn, which can be discarded; what is left is the
result M - N.
3. If M < N, the sum does not produce an end carry and is equal to bn - (N - M), which is the
b’s complement of (N - M). To obtain the answer in a familiar form, take the b’s
complement of the sum and place a negative sign in front.
Number Systems 15
SUBTRACTION WITH b’s COMPLEMENT
Example-1:
✓ Using 2’s complement, subtract (101111)2 − (100110)2.
Step -2: Here M>N, hence, the result is (101111)2 − (100110)2 = (001001)2
Number Systems 16
SUBTRACTION WITH b’s COMPLEMENT
Example-2:
✓ Using 2’s complement, subtract (100)2 − (110000)2.
Step -2: Here M<N, hence, the result is obtained by taking the 2’s complement of sum with a
negative sign in front.
(100)2 − (110000)2 = −[2’s complement of (010100)2] = −(101100)2
Number Systems 17
SUBTRACTION WITH b’s COMPLEMENT
Example-3:
✓ Using 10’s complement, subtract 52532 − 3250.
Step -2: Here M>N, hence, the result is 52532 − 3250 = 49282
Number Systems 18
SUBTRACTION WITH b’s COMPLEMENT
Example-4:
✓ Using 10’s complement, subtract 1020 − 2056.
Number Systems 19
SUBTRACTION WITH (b-1)’s COMPLEMENT
2. If M ≥ N, the sum will produce an end carry bn. To obtain the result, remove the end
carry and add 1 to the sum which also termed as end around carry.
3. If M < N, the sum does not produce any carry. To obtain the answer in a familiar form,
take the (b-1)’s complement of the sum and place a negative sign in front.
Number Systems 20
SUBTRACTION WITH (b-1)’s COMPLEMENT
Example-1:
✓ Using 1’s complement, subtract (101111)2 − (100110)2.
1 1 1 1 1
1
Solution: Here, M = (101111)2 and N = (100110)2 1 0 1 1 1 1
+ 0 1 1 0 0 1
1’s complement of N = (011001)2 ---------------------
1 0 0 1 0 0 0
Step -1: Add M with 1’s complement of N
End Around Carry
+ 1
---------------------
0 0 1 0 0 1
Step -2: Here M>N, hence, the result is (101111)2 − (100110)2 = (001001)2
Number Systems 21
SUBTRACTION WITH (b-1)’s COMPLEMENT
Example-2:
✓ Using 1’s complement, subtract (100)2 − (110000)2.
Step -2: Here M<N, hence, the result is obtained by taking the 1’s complement of sum with a
negative sign in front.
(100)2 − (110000)2 = −[1’s complement of (010011)2] = −(101100)2
Number Systems 22
SUBTRACTION WITH (b-1)’s COMPLEMENT
Example-3:
✓ Using 9’s complement, subtract 52532 − 3250.
1 1 1
Solution: Here, M = 52532 and N = 3250 5 2 5 3 2
+ 9 6 7 4 9
9’s complement of N = (99999 − 03250)
-------------------
= 96749 1 4 9 2 8 1
End Around Carry
Step -1: Add M with 9’s complement of N + 1
-------------------
4 9 2 8 2
Step -2: Here M>N, hence, the result is 52532 − 3250 = 49282
Number Systems 23
SUBTRACTION WITH (b-1)’s COMPLEMENT
Example-4:
✓ Using 9’s complement, subtract 1020 − 2056.
Number Systems 24
ASSIGNMENT QUESTIONS
1. Using 1’s, 2’s, 9’s and 10’s complement perform the following
(a) 23-56
(b) 98-34
Number Systems 25