Книга: Advanced PIC Microcontroller Projects in C

1.19 Multiplication of Binary Numbers

1.19 Multiplication of Binary Numbers

Multiplication of two binary numbers is similar to the multiplication of two decimal numbers. The four possibilities are:

0 ? 0 = 0

0 ? 1 = 0

1 ? 0 = 0

1 ? 1 = 1

Some examples follow.

Example 1.27

Multiply the two binary numbers 0110 and 0010.

Solution 1.27

Multiplying the numbers:

   0110
   0010
   ----
   0000
  0110
 0000
0000
-------
 001100
or 1100

In this example 4 bits are needed to show the final result.

Example 1.28

Multiply binary numbers 1001 and 1010.

Solution 1.28

Multiplying the numbers:

   1001
   1010
   ----
   0000
  1001
 0000
1001
-------
1011010

In this example 7 bits are required to show the final result.

Оглавление книги


Генерация: 0.081. Запросов К БД/Cache: 0 / 0
поделиться
Вверх Вниз