COMPLEMENT
Ø It is a method.
Ø It is a rules or
producer.
Ø Complements are
used in digital computer for simplifying the subtraction and for logical
calculation.
Ø There are two
types of complements for each base is r.
1. (r-1)’s
complement
2. r’s
complement
1. (r-1)’s
complement :-
Given a number n is base,digit n (r-1)’s complement of n is defined as (rn-1)-n.
2. r’s complement:-
given a number n
is base r a nd digit
n,r’s complements n defined as (rn-n)=(rn-1)-n+1
=(r-1)’s complement+1.
Ø In the case of decimal number base is equal +10.
There are complements
1. 9’s complement
2. 10’s complement
1. 9’s complement-
9’s complement defined as (10n-1)-N where n= digit
N= number
For
example:- 1. (2356)10
9’s complement
N= 2356
n= 4
r =10
9’s complement = (rn-1)-N
= (104-1)-2356
= (10000 -1) – 2356
= 9999-2356
= 7643 Ans
10’s complement =( rn-N)
= (104-2356)
= (10000 –
2356)
= 7644 Ans
2.
(4678)10
N= 4678
n= 4
r = 10
9’s complement = as complement + 1
= 5321+1
= 5322
Ø In the case of binary number:-
1. 1’s complement
2. 2’s complement
1. 1’s complement :-
1’s complement as defined as (2n-1)-N.
n=
digit
N=
number
r =
base or radix.
2. 2,s
complement :- 2,s complement as defined as (2n-1)-n
n=digit
N=number
Ex:- 1. (1010)2
N= 1010
n= 4
r=2
1, complement = (rn-1)-n
= (24-1)-1010
=(16-1)-1010
= 15-1010
= 1111-1010
= 0101
2,s complement (rn-n)
=(24-1010)
=(16-1010)
=(16-10)
= 6
= 0110
2. (11001)2
= n= 11001
= n= 5
= r=2
1s
complement – (rn-1)-n
=(25-1)-11001
=(32-1)-11001
= 31-25
=6
=00110
2s complement = 1,s
complement +1
= 00110+1
= 00111 ans
No comments:
Post a Comment