Page 32 - Touhpad Ai
P. 32

Example 1: 11101-10100
                   1  1  1  0  1
                 -  1  0  1  0  0
                   0  1  0  0   1

              The subtraction of 11101 and 10101 is 1001.

              Example 2: 11011 – 1110
                    0  10  10
                     1  1  0  1  1
                  -  0  1  1  1  0
                    0  1  1  0   1

              The subtraction of 11011 and 1110 is 1101.

              Binary Multiplication
              Binary multiplication uses the following rules:
              u  0 × 0 = 0
              u  0 × 1 = 0
              u  1 × 0 = 0
              u  1 × 1 = 1
              The steps to perform binary multiplication are as follows:
              1.  Multiply each bit of the first number by each bit of the second number.

              2.  Shift partial products one place left for each higher bit in the multiplier.
              3.  Add all partial products using binary addition rules.
              Example 1: 101 × 10

                     1  0  1
                     ×  1  0
                     0  0  0 (1 0 1 × 0)
                  +  1  0  1      (1 0 1 × 1, shifted)

                    1  0  1  0

              The binary multiplication of 101 and 10 is 1010.
              Example 2: 111 × 11

                      1  1  1
                      ×  1  1
                      1  1  1 (1 0 1 × 0)
                   +  1  1  1      (1 0 1 × 1, shifted)
                   1  0  1  0  1

              The binary multiplication of 111 and 11 is 10101.

              Binary Division
              Binary division is similar to long division in decimal numbers.
              The steps to perform binary division are as follows:

              1.  Compare the leftmost bits of the dividend with the divisor.

                 30     Touchpad Artificial Intelligence - XI
   27   28   29   30   31   32   33   34   35   36   37