sistema binario

sistema binario

THE FUNDAMENTAL OPERATIONS IN THE BINARY SYSTEM

BINARY OPERATIONS – SUM OF TWO NUMBERS

I leave you a link to the previous topic Introduction to the binary system. We will deal with sum, difference and multiplication for completeness. The division is beyond the scope of this article, and when we talk about two’s complement you will only use the sum. With R I have indicated the carry that occurs when both values are at 1. The carry must be immediately lined up in the column on the left, otherwise the result will not be correct. Once correctly lined up (right alignment) the sum is carried out bearing in mind that: (see table opposite)

0 + 0 = 0 R
1 + 0 = 1
0 + 1 = 1
1 + 1 = 0 1

OPERATION DONE

(1101)+ (001)= (1110)2

CARRY 1
1 1 0 1 +
0 0 1 =
RESULT
1 1 1 0

BINARY OPERATIONS – DIFFERENCE OF TWO NUMBERS

To correctly make the difference between two numbers, you must first of all line them up as seen in the addition and then remember that: (see table opposite)

0 0 = 0 R
1 0 = 1
0 1 = 1 1
1 1 = 0

Let’s see an example:

CARRY 1 1 1
1 0 0 1 0
1 1 0 1 =
RESULT
0 0 1 0 1

BINARY OPERATIONS – MULTIPLICATION BETWEEN TWO NUMBERS

To perform the multiplication between two numbers you must first know that: (see the table opposite)

0 x 0 = 0
1 x 0 = 0
0 x 1 = 0
1 x 1 = 1
  1. the two terms are lined up and a line is drawn.
  2. multiply each digit of the second factor by the first factor.
  3. you write the result of the first product and change line from time to time, remembering to leave an empty place under the first digit to the right of each result.
  4. I leave you a link if you want to learn more about the subject Binary operations

Let’s see an example:

1 1 1 x
0 0 1 =
——————————————-
  1   1   1    + 111×1
0   0   0         + 111×0
0 0   0              + 111×0
——————————————————–
0
0    1   1   1
RESULT

IN-DEPTH LINK