Calculator 2 number system addition and subtraction. Addition of binary numbers. Converting integers and fractions from one number system to any other - theory, examples and solutions

Note:
You can perform actions only in one number system, if you are given different number systems, first translate all the numbers into one number system
If you work with a number system whose base is more than 10 and you have a letter in your example, mentally replace it with a number in the decimal system, perform the necessary operations and convert the result back to the original number system

Addition:
Everyone remembers how in elementary school we were taught to stack with a column, category with category. If, when adding in a digit, a number greater than 9 was obtained, we subtracted 10 from it, the result was recorded in the answer, and 1 was added to the next digit. From this, a rule can be formulated:

  1. It is more convenient to fold "in a column"
  2. Adding bitwise, if the digit in the digit\u003e is greater than the largest digit in the alphabet of the given number system, subtract the base of the number system from this number.
  3. The resulting result is written in the desired category
  4. Add one to the next digit
Example:

Add 1001001110 and 100111101 in Binary notation

1001001110

100111101

1110001011

Answer: 1110001011

Add F3B and 5A Hexadecimal

FE0

Answer: FE0


Subtraction: Everyone remembers how in elementary school we were taught to subtract a column from a category. If, when subtracting in the digit, a number less than 0 was obtained, then we "occupied" one from the most significant digit and added 10 to the desired digit, subtracted the desired one from the new number. From this, a rule can be formulated:

  1. It is more convenient to subtract in columns
  2. Subtracting bitwise if the digit in the digit< 0, вычитаем из старшего разряда 1, а к нужному разряду прибавляем основание системы счисления.
  3. Subtracting
Example:

Subtract binary 100111101 from 1001001110 in binary notation

1001001110

100111101

100010001

Answer: 100010001

Subtract 5A from F3B in hexadecimal notation

D96

Answer: D96

Most importantly, do not forget about the fact that you have only the numbers of this number system at your disposal, just do not forget about the transitions between the digit terms.
Multiplication:

Multiplication in other number systems is exactly the same as we used to multiply.

  1. It is more convenient to multiply by "column"
  2. Multiplication in any number system follows the same rules as in decimal. But we can only use the alphabet given by the number system
Example:

Binary multiply 10111 by 1101

10111

1101

10111

10111

10111

100101011

Answer: 100101011

Multiply F3B by the number A in hexadecimal notation

F3B

984E

Answer: 984E

Answer: 984E

Most importantly, do not forget about the fact that you have only the numbers of this number system at your disposal, just do not forget about the transitions between the digit terms.

Division:

Division in other number systems is exactly the same as we used to divide.

  1. It is more convenient to divide by "column"
  2. Division in any number system follows the same rules as in decimal. But we can only use the alphabet given by the number system

Example:

Divide 1011011 by Binary 1101

Split F 3 B to number 8 in hexadecimal notation

Most importantly, do not forget about the fact that you have only the numbers of this number system at your disposal, just do not forget about the transitions between the digit terms.

NON-POSITIVE

Non-positional number systems

Non-positional number systems were historically the first to appear. In these systems, the meaning of each digital symbol is constant and does not depend on its position. The simplest case of a non-positional system is the unit one, for which a single symbol is used to denote numbers, as a rule it is a line, sometimes a dot, which is always put in the number corresponding to the denoted number:

  • 1 - |
  • 2 - ||
  • 3 - |||, etc.

So this single character matters units, from which the required number is obtained by successive addition:

||||| = 1+1+1+1+1 = 5.

A modification of a unit system is a system with a base, in which there are symbols not only for designating a unit, but also for degrees of base. For example, if the base is 5, then there will be additional symbols to denote 5, 25, 125 and so on.

An example of such a base 10 system is the ancient Egyptian one, which arose in the second half of the third millennium BC. This system had the following hieroglyphs:

  • pole - units,
  • arc - tens,
  • palm leaf - hundreds,
  • lotus flower - thousands.

