COMPLEMENTS: | Readstall

COMPLEMENTS:

11-12-18 Gudditi Naganjaneyulu 0 comment

COMPLEMENTS:

Definition: Complements are used to reduce the subtraction complications and for logical manipulation. When the value of the base ’r’ is substituted in the name, the two types are referred to as the 2’s and 1’s complements for binary numbers and the 10’s and 9’s complement for decimal numbers. The two types of complement are

1) r’s complement

2)(r-1)’s complement

(r’s) complement: It includes 10’s complement for decimal number and 2’s complement for binary number. it can be defined by 2n-N for N≠0.

   Here   r is radix of system number.

   n is number of digits given in the specified number.

   N is given number.

The complement of the complement is rn– (rn-N) =N giving back the original number.

Eg:

  • 2389-decimal

     n=4   N=2389   r=10

     rn -N=(10)4-2389

             =10000-2389

             =7611

  • 101100-Binary

  n=6   N=101100   r=2

  2n-N=26-101100

           =64-101100

Convert ‘64’ into binary form

             i.e;    1000000

                       =1000000-101100

                       =010100

Additional information

Binary addition                                         Binary subtraction

0+0=0                                                      0-0=0

0+1=1                                                        0-1=1

1+0=1                                                       1-0=1

1+1=10                                                     1-1=0

1+1+1=11

(r-1)’s complement: It includes 9’s complement for decimal number and 1’s complement for binary numbers. It can be defined as (rn-1) – N where   n is no. of digits

    N is given number

If r=2, 1’s   complement (:- r-1=2-1=1)

If r=10, 2’s  complement (:- r-1=10-1=9)

The (r-1)’s complement of octal or hexadecimal numbers are obtained by subtracting each digit from 7 or F (decimal 15) respectively.

Eg:

 0001111-binary

          r=2-1=1        n=7    N=0001111

           (rn-1) – N

          = (27-1)-0001111

          = (128-1)-0001111

         = 1110000

Note:- In binary system the 1’s complement of any number is the complement of given number means 0’s will be specified as 1’s and 1’s will be specified as 0’s.

Eg:

        546700-decimal

        r=10      n=6   N=546700

 (rn-1) – N

= (106-1)-546700

= (1000000-1)-546700

= 999999-546700

=453299

To find 9’s complement for 0.3267

Note:-  For finding the (r-1)’s complement of floating numbers we are considering the formula (1-rn)-N

Where   r=radix of the number system

               n= no. of digits after decimal point

               N=given number

        = 1-10-4-0.3267

= 1 -1/1000-0.3267

= 10000-1-3267/1000

= 9999-3267/10000

= 6732/10000=0.6732

Note:- If the number contains both integer value and exponent value, to find r’s complement use the formula rn-r-n1-N

        Where    r=radix of number system

                        n=no. of digits in integer part

                       n1=no. of digits in exponent part

                        N= given number

Eg:          25.639

        r=10        n=2  n1=3    N=25.639

           rn-r-n1-N

        = (10)2-(10)-3-25.639

= 100-1/1000-25.639

= 100000-1-25.639/1000

= 99999-25639/1000

= 74360/1000

= 74.360

 

 

 



Leave a reply