Number 30 in binary notation. Number systems

Writing numbers to binary system reckoning is performed using only two digits - 0 and 1. Therefore, this system is easiest to implement in practice in electronic computers and devices. Let's consider how to convert a number to the binary system from the usual decimal without the help of a calculator and computer programs.

Whole numbers

In order to convert an integer from decimal to binary, you must divide it by two, and then divide by two each resulting quotient until you get one. The required binary number is written as a sequence of digits equal to the last quotient (one) and all the resulting residues, starting with the last one.

Here are some examples.

You need to convert the number 23 to binary system

  1. 23: 2 = 11 (remainder 1)
  2. 11: 2 = 5 (remainder 1)
  3. 5: 2 = 2 (remainder 1)
  4. 2: 2 = 1 (remainder 0)

As a result, 23 10 = 10111 2

It is necessary to convert the number 88 to the binary system:

  1. 88: 2 = 44 (remainder 0)
  2. 44: 2 = 22 (remainder 0)
  3. 22: 2 = 11 (remainder 0)
  4. 11: 2 = 5 (remainder 1)
  5. 5: 2 = 2 (remainder 1)
  6. 2: 2 = 1 (remainder 0)

As a result, 88 10 = 1011000 2

Fractional numbers

Now let's look at an algorithm for how to convert fractional decimal numbers to the binary system. To do this, we work with the integer part of the number according to the procedure described above, and multiply the fractional part by two. The fractional part of the resulting product is again multiplied by two, and so on until the fractional part becomes equal to zero or until the required approximation is obtained to a given number of binary digits after the decimal point. Desired fractional part binary number we get as a sequence of digits after the decimal point, equal to the whole parts of the obtained products, starting with the first.

Here are some examples:

You need to translate the number 5.625 into binary:

  • Let's look at the integer part of the decimal number first:
    1. 5: 2 = 2 (remainder 1)
    2. 2: 2 = 1 (remainder 0)
  • As a result, 5 10 = 101 2

  • Now the fractional part:
    1. 0,625 * 2 = 1,25
    2. 0,25 * 2 = 0,5
    3. 0,5 * 2 = 1,0

As a result, 0.125 10 = 0.101 2

As a result, 5.625 10 = 101.101 2

It is necessary to convert 8.35 to the binary system with an accuracy of 5 decimal places:

  • Let's start with the whole part:
    1. 8: 2 = 4 (remainder 0)
    2. 4: 2 = 2 (remainder 0)
    3. 2: 2 = 1 (remainder 0)
  • As a result, 8 10 = 1000 2

  • Fractional part of a number:
    1. 0,35 * 2 = 0,7
    2. 0,7 * 2 = 1,4
    3. 0,4 * 2 = 0,8
    4. 0,8 * 2 = 1,6
    5. 0,6 * 2 = 1,2

As a result, 0.35 10 = 0.01011 2 with an accuracy of 5 decimal places.

As a result, 8.35 10 = 1000.01011 2 with an accuracy of 5 decimal places.

With this online calculator you can transfer 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 of the base into which you want to translate the number and click on the "Translate" button. For the theoretical part and numerical examples, see below.

The result has already been received!

Converting whole and fractional numbers from one number system to any other - theory, examples and solutions

There are positional and not positioning systems reckoning. The Arabic numeral system that we use in everyday life is positional, but the Roman one is not. In positional numeration systems, the position of a number uniquely determines the magnitude of the number. Let's look at this using the decimal number 6372 as an example. Let's enumerate this number from right to left starting from zero:

Then the number 6372 can be represented as follows:

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

The number 10 defines the number system (in in this case this is 10). The values ​​of the position of the given number are taken as the degrees.

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

Then the number 1287.923 can be represented as:

