reshown by
2,116 views
1 votes
1 votes

I have little confusion about r's complement. See the following examples:

eg1) calculate F's compl. of (2BFD) is?

Solution : here we are calculating as FFFF - 2BFD= D402.

eg 2) Given that (E0B)16−(ABF)16=Y. 
The radix 8’s compliment of Y is ?

Solution: 

(EOB)16 - (ABF)16 =(34C)16

(34C)16 =(1514)8

for 7's complement (7777)8 - (1514)8 =(6263)8

for 8's complement (6263)8 +1 =(6264)8

My question are:

 (i)why we haven't use 8888 - (1514)8 

(ii) when  we use   (a) r's complement - N(as mentioned in example 1 ) (b) when we use (r-1)'s compl + 1 (as mentioned in above example 2 )? 

reshown by

1 Answer

Best answer
5 votes
5 votes
i) $(r-1)'s$ complement of $N =r^n- r^{-m}-N$

$n$ is no of digits in integer part and $m$ is no of digits in fractional part.

so, for $m=0$

$(r-1)'s$ complement of $N =r^n- 1-N$

$r^n- 1 =$ biggest $n$ digit number in base $r$

for example, n=4

for $r= 10$, $10^4- 1=(9999)_{10}$

for $r=2$, $2^4- 1=(1111)_2$

for $r=8$, $8^4- 1=(7777)_8$

for $r=16$, $16^4- 1=(FFFF)_{16}$

ii) $(r-1)'s$ complement of $N = r^n-1-N$

$r's$ complement of $N = r^n-N$

that is, also we can say $r's$ complement of $N = (r-1)'s$ complement $+1$.

in both cases, result will same,  it's all your choice.

if we use $r^n-N$, we need to subtract N from smallest $n+1$ digit number ($r^n$) in base r.

if we use $(r-1)'s$ complement $+1$, then for  $r^n-1-N$, we need to subtract N from largest $n$ digit number ($r^n-1$) in base r.

Second way is fast in terms of calculations as I feel.
selected by

Related questions

5 votes
5 votes
0 answers
1
Anjan asked Jan 26, 2018
1,261 views
10's complement of $5690$10's complement of $(5690)_8$8's complement of $(6250)_8$8's complement of $(6250)_{16}$
4 votes
4 votes
2 answers
4
Sanjay Sharma asked Nov 22, 2017
2,616 views
The values of P,Q,R, if 47Q80 is the 10's c complement of RPRP0 are a)4, 3, 2 b) 5,4,4 c)3,4,5 d)2,4,5