Page 93 - Engineering Digital Design
P. 93

64              CHAPTER 2 / NUMBER SYSTEMS, BINARY ARITHMETIC, AND CODES



                     (2) Represent each operand in BCD form.
                     (3) Carry out steps (1) through (4) of Algorithm 2.14. If the result is negative, the true
                     value is found by negation: [(resM/OiocJioc = (resultJeco- If the result is positive, that
                     result is the true value,


                    2.9.7 Floating-Point Arithmetic
                    Up to this point the arithmetic operations have involved fixed-point representation in which
                    all bits of a binary number were represented. In many practical applications the numbers may
                    require many bits for their representation. In Section 2.8 the floating-point number (FPN)
                    system was discussed for just that reason. Now it is necessary to deal with the arithmetic
                    associated with the FPN system, namely addition, subtraction, multiplication, and division.


                    FPN Addition and Subtraction Before two numbers can be added or subtracted one from
                    the other, it is necessary that they have the same exponent. This is equivalent to aligning
                    their radix points. From Eq. (2.17) for radix 2, consider the following two FPNs:

                                                  X = M x • 2 Ex

                    and

                                                            Ey
                                                  Y = M Y -2 .
                                                                      E
                    Now, if for example E x > E Y, then Y is represented as M' Y • 2 '?, where

                                                 •/-„, and E' Y = E Y + (E x - E Y) = E x,



                                                E
                                                                           Ex
                    so that X + Y = (M x + M Y)- 2 * or X - Y = (M x - M' Y)- 2 , etc. Here, M Y =
                    .f-if-2 • • • f-m originally, but is now adjusted so that the exponents for both operands are
                    the same. The addition or subtraction of the fractions M x and M' Y is carried out according
                    to Algorithm 2.8 or Algorithm 2.9, respectively.
                       Consider the following examples of FPN addition:
                    EXAMPLE 2.34 —Addition

                                                       10010001.100 2 =X
                                         145.500i 0
                                        +27.62510 ~* 00011000.101 2 =Y
                                         173.125,0

                       Comparing and equalizing the exponents E x and E Y gives

                                           145.500,0 = .10010001100 x 2 8
                                                                    8
                                            27.625 m = .00011011101 x 2 .
   88   89   90   91   92   93   94   95   96   97   98