Convert this number to the binary number system. Number systems. Transfer from one system to another

21.10.2019

Those taking the Unified State Exam and more...

It is strange that in computer science lessons in schools they usually show students the most complex and inconvenient way to convert numbers from one system to another. This method consists of sequentially dividing the original number by the base and collecting the remainders from the division in reverse order.

For example, you need to convert the number 810 10 to binary:

We write the result in reverse order from bottom to top. It turns out 81010 = 11001010102

If you need to convert fairly large numbers into the binary system, then the division ladder takes on the size of a multi-story building. And how can you collect all the ones and zeros and not miss a single one?

The Unified State Exam program in computer science includes several tasks related to converting numbers from one system to another. Typically, this is a conversion between octal and hexadecimal systems and binary. These are sections A1, B11. But there are also problems with other number systems, such as in section B7.

To begin with, let us recall two tables that would be good to know by heart for those who choose computer science as their future profession.

Table of powers of number 2:

2 1 2 2 2 3 2 4 2 5 2 6 2 7 2 8 2 9 2 10
2 4 8 16 32 64 128 256 512 1024

It is easily obtained by multiplying the previous number by 2. So, if you do not remember all of these numbers, the rest are not difficult to obtain in your mind from those that you remember.

Table of binary numbers from 0 to 15 with hexadecimal representation:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
0 1 2 3 4 5 6 7 8 9 A B C D E F

The missing values ​​are also easy to calculate by adding 1 to the known values.

Integer conversion

So, let's start by converting directly to the binary system. Let's take the same number 810 10. We need to decompose this number into terms equal to powers of two.

  1. We are looking for the power of two closest to 810 and not exceeding it. This is 2 9 = 512.
  2. Subtract 512 from 810, we get 298.
  3. Repeat steps 1 and 2 until there are no 1s or 0s left.
  4. We got it like this: 810 = 512 + 256 + 32 + 8 + 2 = 2 9 + 2 8 + 2 5 + 2 3 + 2 1.
Then there are two methods, you can use any of them. How easy it is to see that in any number system its base is always 10. The square of the base will always be 100, the cube 1000. That is, the degree of the base of the number system is 1 (one), and there are as many zeros behind it as the degree is.

Method 1: Arrange 1 according to the ranks of the indicators of the terms. In our example, these are 9, 8, 5, 3 and 1. The remaining places will contain zeros. So, we got the binary representation of the number 810 10 = 1100101010 2. Units are placed in 9th, 8th, 5th, 3rd and 1st places, counting from right to left from zero.

Method 2: Let's write the terms as powers of two under each other, starting with the largest.

810 =

Now let's add these steps together, like folding a fan: 1100101010.

That's all. At the same time, the problem “how many units are in the binary notation of the number 810?” is also simply solved.

The answer is as many as there are terms (powers of two) in this representation. 810 has 5 of them.

Now the example is simpler.

Let's convert the number 63 to the 5-ary number system. The closest power of 5 to 63 is 25 (square 5). A cube (125) will already be a lot. That is, 63 lies between the square of 5 and the cube. Then we will select the coefficient for 5 2. This is 2.

We get 63 10 = 50 + 13 = 50 + 10 + 3 = 2 * 5 2 + 2 * 5 + 3 = 223 5.

And, finally, very easy translations between 8 and hexadecimal systems. Since their base is a power of two, the translation is done automatically, simply by replacing the numbers with their binary representation. For the octal system, each digit is replaced by three binary digits, and for the hexadecimal system, four. In this case, all leading zeros are required, except for the most significant digit.

Let's convert the number 547 8 to binary.

547 8 = 101 100 111
5 4 7

One more, for example 7D6A 16.

7D6A 16 = (0)111 1101 0110 1010
7 D 6 A

