Page 27 - iPro_trackGPT_V5_Class7
P. 27

Example 1: Convert (1111)  to a decimal number.
                                             2
                                                                   0
                                                         1
                                                2
                                       3
                              =  1 × 2  + 1 × 2  + 1 × 2  + 1 × 2
                              =  8 + 4 + 2 + 1
                              =  15
                              (1111)  = (15)
                                    2       10
                 Example 2: Convert (10111)  to a decimal number.
                                              2
                                                                   1
                                      4
                                                         2
                                                3
                              =  1 × 2  + 0 × 2  + 1 × 2  + 1 × 2  + 1 × 2  0
                              =  16 + 0 + 4 + 2 + 1
                              =  23
                              (10111)  = (23)
                                      2       10
                    OPERATIONS ON BINARY NUMBERS

                 Binary Addition

                 Binary addition is like decimal addition. When the sum is more than 1, like when adding 10 or 11
                 in binary, you carry 1 over to the next position on the left. The rules for adding two binary digits
                 are given below:


                        X               Y                 X + Y
                        0               0               0 + 0 = 0

                        0               1               0 + 1 = 1

                        1               0               1 + 0 = 1
                        1               1          1 + 1 = 10 (carry 1)           1    1  1  1  1     _____  Carry bits

                                                                                  1    0  1  1  1  1
                 For example, let us add the binary numbers (101111)
                                                                         2     +       1  0  1  1  1
                 and (10111) .
                             2
                                                                               1  0    0  0  1  1  0
                 Binary Subtraction
                 In binary subtraction, the smaller binary number is subtracted from the larger one. The table
                 below illustrates how to subtract digit Y from digit X. If Y is greater than X, we borrow 1 from the
                 next higher position. When a binary digit of 0 borrows 1, it effectively becomes 2 (written as 10
                 in binary). The rules for subtracting two binary digits are given below:

                      X          Y                    X – Y
                      0          0                  0 – 0 = 0
                                                    0 – 1 = 1
                      0          1                                                       1    1
                                         (borrow 1, so that 10 – 1 = 1)                                _____
                      1          0                  1 – 0 = 1                       0  (10)  (10)  (10)      Borrow
                      1          1                  1 – 1 = 0                       1    0    0    0

                                                                                –        1    1    1
                 For example, let us  subtract the binary number (111)
                                                                           2
                 from (1000) .                                                      0    0    0    1
                             2

                                                                                              Number System      25
   22   23   24   25   26   27   28   29   30   31   32