Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 14 - 2609_Logiccode
P. 14

    OPERATIONS ON BINARY NUMBERS

                      We can perform various operations on binary numbers. Let's discuss binary addition and binary
                      subtraction in detail.

                      BINARY ADDITION
                      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 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)

                      For example, let us add the binary numbers (101111)  and (10111) .
                                                                           2
                                                                                       2
                                                                            ____
                                                          1   1   1  1  1         Carry bits
                                                          1   0  1  1  1  1
                                                      +       1   0  1  1  1

                                                      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 binary subtraction:

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

                                                1                 1                    1 – 1 = 0

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

                                                          0    0    0     1

                       12   Premium Edition-VII

| 9 10 11 12 13 14 15 16 17 18 19 |