Let's convert the number 7368 to the hexadecimal system. First, write the numbers in triplets, and then divide them into quadruples from the end: 736 8 = 111 011 110 = 1 1101 1110 = 1DE 16. Let's convert the number C25 16 to the octal system. First, we write the numbers in fours, and then divide them into threes from the end: C25 16 = 1100 0010 0101 = 110 000 100 101 = 6045 8. Now let's look at converting back to decimal. It is not difficult, the main thing is not to make mistakes in the calculations. We expand the number into a polynomial with powers of the base and coefficients for them. Then we multiply and add everything. E68 16 = 14 * 16 2 + 6 * 16 + 8 = 3688. 732 8 = 7 * 8 2 + 3*8 + 2 = 474 .

Converting Negative Numbers

Here you need to take into account that the number will be presented in two's complement code. To convert a number into additional code, you need to know the final size of the number, that is, what we want to fit it into - in a byte, in two bytes, in four. The most significant digit of a number means the sign. If there is 0, then the number is positive, if 1, then it is negative. On the left, the number is supplemented with a sign digit. We do not consider unsigned numbers; they are always positive, and the most significant bit in them is used as information.

To convert a negative number to binary's complement, you need to convert a positive number to binary, then change the zeros to ones and the ones to zeros. Then add 1 to the result.

So, let's convert the number -79 to the binary system. The number will take us one byte.

We convert 79 to the binary system, 79 = 1001111. We add zeros on the left to the size of the byte, 8 bits, we get 01001111. We change 1 to 0 and 0 to 1. We get 10110000. We add 1 to the result, we get the answer 10110001. Along the way, we answer the Unified State Exam question “how many units are in the binary representation of the number -79?” The answer is 4.

Adding 1 to the inverse of a number eliminates the difference between the representations +0 = 00000000 and -0 = 11111111. In two's complement code they will be written the same as 00000000.

Converting fractional numbers

Fractional numbers are converted in the reverse way of dividing whole numbers by the base, which we looked at at the very beginning. That is, using sequential multiplication by a new base with the collection of whole parts. The integer parts obtained during multiplication are collected, but do not participate in the following operations. Only fractions are multiplied. If the original number is greater than 1, then the integer and fractional parts are translated separately and then glued together.

Let's convert the number 0.6752 to the binary system.

0 ,6752
*2
1 ,3504
*2
0 ,7008
*2
1 ,4016
*2
0 ,8032
*2
1 ,6064
*2
1 ,2128

The process can be continued for a long time until we get all the zeros in the fractional part or the required accuracy is achieved. Let's stop at the 6th sign for now.

It turns out 0.6752 = 0.101011.

If the number was 5.6752, then in binary it will be 101.101011.

2.3. Converting numbers from one number system to another

2.3.1. Converting integers from one number system to another

It is possible to formulate an algorithm for converting integers from a radix system p into a system with a base q :

1. Express the base of the new number system with numbers from the original number system and carry out all subsequent actions in the original number system.

2. Consistently divide the given number and the resulting integer quotients by the base of the new number system until we obtain a quotient that is smaller than the divisor.

3. The resulting remainders, which are digits of the number in the new number system, are brought into accordance with the alphabet of the new number system.

4. Compose a number in the new number system, writing it starting from the last remainder.

Example 2.12. Convert the decimal number 173 10 to octal number system:

We get: 173 10 =255 8

Example 2.13. Convert the decimal number 173 10 to hexadecimal number system:

We get: 173 10 =AD 16.

Example 2.14. Convert the decimal number 11 10 to the binary number system. It is more convenient to depict the sequence of actions discussed above (translation algorithm) as follows:

We get: 11 10 =1011 2.

Example 2.15. Sometimes it is more convenient to write down the translation algorithm in table form. Let's convert the decimal number 363 10 to a binary number.

Divider

We get: 363 10 =101101011 2

2.3.2. Converting fractional numbers from one number system to another

It is possible to formulate an algorithm for converting a proper fraction with a base p into a fraction with a base q:

1. Express the base of the new number system with numbers from the original number system and carry out all subsequent actions in the original number system.

2. Consistently multiply the given numbers and the resulting fractional parts of the products by the base of the new system until the fractional part of the product becomes equal to zero or the required accuracy of number representation is achieved.