1287.923 = 1000 + 200 + 80 + 7 + 0.9 + 0.02 + 0.003 = 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. The 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 - from the set of numbers (0,1, 2,3,4,5,6,7), in the binary number system - from the set of digits (0,1), in the hexadecimal number system - from the 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 the numbers 10,11,12,13,14,15. the numbers in different systems reckoning.

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 notation (SS) to decimal SS. Solution:

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 = 64 + 16 + 8 + 4 + 1 + 1/8 = 93.125

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

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

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 ... Convert 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 a base s, you need given number multiply sequentially by s until you get a pure zero in the fractional part, or you get the required number of digits. If, during multiplication, a number with an integer part that is different from zero is obtained, then this integer part is not taken into account (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, when multiplying, 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 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 decimal 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 = 0.36C8B4 16.

Example 10 ... Converting Decimal to Decimal SS number 0.512.

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 ... Converting 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.

1. Ordinal account in various number systems.

In modern life, we use positional number systems, that is, systems in which the number denoted by a number depends on the position of the number in the number record. Therefore, in what follows we will only talk about them, omitting the term "positional".

In order to learn how to translate numbers from one system to another, let's understand how the sequential recording of numbers occurs using the decimal system as an example.

Since we have a decimal number system, we have 10 characters (digits) to construct numbers. We start the ordinal count: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. The numbers are over. We increase the digit capacity of the number and zero the least significant bit: 10. Then we increase the least significant bit again until all the digits run out: 11, 12, 13, 14, 15, 16, 17, 18, 19. Increase the most significant bit by 1 and zero the least significant one: 20. When we use all the digits for both digits (we get the number 99), we again increase the digit capacity of the number and reset the existing digits: 100. And so on.

Let's try to do the same in the 2nd, 3rd and 5th systems (we will enter the designation for the 2nd system, for the 3rd, etc.):

0 0 0 0
1 1 1 1
2 10 2 2
3 11 10 3
4 100 11 4
5 101 12 10
6 110 20 11
7 111 21 12
8 1000 22 13
9 1001 100 14
10 1010 101 20
11 1011 102 21
12 1100 110 22
13 1101 111 23
14 1110 112 24
15 1111 120 30

If the number system has a base of more than 10, then we will have to enter additional characters, it is customary to enter letters of the Latin alphabet. For example, for the 12-ary system, in addition to ten digits, we need two letters (s):

0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10
11
12 10
13 11
14 12
15 13

2. Conversion from decimal number system to any other.

To convert an integer positive decimal number to a number system with a different base, you need to divide this number by the base. Divide the resulting quotient by the base again, and further until the quotient is less than the base. As a result, write the last quotient and all the remainders starting from the last on one line.

Example 1. Converting decimal 46 to Binary number system.

Example 2. Converting Decimal 672 to Octal number system.

Example 3. Convert decimal number 934 to hexadecimal notation.

3. Conversion from any number system to decimal.

In order to learn how to convert numbers from any other system to decimal, let's analyze the usual notation of a decimal number.
For example, decimal number 325 is 5 units, 2 tens and 3 hundreds, i.e.

The situation is exactly the same in other number systems, only we will multiply not by 10, 100, etc., but by the degree of the base of the number system. For example, let's take the ternary number 1201. Let's number the digits from right to left starting from zero and represent our number as the sum of the products of a digit by a three in the degree of the digit of the number:

This is the decimal representation of our number, i.e.

Example 4. Converting the octal number 511 to decimal notation.

Example 5. Let's convert the hexadecimal number 1151 to the decimal number system.

4. Conversion from the binary system to the system with the base "power of two" (4, 8, 16, etc.).

To convert a binary number to a number with a base "power of two", it is necessary to divide the binary sequence into groups according to the number of digits equal to the power from right to left and replace each group with the corresponding digit new system reckoning.

For example, Convert binary 1100001111010110 to octal. To do this, we divide it into groups of 3 characters, starting from the right (since), and then use the correspondence table and replace each group with a new digit:

We learned how to build a correspondence table in clause 1.

0 0
1 1
10 2
11 3
100 4
101 5
110 6
111 7

Those.

Example 6. Convert binary 1100001111010110 to hexadecimal number.

0 0
1 1
10 2
11 3
100 4
101 5
110 6
111 7
1000 8
1001 9
1010 A
1011 B
1100 C
1101 D
1110 E
1111 F

5. Transfer from the system with the base "power of two" (4, 8, 16, etc.) to binary.

This translation is similar to the previous one, performed in the opposite direction: we replace each digit with a group of digits in the binary system from the lookup table.

Example 7. Let's translate the hexadecimal number С3A6 into a binary number system.

To do this, replace each digit of the number with a group of 4 digits (since) from the correspondence table, adding, if necessary, the group with zeros at the beginning: