Page 89 - Bebop to The Boolean Boogie An Unconventional Guide to Electronics Fundamentals, Components, and Processes
P. 89

70    ChapterEight

                Binary Subtraction
                    Unsigned binary numbers may be subtracted from each other using an
                identical process to that used for decimal subtraction. However, for reasons of
                efficiency, computers rarely perform subtractions in this manner; instead, these
                operations are typically performed by means of complement techniques.
                    There are two forms of complement associated with every number system,
                the radix complement and the diminished radix complement, where radix refers to
                the base of the number system. Under the decimal (base-10) system, the radix
                complement is also known as the tens complement and the diminished radix
                complement is known as the nines complement. First, consider a decimal sub-
                traction performed using the nines complement technique-a  process known
                in ancient times as “Casting out the nines” (Figure 8-3).

              Standard subtraction      Nines complement equivalent
                                      r----------------
                                                                                   1
                   6   4  7           I     999                        647          I
                                                                                    I
               -283                   1-283                     +      716  I
                                      I                                             I
               =364                   I=716                     =  1363
                                      1    -
                                      I                             - 1
                                      I    Takenines                   364  I

                                      I    complement               -I
                                      I                           Add nines comple-  I
                                      I                            ment to minuend  I


                           Figure 8-3. Nines complement decimal subtraction

                    The standard way of performing the operation would be to subtract the
                subtrahend (283) from the minuend (647)) which, as in this example, may
                require the use of one or more borrow operations. To perform the equivalent
                operation in nines complement, each of the digits of the subtrahend is first
                subtracted from a 9. The resulting nines complement value is added to the
                minuend, and then an end-around-carry operation is performed. The advantage
                of the nines complement technique is that it is never necessary to perform a
                borrow operation.2


           2 This made this technique extremely popular in the days of yore, when the math skills of  the
            general populace weren’t particularly high.
   84   85   86   87   88   89   90   91   92   93   94