3. The resulting integer parts of the products, which are digits of the number in the new number system, should be brought into conformity with the alphabet of the new number system.

4. Compose the fractional part of a number in the new number system, starting with the integer part of the first product.

Example 2.17. Convert the number 0.65625 10 to the octal number system.

We get: 0.65625 10 =0.52 8

Example 2.17. Convert the number 0.65625 10 to hexadecimal number system.

x 16

We get: 0.65625 10 =0.A8 1

Example 2.18. Convert the decimal fraction 0.5625 10 to the binary number system.

x 2

x 2

x 2

x 2

We get: 0.5625 10 =0.1001 2

Example 2.19. Convert the decimal fraction 0.7 10 to the binary number system.

Obviously, this process can continue indefinitely, giving more and more new signs in the image of the binary equivalent of the number 0.7 10. So, in four steps we get the number 0.1011 2, and in seven steps the number 0.1011001 2, which is a more accurate representation of the number 0.7 10 in the binary number system, etc. Such an endless process is terminated at some step, when it is believed that the required accuracy of number representation has been obtained.

2.3.3. Translation of arbitrary numbers

Translation of arbitrary numbers, i.e. numbers containing an integer and a fractional part are carried out in two stages. The integer part is translated separately, and the fractional part separately. In the final recording of the resulting number, the integer part is separated from the fractional part by a comma (dot).

Example 2.20. Convert the number 17.25 10 to the binary number system.

We get: 17.25 10 =1001.01 2

Example 2.21. Convert the number 124.25 10 to octal system.

We get: 124.25 10 =174.2 8

2.3.4. Converting numbers from base 2 to base 2 n and vice versa

Translation of integers. If the base of the q-ary number system is a power of 2, then the conversion of numbers from the q-ary number system to the 2-ary number system and back can be carried out according to simpler rules. In order to write an integer binary number in the number system with base q=2 n, you need:

1. Divide the binary number from right to left into groups of n digits each.

2. If the last left group has less than n digits, then it must be supplemented on the left with zeros to the required number of digits.

Example 2.22. The number 101100001000110010 2 will be converted to the octal number system.

We divide the number from right to left into triads and under each of them write the corresponding octal digit:

We get the octal representation of the original number: 541062 8 .

Example 2.23. The number 1000000000111110000111 2 will be converted to the hexadecimal number system.

We divide the number from right to left into tetrads and under each of them write the corresponding hexadecimal digit:

We get the hexadecimal representation of the original number: 200F87 16.

Converting fractional numbers. In order to write a fractional binary number in a number system with base q=2 n, you need:

1. Divide the binary number from left to right into groups of n digits each.

2. If the last right group has less than n digits, then it must be supplemented on the right with zeros to the required number of digits.

3. Consider each group as an n-bit binary number and write it with the corresponding digit in the number system with the base q=2 n.

Example 2.24. The number 0.10110001 2 will be converted to the octal number system.

We divide the number from left to right into triads and under each of them we write the corresponding octal digit:

We get the octal representation of the original number: 0.542 8 .

Example 2.25. The number 0.100000000011 2 will be converted to the hexadecimal number system. We divide the number from left to right into tetrads and under each of them write the corresponding hexadecimal digit:

We get the hexadecimal representation of the original number: 0.803 16

Translation of arbitrary numbers. In order to write an arbitrary binary number in the number system with the base q=2 n, you need:

1. Divide the integer part of a given binary number from right to left, and the fractional part from left to right into groups of n digits each.

2. If the last left and/or right groups have less than n digits, then they must be supplemented on the left and/or right with zeros to the required number of digits;

3. Consider each group as an n-bit binary number and write it with the corresponding digit in the number system with the base q = 2 n

Example 2.26. Let's convert the number 111100101.0111 2 to the octal number system.

We divide the integer and fractional parts of the number into triads and under each of them write the corresponding octal digit:

We get the octal representation of the original number: 745.34 8 .

Example 2.27. The number 11101001000,11010010 2 will be converted to the hexadecimal number system.

We divide the integer and fractional parts of the number into notebooks and under each of them write the corresponding hexadecimal digit:

We get the hexadecimal representation of the original number: 748,D2 16.

Converting numbers from number systems with base q=2n to binary. In order to convert an arbitrary number written in the number system with the base q=2 n into the binary number system, you need to replace each digit of this number with its n-digit equivalent in the binary number system.

Example 2.28.Let's convert the hexadecimal number 4AC35 16 to the binary number system.

According to the algorithm:

We get: 1001010110000110101 2 .

Tasks for independent completion (Answers)

2.38. Fill out the table, in each row of which the same integer must be written in different number systems.

Binary

Octal

Decimal

Hexadecimal

2.39. Fill out the table, in each row of which the same fractional number must be written in different number systems.

Binary

Octal

Decimal

Hexadecimal

2.40. Fill out the table, in each row of which the same arbitrary number (the number can contain both an integer and a fractional part) must be written in different number systems.

Binary

Octal

Decimal

Hexadecimal

59.B

Note 1

If you want to convert a number from one number system to another, then it is more convenient to first convert it to the decimal number system, and only then convert it from the decimal number system to any other number system.

Rules for converting numbers from any number system to decimal

In computing technology that uses machine arithmetic, the conversion of numbers from one number system to another plays an important role. Below we give the basic rules for such transformations (translations).

    When converting a binary number to a decimal, you need to represent the binary number as a polynomial, each element of which is represented as the product of a digit of the number and the corresponding power of the base number, in this case $2$, and then you need to calculate the polynomial using the rules of decimal arithmetic:

    $X_2=A_n \cdot 2^(n-1) + A_(n-1) \cdot 2^(n-2) + A_(n-2) \cdot 2^(n-3) + ... + A_2 \cdot 2^1 + A_1 \cdot 2^0$

Figure 1. Table 1

Example 1

Convert the number $11110101_2$ to the decimal number system.

Solution. Using the given table of $1$ powers of the base $2$, we represent the number as a polynomial:

$11110101_2 = 1 \cdot 27 + 1 \cdot 26 + 1 \cdot 25 + 1 \cdot 24 + 0 \cdot 23 + 1 \cdot 22 + 0 \cdot 21 + 1 \cdot 20 = 128 + 64 + 32 + 16 + 0 + 4 + 0 + 1 = 245_(10)$

    To convert a number from the octal number system to the decimal number system, you need to represent it as a polynomial, each element of which is represented as the product of a digit of the number and the corresponding power of the base number, in this case $8$, and then you need to calculate the polynomial according to the rules of decimal arithmetic:

    $X_8 = A_n \cdot 8^(n-1) + A_(n-1) \cdot 8^(n-2) + A_(n-2) \cdot 8^(n-3) + ... + A_2 \cdot 8^1 + A_1 \cdot 8^0$

Figure 2. Table 2

Example 2

Convert the number $75013_8$ to the decimal number system.

Solution. Using the given table of $2$ powers of the base $8$, we represent the number as a polynomial:

$75013_8 = 7\cdot 8^4 + 5 \cdot 8^3 + 0 \cdot 8^2 + 1 \cdot 8^1 + 3 \cdot 8^0 = 31243_(10)$

    To convert a number from hexadecimal to decimal, you need to represent it as a polynomial, each element of which is represented as the product of a digit of the number and the corresponding power of the base number, in this case $16$, and then you need to calculate the polynomial according to the rules of decimal arithmetic:

    $X_(16) = A_n \cdot 16^(n-1) + A_(n-1) \cdot 16^(n-2) + A_(n-2) \cdot 16^(n-3) + . .. + A_2 \cdot 16^1 + A_1 \cdot 16^0$

Figure 3. Table 3

Example 3

Convert the number $FFA2_(16)$ to the decimal number system.

Solution. Using the given table of $3$ powers of the base $8$, we represent the number as a polynomial:

$FFA2_(16) = 15 \cdot 16^3 + 15 \cdot 16^2 + 10 \cdot 16^1 + 2 \cdot 16^0 =61440 + 3840 + 160 + 2 = 65442_(10)$