The numbers were obtained by simple addition, the order could be any. So, to designate, for example, the number 3815, three lotus flowers, eight palm leaves, one arc and five poles were drawn. More complex systems with additional signs - the old Greek, Roman. Roman also uses an element of the positional system - a large digit in front of a smaller one is added, a smaller one in front of a larger one is subtracted: IV \u003d 4, but VI \u003d 6, this method, however, is used exclusively to denote the numbers 4, 9, 40, 90, 400 , 900, 4000, and their derivatives by addition.

The New Greek and Old Russian systems used 27 letters of the alphabet as numbers, where they designated each number from 1 to 9, as well as tens and hundreds. This approach provided the ability to write numbers from 1 to 999 without repeating numbers.

In the old Russian system, special frames around the numbers were used to indicate large numbers.

As a verbal numbering system, non-positional is still used almost everywhere. Verbal numbering systems are strongly tied to the language, and their common elements mainly relate to the general principles and names of large numbers (trillion and above). The general principles underlying modern verbal numbering are harmful to the formation of a designation by adding and multiplying the meanings of unique names.

How do we add in decimal notation?

Let's remember how we add numbers in the usual way, in decimal.

The most important thing is to understand the discharges. Remember the alphabet of each SS and then it will become easier for you.

Binary addition is no different from decimal addition. The main thing to remember is that the alphabet contains only two numbers: 0 and 1. Therefore, when we add 1 + 1, we get 0, and we increase the number by 1 more place. Take a look at the example above:

  1. We begin to fold as we used to from right to left. 0 + 0 \u003d 0, so we write 0. Go to the next bit.
  2. We add 1 + 1 and get 2, but 2 is not in the binary number system, which means we write 0, and add 1 to the next digit.
  3. We get three units in this category, we add 1 + 1 + 1 \u003d 3, this figure also cannot be. So 3 - 2 \u003d 1. And add 1 to the next digit.
  4. We again get 1 + 1 \u003d 2. We already know that 2 cannot exist, so we write 0, and add 1 to the next bit.
  5. There is nothing more to add, so in the answer we get: 10100.

We have analyzed one example, decide the second yourself:

Just like in any other number systems, you must remember the Alphabet. Let's try to add an expression.

  1. As usual, we begin to fold from right to left. 4 + 3 \u003d 7.
  2. 5 + 4 \u003d 9. Nine cannot be, so we subtract 8 from 9, we get 1. And add 1 more to the next digit.
  3. 3 + 7 + 1 \u003d 11. Subtract 8 from 11, we get 3. And add one to the next digit.
  4. 6 + 1 = 7.
  5. There is nothing further to add. Answer: 7317.

Now do the addition yourself:

  1. We carry out actions already familiar to us and do not forget about the alphabet. 2 + 1 \u003d 3.
  2. 5 + 9 \u003d 14. Remember the Alphabet: 14 \u003d E.
  3. C \u003d 12. 12 + 8 \u003d 20. Twenty is not in hexadecimal notation. This means that we subtract 16 from 20 and get 4. And add one to the next digit.
  4. 1 + 1 = 2.
  5. There is nothing more to add. Answer: 24E3.

Subtraction in number systems

Let's remember how we do it in the decimal number system.

  1. We start from left to right, from the smallest category to the largest. 2 - 1 \u003d 1.
  2. 1 – 0 = 1.
  3. 3 - 9 \u003d? Three is less than nine, so we borrow one from the most significant digit. 13 - 9 \u003d 4.
  4. From the last digit, we took the unit for the previous action, so 4 - 1 \u003d 3.
  5. Answer: 3411.

  1. We start as usual. 1 - 1 \u003d 0.
  2. 1 – 0 = 1.
  3. One cannot be subtracted from 0. Therefore, we will take one category from the older one. 2 - 1 \u003d 1.
  4. Answer: 110.

Now decide for yourself:

  1. Nothing new, the main thing is to remember the alphabet. 4 - 3 \u003d 1.
  2. 5 – 0 = 5.
  3. We cannot immediately subtract 7 from 3, for this we need to borrow a unit from a higher order. 11 - 7 \u003d 4.
  4. Remember that we borrowed the unit earlier, 6 - 1 \u003d 5.
  5. Answer: 5451.

