Page 1037 - The Mechatronics Handbook
P. 1037

TABLE 36.10  Conversions Between Systems Where
                                                       One Base Is an Integer Power of the Other Base
                                                       (a) Conversion from high base to lower base
                                                         B2. C5 16  = 1011  0010  .1100  0101 2
                                                         62.75 8  = 110  010  .111  101 2
                                                       (b) Conversion from lower base to high base
                                                         11  0010  0100.0001  1100  01 2  = 324.1C4 16
                                                         10  110  001.011111  01 2  = 261.372 8

                                   Conversion to base 2 from a base, which is an integer power of 2, can be most simply accomplished
                                 by independent conversion of each successive digit, as illustrated in Table 36.10(a). Inversely, conversion
                                                   k
                                 from base 2 to a base 2  can be simply accomplished by grouping the bits into sets of k bits, each starting
                                 with the least significant bit for the integer portion and with the most significant bit for the fraction
                                 portion, as shown by the examples in Table 36.10(b).


                                 36.7 Complements

                                 Each number system has two conventionally used complements:

                                                                                   RC    n
                                                           radix complement of N =  N  =  R –  N
                                                    reduced radix complement of N =  N rC  =  N  RC  –  1

                                 where R is the radix and n is the number of digits in the number N. These equations provide complements
                                 for numbers having the magnitude N.
                                   A positive number can be represented by a code in the two character machine language alphabet, 0
                                 and 1, which is simply the positive number expressed in the base 2, that is, the code for the number is
                                 the number itself. A negative number requires that the sign be coded in the binary alphabet. This can
                                 be done by separately coding the sign and the magnitude or by coding the negative number as a single
                                 entity. Table 36.11 illustrates four different code types for negative numbers. Negative numbers can be
                                 represented in the sign magnitude form by using the leftmost digit as the code for the sign (0 for + and
                                 1 for -) and the rest of the digits as the code for the magnitude. Complements and biasing provide the
                                 means for coding the negative number as a single entity instead of having a discrete separate coding for
                                 the sign. The use of complements provides for essentially equal ranges of values for both positive and
                                 negative numbers. The biased representation can also provide essentially equal ranges for positive and
                                 negative values by choosing the biasing value to be essentially half of the largest binary number that could
                                 be represented with the available number of digits. The bias code is obtained by subtracting the biasing
                                 value from the code considered as a positive number, as shown in the rightmost column of Table 36.11.
                                   Complements enable subtraction to be done by addition of the complement. If the result fits into
                                 the available field size the result is automatically correct. A diagnostic must be provided to show that
                                 the result is incorrect if overflow occurs, that is, the number does not fit in the available field. Table
                                 36.12 illustrates arithmetic operations with and without complements. The two rightmost columns
                                 illustrate cases where the result overflows the 3-b field size for the magnitude. The overflow condition
                                 can be represented in terms of two carry parameters:

                                     • C 0 , the output carry from the leftmost digit position
                                     • C 1 , the output carry from the second leftmost digit position (the output carry from the magnitude
                                       field if sign magnitude representation is used)
                                 If both of these carries are coincident (i.e., have the same value) the result fits in the available field and,
                                 hence, is correct. If these two carries are not coincident, the result is incorrect.

                                 ©2002 CRC Press LLC
   1032   1033   1034   1035   1036   1037   1038   1039   1040   1041   1042