Rules for converting numbers from the decimal number system to another

  • To convert a number from the decimal number system to the binary system, it must be sequentially divided by $2$ until there is a remainder less than or equal to $1$. A number in the binary system is represented as a sequence of the last result of division and the remainders from division in reverse order.

Example 4

Convert the number $22_(10)$ to the binary number system.

Solution:

Figure 4.

$22_{10} = 10110_2$

  • To convert a number from the decimal number system to the octal number system, it must be successively divided by $8$ until there is a remainder less than or equal to $7$. A number in the octal number system is represented as a sequence of digits of the last division result and the remainders from the division in reverse order.

Example 5

Convert the number $571_(10)$ to the octal number system.

Solution:

Figure 5.

$571_{10} = 1073_8$

  • To convert a number from the decimal number system to the hexadecimal system, it must be successively divided by $16$ until there is a remainder less than or equal to $15$. A number in the hexadecimal system is represented as a sequence of digits of the last division result and the remainders from the division in reverse order.

Example 6

Convert the number $7467_(10)$ to hexadecimal number system.

Solution:

Figure 6.

$7467_(10) = 1D2B_(16)$

    In order to convert a proper fraction from a decimal number system to a non-decimal number system, it is necessary to sequentially multiply the fractional part of the number being converted by the base of the system to which it needs to be converted. Fractions in the new system will be represented as whole parts of products, starting with the first.

    For example: $0.3125_((10))$ in octal number system will look like $0.24_((8))$.

    In this case, you may encounter a problem when a finite decimal fraction can correspond to an infinite (periodic) fraction in the non-decimal number system. In this case, the number of digits in the fraction represented in the new system will depend on the required accuracy. It should also be noted that integers remain integers, and proper fractions remain fractions in any number system.

Rules for converting numbers from a binary number system to another

  • To convert a number from the binary number system to octal, it must be divided into triads (triples of digits), starting with the least significant digit, if necessary, adding zeros to the leading triad, then replace each triad with the corresponding octal digit according to Table 4.

Figure 7. Table 4

Example 7

Convert the number $1001011_2$ to the octal number system.

Solution. Using Table 4, we convert the number from the binary number system to octal:

$001 001 011_2 = 113_8$

  • To convert a number from the binary number system to hexadecimal, it should be divided into tetrads (four digits), starting with the least significant digit, if necessary, adding zeros to the most significant tetrad, then replace each tetrad with the corresponding octal digit according to Table 4.

In this article I will tell you the basics of computer technology - this is a binary system. This is the lowest level, these are the numbers by which the computer works. And you will learn how to transfer from one system

Table 1 - Representation of numbers in various systems
calculus (beginning)

Number systems

Decimal

Binary

Octal

Hexadecimal

BCD

To convert from decimal to binary, you have two options.

1) For example, the number 37 needs to be converted from the decimal system to the binary system, then you need to divide it by two, and then check the remainder of the division. If the remainder is odd, then we write one at the bottom and the next division cycle goes through an even number; if the remainder of the division is even, then we write zero. At the end you must get 1. And now we convert the resulting result into binary, and the number goes from right to left.

Step by step: 37 is an odd number, which means 1 , then 36/2 = 18. The number is even, which means 0. 18/2 = 9 is an odd number, which means 1 , then 8/2 = 4. The number is even, read 0. 4/2 = 2, an even number means 0, 2/2 = 1.

So we got the number. Don't forget to count from right to left: 100101 - now we have a number in the binary system. In general, this is written as a division in a column, as you see in the figure below:

2) But there is a second way. I like him better. Transfer from one system to another is as follows:

where ai is the i-th digit of the number;
k - the number of digits in the fractional part of the number;
m - the number of digits in the integer part of the number;
N is the base of the number system.

The base of the number system N shows how many times the “weight” of the i-th digit is greater than the “weight” (i-1) of the digit. The integer part of a number is separated from the fractional part by a dot (comma).

