Page 51 - Cs_withBlue_J_C11_Flipbook
P. 51

An integer number 67 is represented as 8-bit binary number 01000011. -67 will be represented in 1’s complement
                 notation as 10111100 just by flipping 0’s and 1’s.

                                      +67     0       1      0      0       0      0      1       1
                                      -67     1       0      1      1       1      1      0       0
                                                         One’s complement notation
                                                                              n
                 For an ‘n’ bit number, one’s complement notation can represent 2 - 1 numbers in the range from -2 (n-1)  - 1 and
                 +2 (n-1)  - 1.

                 The range for different bit fields is represented in the following tabular form:

                                               Bit notation            Range for 1's complement numbers
                                                    4                             -7 to +7
                                                    8                           -127 to +127
                                                   16                         -32767 to +32767


                                                                Definition

                      One’s complement representation of a binary negative number is obtained by changing 0 bit to 1 and 1 bit to
                      0 starting from the rightmost LSB to the leftmost MSB. The representation of a binary positive number remains
                      unchanged.


                 Advantage of One’s complement method:
                 •  Binary addition and subtraction using signed and unsigned numbers can be done conveniently with this method.

                 Disadvantages of One’s complement method:
                 •  It is an unconventional way of representing signed integers.
                 •  Ambiguous representation of 0. Considering 8-bit byte, +0 is represented as 00000000 whereas -0 as 11111111. This
                   becomes inconvenient for digital devices to interpret.


                         Note: The method has been described in detail in Chapter 1 of this book.


                 Example 1: Find the 1’s complement representation of -17 expressed in 8-bit notation.
                 Binary equivalent of +17 is: 00010001

                 One’s complement of -17 is: 11101110
                 Example 2: Find the 1’s complement representation of -0 expressed in 8-bit notation.
                 Binary equivalent of +0 : 0000 0000

                 One’s complement of -0 : 1111 1111

                 2.1.3 Two’s Complement Notation
                 The binary equivalent of integer number 67 is 01000011. Its 1’s complement obtained by toggling 0 and 1 is 10111100.
                 2’s complement will be 10111100 + 1 = 10111101.

                                      +67     0       1      0      0       0      0      1       1
                                      -67     1       0      1      1       1      1      0       1
                                                         Two’s complement notation



                                                                                                                        49
                                                                                                            Encoding    49
   46   47   48   49   50   51   52   53   54   55   56