Page 40 - ComputerScience_Class_11
P. 40

1.5.2 Hexadecimal Subtraction
              Hexadecimal subtraction can be done by following three different methods:
              •  Borrow method
              •  15’s complement method
              •  16’s complement method


              Hexadecimal Subtraction by Borrow Method
              Hexadecimal subtraction can be performed by borrow method with the same way as decimal subtraction.
              The steps to be followed are:
              1.  Subtract each digit of minuend and subtrahend starting from rightmost column (LSB).
              2.  If the minuend digit is smaller, borrow 16 from the previous digit.

              Example 1:  (FCA)  - (94F) 16
                              16
              Answer:                               +16
                                         B (11)
                               F (15)    C (12)    A (10)
                          -      9         4       F (15)
              (67B) 16           6         7         B


              Example 2: (17A.62)  - (B3.D) 16
                                16
              Answer:                +16              +16
                              1   0   7     A  9  .    6      2
                          -         B (11)   3    .  D (13)
                                      C      6    .    9      2

              (C6.92) 16


              Hexadecimal Subtraction by 15’s Complement Method
              15’s complement of a number is obtained by subtracting all bits from 15. For example, the 15’s complement of A5B2  is:


                                                           15     15    15    15
                                                     -      A     5     B      2

                                                            5     A     4      D
              The steps to be followed are:
              1.  Make the number of digits the subtrahend equal to minuend by adding leading 0’s in the integer part of the
                 subtrahend and trailing 0’s in the fractional part if required.
              2.  Find the 15’s complement of the subtrahend.
              3.  Add this answer to the minuend.
              4.  From  the  final  result,  add  the  left  most  carry  (MSB)  with  the  right  most  digit  (LSB)  to  get  the  answer  (when
                 minuend > subtrahend).
              5.  Convert the result to its 15’s complement and place 1 as a sign bit in MSB or add a -ve sign in answer (when
                 minuend < subtrahend).










                   38  Touchpad Computer Science (Ver. 3.0)-XI
   35   36   37   38   39   40   41   42   43   44   45