Let's take the previous example and see what the result is in hexadecimal. Same or different?

  1. 4 – 3 = 1.
  2. 5 – 0 = 5.
  3. We cannot immediately subtract 7 from 3, for this we need to borrow a unit from a higher order. 19 - 7 \u003d 12. Hexadecimal 12 \u003d C.
  4. Remember that we borrowed a unit earlier, 6 - 1 \u003d 5
  5. Answer: 5S51

Example for an independent solution:

Multiplication in number systems

Let's remember once and for all that multiplying by one in any number system will always give the same number.

  1. We multiply each digit by one, as usual from right to left, and we get the number 6748;
  2. 6748 is multiplied by 8 and we get the number 53984;
  3. We do the operation of multiplying 6748 by 3. We get the number 20244;
  4. Add all 3 numbers according to the rules. We get 2570988;
  5. Answer: 2570988.

In binary, multiplication is very easy. We always multiply by either 0 or one. The main thing is to add it carefully. Let's try.

  1. 1101 is multiplied by one, as usual from right to left, and we get the number 1101;
  2. We do this operation 2 more times;
  3. We add all 3 numbers carefully, remember about the alphabet, not forgetting about the ladder;
  4. Answer: 1011011.

Example for an independent solution:

  1. 5 x 4 \u003d 20. And 20 \u003d 2 x 8 + 4. We write the remainder of the division into a number - it will be 4, and keep 2 in mind. We carry out this procedure from right to left and get the number 40234;
  2. When multiplied by 0, we get four 0s;
  3. When multiplied by 7, we get the number 55164;
  4. Now add the numbers and get - 5556634;
  5. Answer: 5556634.

Example for an independent solution:

Everything is as usual, the main thing is to remember the alphabet. For convenience, translate alphabetic numbers into your usual number system, as multiply, translate back into an alphabetic value.

Let's analyze the multiplication by 5 of 20A4 for clarity.

  1. 5 x 4 \u003d 20. And 20 \u003d 16 + 4. We write the remainder of the division into a number - it will be 4, and keep 1 in mind.
  2. And x 5 + 1 \u003d 10 x 5 + 1 \u003d 51.51 \u003d 16 x 3 + 3. We write the remainder of the division into a number - it will be 3, and keep 3 in mind.
  3. When multiplied by 0, we get 0 + 3 \u003d 3;
  4. 2 x 5 \u003d 10 \u003d A; As a result, we get the A334; We do this procedure with two other numbers;
  5. Remember the rule of multiplication by 1;
  6. When multiplied by B, we get the number 1670C;
  7. Now add the numbers and get - 169В974;
  8. Answer: 169В974.

An example for an independent solution.

Arithmetic operations in the binary number system

The rules for performing arithmetic operations on binary numbers are set by the tables of addition, subtraction and multiplication.

The rule for performing the addition operation is the same for all number systems: if the sum of the added digits is greater than or equal to the base of the number system, then the unit is transferred to the next digit on the left. By subtracting, if necessary, make a loan.

Arithmetic operations are performed in the same way in octal, hexadecimal and other number systems. It should be borne in mind that the amount of transfer to the next digit during addition and a loan from the most significant digit during subtraction is determined by the value of the base of the number system.

Octal arithmetic operations

Octal numbers are represented by eight digits (0, 1, 2, 3, 4, 5, 6, 7), since the base of the octal number system is 8. All operations are performed using these eight digits. Octal number addition and multiplication operations are performed using the following tables:

Octal addition and multiplication tables

Example 5Subtract octal numbers 5153-1671 and 2426.63-1706.71

Example 6 Multiply octal numbers 51 16 and 16.6 3.2

Hexadecimal arithmetic operations

To represent numbers in the hexadecimal system, sixteen digits are used: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F. In the hexadecimal system, the number sixteen is written as 10. Arithmetic operations in the hexadecimal system are performed as in the decimal system, but when performing arithmetic operations on large numbers, it is necessary to use the tables of addition and multiplication of numbers in the hexadecimal number system.