The integer part of the number AN1, with the base N1, is converted to the number system with the base N2 by sequentially dividing the integer part of the number AN1 by the base N2 written as a number with the base N1, until a remainder is obtained. The resulting part is again divided by the base N2, and this process must repeat until the particle becomes smaller than the divisor. The resulting remainders from division and the last part are written in the reverse order obtained during division. The generated number will be an integer with base N2.

The fractional part of the number AN1, with base N1, is converted into a number system with base N2 by sequentially multiplying the fractional part of the number AN1 by base N2, written as a number with base N1. With each multiplication, the integer part of the product is taken in the form of the next digit of the corresponding digit, and the fractional part of the remaining is taken as a new multiplication. The number of multiplications determines the digit capacity of the resulting result, representing the fractional part of the number AN1 in the N2 number system. The fractional part of a number is often represented inaccurately when translated.

Let's do this with an example:

Convert from decimal to binary

37 in decimal must be converted to binary. Let's work with degrees:

2 0 = 1
2 1 = 2
2 2 = 4
2 3 = 8
2 4 = 16
2 5 = 32
2 6 = 64
2 7 = 128
2 8 = 256
2 9 = 512
2 10 = 1024 and so on... ad infinitum

This means: 37 - 32 = 5. 5 - 4 = 1. The answer is as follows in binary: 100101.

Let's convert the number 658 from decimal to binary:

658-512=146
146-128=18
18-16=2. In the binary system the number will look like: 1010010010.

Converting from decimal to octal

If you need to convert from decimal to octal, you must first convert to binary, and then convert from binary to octal. That is, it’s easier this way, although you can translate it right away. Using an algorithm similar to the one for converting to binary, see above.

Convert from decimal to hexadecimal

If you need to convert from decimal to hexadecimal, you must first convert to binary and then convert from binary to hexadecimal. That is, it’s easier this way, although you can translate it right away. Using an algorithm similar to the one for converting to binary, see above.

Converting from binary to octal

To convert a number from binary to octal, you need to split the binary into three numbers.

For example, the resulting number 1010010010 is divided into three numbers, and the division goes from right to left: 1,010,010,010 = 1222. See the table at the very beginning.

Converting from binary to hexadecimal

To convert a number from binary to hexadecimal, you need to divide it into tetrads (four each)

10 1001 0010 = 292

Here are a few examples for you to look through:

Conversion is from binary to octal, then to hexadecimal, and then from binary to decimal

(2) = 11101110
(8) = 11 101 110 = 276
(16) = 1110 1110 = EE
(10) = 1*128+ 1*64+ 1*32+ 0 +1*8 + 1*4 + 1*2+ 0= 238
3) (8) = 657

Conversion is carried out from hexadecimal to binary, then to octal, and then from binary to decimal

(16) = 6E8
(2) = 110 1110 1000
(8) = 11 011 101 000 = 2250
(10) = 1*1024+1*512+ 0 +1*128+ 1*64+ 1*32+ 8 = 1768

Purpose of the service. The service is designed to convert numbers from one number system to another online. To do this, select the base of the system from which you want to convert the number. You can enter both integers and numbers with commas.

Number

Conversion from 10 2 8 16 number system. Convert to 2 10 8 16 number system.
For fractional numbers, use 2 3 4 5 6 7 8 decimal places.

You can enter both whole numbers, for example 34, and fractional numbers, for example, 637.333. For fractional numbers, the translation accuracy after the decimal point is indicated.

The following are also used with this calculator:

Ways to represent numbers

Binary (binary) numbers - each digit means the value of one bit (0 or 1), the most significant bit is always written on the left, the letter “b” is placed after the number. For ease of perception, notebooks can be separated by spaces. For example, 1010 0101b.
Hexadecimal (hexadecimal) numbers - each tetrad is represented by one symbol 0...9, A, B, ..., F. This representation can be designated in different ways; here only the symbol “h” is used after the last hexadecimal digit. For example, A5h. In program texts, the same number can be designated as either 0xA5 or 0A5h, depending on the syntax of the programming language. A leading zero (0) is added to the left of the most significant hexadecimal digit represented by the letter to distinguish between numbers and symbolic names.
Decimal (decimal) numbers - each byte (word, double word) is represented by a regular number, and the decimal representation sign (the letter “d”) is usually omitted. The byte in the previous examples has a decimal value of 165. Unlike binary and hexadecimal notation, decimal is difficult to mentally determine the value of each bit, which is sometimes necessary.
Octal (octal) numbers - each triple of bits (division starts from the least significant) is written as a number 0–7, with an “o” at the end. The same number would be written as 245o. The octal system is inconvenient because the byte cannot be divided equally.

Algorithm for converting numbers from one number system to another

Converting whole decimal numbers to any other number system is carried out by dividing the number by the base of the new number system until the remainder remains a number less than the base of the new number system. The new number is written as division remainders, starting from the last one.
Converting a regular decimal fraction to another PSS is carried out by multiplying only the fractional part of the number by the base of the new number system until all zeros remain in the fractional part or until the specified translation accuracy is achieved. As a result of each multiplication operation, one digit of a new number is formed, starting with the highest one.
Improper fraction translation is carried out according to rules 1 and 2. The integer and fractional parts are written together, separated by a comma.

Example No. 1.



Conversion from 2 to 8 to 16 number system.
These systems are multiples of two, therefore the translation is carried out using a correspondence table (see below).

To convert a number from the binary number system to the octal (hexadecimal) number system, it is necessary to divide the binary number from the decimal point to the right and left into groups of three (four for hexadecimal) digits, supplementing the outer groups with zeros if necessary. Each group is replaced by the corresponding octal or hexadecimal digit.

Example No. 2. 1010111010.1011 = 1.010.111.010.101.1 = 1272.51 8
here 001=1; 010=2; 111=7; 010=2; 101=5; 001=1

When converting to the hexadecimal system, you must divide the number into parts of four digits, following the same rules.
Example No. 3. 1010111010,1011 = 10.1011.1010,1011 = 2B12,13 HEX
here 0010=2; 1011=B; 1010=12; 1011=13

Conversion of numbers from 2, 8 and 16 to the decimal system is carried out by breaking the number into individual ones and multiplying it by the base of the system (from which the number is translated) raised to the power corresponding to its serial number in the number being converted. In this case, the numbers are numbered to the left of the decimal point (the first number is numbered 0) with increasing, and to the right with decreasing (i.e., with a negative sign). The results obtained are added up.

Example No. 4.
An example of conversion from binary to decimal number system.

1010010.101 2 = 1·2 6 +0·2 5 +1·2 4 +0·2 3 +0·2 2 +1·2 1 +0·2 0 + 1·2 -1 +0·2 - 2 +1 2 -3 =
= 64+0+16+0+0+2+0+0.5+0+0.125 = 82.625 10 An example of conversion from octal to decimal number system.

108.5 8 = 1*·8 2 +0·8 1 +8·8 0 + 5·8 -1 = 64+0+8+0.625 = 72.625 10 An example of conversion from hexadecimal to decimal number system.

  1. 108.5 16 = 1·16 2 +0·16 1 +8·16 0 + 5·16 -1 = 256+0+8+0.3125 = 264.3125 10
    • Once again we repeat the algorithm for converting numbers from one number system to another PSS
    • From the decimal number system:
    • divide the number by the base of the number system being translated;
  2. find the remainder when dividing an integer part of a number;
    • write down all remainders from division in reverse order;
    • From the binary number system
      To convert to the decimal number system, it is necessary to find the sum of the products of base 2 by the corresponding degree of digit;
    • To convert a number to octal, you need to break the number into triads.
      For example, 1000110 = 1,000 110 = 106 8
To convert a number from binary to hexadecimal, you need to divide the number into groups of 4 digits. For example, 1000110 = 100 0110 = 46 16
The system is called positional
Number system correspondence table:Table for conversion to hexadecimal number system
0000 0
0001 1
0010 2
0011 3
0100 4
0101 5
0110 6
0111 7
1000 8
1001 9
1010 A
1011 B
1100 C
1101 D
1110 E
1111 F

Binary SS