Addition table in hexadecimal number system

Hexadecimal multiplication table

Example 7: Add Hexadecimal Numbers

With this online calculator you can convert whole and fractional numbers from one number system to another. A detailed solution with explanations is given. To translate, enter the original number, set the base of the base of the base of the base number, set the base of the base into which you want to translate the number and click on the "Translate" button. See the theoretical part and numerical examples below.

The result has already been received!

Converting integers and fractions from one number system to any other - theory, examples and solutions

There are positional and non-positional number systems. The Arabic numeral system that we use in everyday life is positional, but the Roman one is not. In positional number systems, the position of the number uniquely determines the value of the number. Let's look at the example of the number 6372 in decimal notation. Let's enumerate this number from right to left starting from zero:

Then the number 6372 can be represented as follows:

6372 \u003d 6000 + 300 + 70 + 2 \u003d 6 · 10 3 + 3 · 10 2 + 7 · 10 1 + 2 · 10 0.

The number 10 defines the number system (in this case, it is 10). The values \u200b\u200bof the position of the given number are taken as degrees.

Consider the real decimal number 1287.923. Let's number it starting from zero position of the number from the decimal point to the left and right:

Then the number 1287.923 can be represented as:

1287.923 \u003d 1000 + 200 + 80 + 7 + 0.9 + 0.02 + 0.003 \u003d 1 · 10 3 + 2 · 10 2 + 8 · 10 1 + 7 · 10 0 + 9 · 10 -1 + 2 · 10 -2 + 3 · 10 -3.

In general, the formula can be represented as follows:

C n s n + C n-1 s n-1 + ... + C 1 s 1 + D 0 s 0 + D -1 s -1 + D -2 s -2 + ... + D -k s -k

where Ц n is an integer in position n, Д -k - fractional number in position (-k), s - number system.

A few words about number systems. A number in the decimal number system consists of many digits (0,1,2,3,4,5,6,7,8,9), in the octal number system - of many numbers (0,1, 2,3,4,5,6,7), in the binary number system - from a set of digits (0,1), in the hexadecimal number system - from a set of numbers (0,1,2,3,4,5,6, 7,8,9, A, B, C, D, E, F), where A, B, C, D, E, F correspond to numbers 10,11,12,13,14,15. numbers in different number systems are presented.

Table 1
Notation
10 2 8 16
0 0 0 0
1 1 1 1
2 10 2 2
3 11 3 3
4 100 4 4
5 101 5 5
6 110 6 6
7 111 7 7
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F

Converting numbers from one number system to another

To convert numbers from one number system to another, the easiest way is to first convert the number to the decimal number system, and then, from the decimal number system, translate it into the required number system.

Converting numbers from any number system to the decimal number system

Using formula (1), you can convert numbers from any number system to the decimal number system.

Example 1. Convert the number 1011101.001 from binary number system (SS) to decimal SS. Decision:

1 2 6 +0 2 5 + 1 · 2 4 + 1 · 2 3 + 1 · 2 2 + 0 · 2 1 + 1 2 0 + 0 2 -1 + 0 2 -2 + 1 2 -3 \u003d 64 + 16 + 8 + 4 + 1 + 1/8 \u003d 93.125

Example2. Convert 1011101.001 from octal number system (SS) to decimal SS. Decision:

Example 3 ... Convert number AB572.CDF from hexadecimal base to decimal SS. Decision:

Here A -replaced by 10, B - at 11, C- at 12, F - by 15.

Converting numbers from a decimal number system to another number system

To convert numbers from the decimal number system to another number system, you need to translate separately the integer part of the number and the fractional part of the number.

The whole part of the number is transferred from the decimal SS to another number system - by sequentially dividing the whole part of the number by the base of the number system (for a binary SS - by 2, for an 8-ary SS - by 8, for a 16-ary - by 16, etc.) ) until a whole residue is obtained, less than the base CC.

Example 4 ... Let's convert the number 159 from decimal SS to binary SS:

159 2
158 79 2
1 78 39 2
1 38 19 2
1 18 9 2
1 8 4 2
1 4 2 2
0 2 1
0

As seen from Fig. 1, the number 159 when divided by 2 gives the quotient 79 and the remainder 1. Further, the number 79 when divided by 2 gives the quotient 39 and the remainder 1, etc. As a result, having built a number from the remainder of the division (from right to left), we get the number in the binary SS: 10011111 ... Therefore, we can write:

159 10 =10011111 2 .

Example 5 ... Let's convert the number 615 from decimal SS to octal SS.

615 8
608 76 8
7 72 9 8
4 8 1
1

When converting a number from decimal SS to octal SS, you need to sequentially divide the number by 8 until you get a whole remainder less than 8. As a result, building the number from the remainders of the division (from right to left), we get the number in octal SS: 1147 (see Fig. 2). Therefore, we can write:

615 10 =1147 8 .

Example 6 ... Converting the number 19673 from decimal to hexadecimal SS.

19673 16
19664 1229 16
9 1216 76 16
13 64 4
12

As can be seen from Figure 3, by sequentially dividing 19673 by 16, we got the remainders 4, 12, 13, 9. In the hexadecimal system, the number 12 corresponds to C, the number 13 to D. Therefore, our hexadecimal number is 4CD9.

To convert correct decimal fractions (a real number with a zero integer part) to the base s, it is necessary to sequentially multiply this number by s until a pure zero is obtained in the fractional part, or we get the required number of digits. If the multiplication results in a nonzero number with an integer part, then ignore this integer part (they are sequentially added to the result).

Let's consider the above with examples.

Example 7 ... Convert the number 0.214 from decimal to binary SS.

0.214
x 2
0 0.428
x 2
0 0.856
x 2
1 0.712
x 2
1 0.424
x 2
0 0.848
x 2
1 0.696
x 2
1 0.392

As can be seen from Fig. 4, the number 0.214 is sequentially multiplied by 2. If the multiplication results in a nonzero number with an integer part, then the integer part is written separately (to the left of the number), and the number is written with a zero integer part. If, during multiplication, a number with a zero integer part is obtained, then zero is written to the left of it. The multiplication process continues until a pure zero is obtained in the fractional part, or the required number of digits is obtained. Writing down bold numbers (Fig. 4) from top to bottom, we get the required number in the binary number system: 0. 0011011 .

Therefore, we can write:

0.214 10 =0.0011011 2 .

Example 8 ... Let's convert the number 0.125 from the decimal number system to the binary SS.

0.125
x 2
0 0.25
x 2
0 0.5
x 2
1 0.0

To convert the number 0.125 from the decimal SS to binary, this number is sequentially multiplied by 2. In the third stage, it turned out 0. Therefore, the following result was obtained:

0.125 10 =0.001 2 .

Example 9 ... Let's convert the number 0.214 from the decimal number system to hexadecimal SS.

0.214
x 16
3 0.424
x 16
6 0.784
x 16
12 0.544
x 16
8 0.704
x 16
11 0.264
x 16
4 0.224

Following examples 4 and 5, we get the numbers 3, 6, 12, 8, 11, 4. But in the hexadecimal SS, the numbers 12 and 11 correspond to the numbers C and B. Therefore, we have:

0.214 10 \u003d 0.36C8B4 16.

Example 10 ... Converting the decimal number 0.512 to Octal SS.

0.512
x 8
4 0.096
x 8
0 0.768
x 8
6 0.144
x 8
1 0.152
x 8
1 0.216
x 8
1 0.728

Got:

0.512 10 =0.406111 8 .

Example 11 ... Converting the number 159.125 from Decimal to Binary SS. To do this, we translate separately the integer part of the number (Example 4) and the fractional part of the number (Example 8). Further, combining these results, we get:

159.125 10 =10011111.001 2 .

Example 12 ... Let's convert the number 19673.214 from decimal to hexadecimal SS. To do this, we translate separately the integer part of the number (Example 6) and the fractional part of the number (Example 9). Further, combining these results, we get.

Did you like the article? To share with friends: