Converting numbers from one number system to another online. Translation of numbers from one number system to another online Translation of numbers from one number system to another

Converting numbers from one number system to another is an important part of machine arithmetic. Consider the basic rules of translation.

1. To convert a binary number into a decimal one, it is necessary to write it as a polynomial consisting of the products of the digits of the number and the corresponding power of the number 2, and calculate according to the rules of decimal arithmetic:

When translating, it is convenient to use the table of powers of two:

Table 4. Powers of 2

n (degree)

Example.

2. To translate an octal number into a decimal one, it is necessary to write it as a polynomial consisting of the products of the digits of the number and the corresponding power of the number 8, and calculate according to the rules of decimal arithmetic:

When translating, it is convenient to use the table of powers of eight:

Table 5. Powers of 8

n (degree)

Example. Convert the number to decimal number system.

3. To translate a hexadecimal number into a decimal one, it is necessary to write it as a polynomial consisting of the products of the digits of the number and the corresponding power of the number 16, and calculate according to the rules of decimal arithmetic:

When translating, it is convenient to use blitz of powers of 16:

Table 6. Powers of 16

n (degree)

Example. Convert the number to decimal number system.

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

Example. Convert the number to binary number system.

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

Example. Convert the number to octal number system.

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

Example. Convert the number to hexadecimal.

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 number system of the original number, set the base of the number system to which you want to convert the number and click the "Translate" button. See the theoretical part and numerical examples below.

The result has already been received!

Translation of integer and fractional numbers 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, while Roman is not. In positional number systems, the position of a number uniquely determines the magnitude of the number. Consider this using the example of the number 6372 in the decimal number system. Let's number 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 this case it is 10). The values ​​of the position of the given number are taken as degrees.

Consider the real decimal number 1287.923. We 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 + C 0 s 0 + D -1 s -1 + D -2 s -2 + ... + D -k s -k

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

A few words about number systems. A number in the decimal number system consists of a set of digits (0,1,2,3,4,5,6,7,8,9), in the octal number system it consists of a set of digits (0,1, 2,3,4,5,6,7), in the binary system - from the set of digits (0.1), in the hexadecimal number system - from the set of digits (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. In Table 1 numbers are represented in different number systems.

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 translate 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 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. 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 the number 1011101.001 from octal number system (SS) to decimal SS. Solution:

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

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

Converting numbers from a decimal number system to another number system

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

The integer part of the number is translated from the decimal SS to another number system - by successively dividing the integer part of the number by the base of the number system (for binary SS - by 2, for 8-digit SS - by 8, for 16-digit - by 16, etc. ) to obtain a whole remainder, less than the base of the SS.

Example 4 . Let's translate 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 can be seen from Fig. 1, the number 159, when divided by 2, gives the quotient 79 and the remainder is 1. Further, the number 79, when divided by 2, gives the quotient 39 and the remainder is 1, and so on. As a result, by constructing a number from the remainder of the division (from right to left), we get a number in 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 an integer remainder less than 8. As a result, building a number from the remainder of the division (from right to left) we get a number in octal SS: 1147 (see Fig. 2). Therefore, we can write:

615 10 =1147 8 .

Example 6 . Let's translate the number 19673 from the decimal number system to hexadecimal SS.

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

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

To convert correct decimal fractions (a real number with a zero integer part) into a number system with base s, this number must be successively multiplied by s until the fractional part is pure zero, or we get the required number of digits. If the multiplication results in a number with an integer part other than zero, then this integer part is not taken into account (they are sequentially included in the result).

Let's look at the above with examples.

Example 7 . Let's translate the number 0.214 from the decimal number system 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 successively multiplied by 2. If the result of multiplication is a number with an integer part other than zero, 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 multiplied, 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 bold numbers (Fig. 4) from top to bottom, we get the required number in the binary system: 0. 0011011 .

Therefore, we can write:

0.214 10 =0.0011011 2 .

Example 8 . Let's translate 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 successively multiplied by 2. In the third stage, 0 was obtained. Therefore, the following result was obtained:

0.125 10 =0.001 2 .

Example 9 . Let's translate 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 hexadecimal SS, the numbers C and B correspond to the numbers 12 and 11. Therefore, we have:

0.214 10 =0.36C8B4 16 .

Example 10 . Let's translate the number 0.512 from the decimal number system to the 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 . Let's translate the number 159.125 from the decimal number system 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). Combining these results, we get:

159.125 10 =10011111.001 2 .

Example 12 . Let's translate the number 19673.214 from the decimal number system 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.

4.1. Using the Counting Rule, write down the first 20 integers in decimal, binary, ternary, quinary, and octal.
(Answers at the end of the document)

4.2. What integers follow the numbers:

a) 1 2 ; f) 1 8 ; n) F 16 ;
b) 101 2 ; g) 7 8 ; m) 1F 16;
c) 111 2 ; h) 37 8 ; m) FF 16 ;
d) 1111 2 ; i) 177 8 ; o) 9AF9 16;
e) 101011 2 ; j) 7777 8 ; n) CDEF 16 ?


(Answers at the end of the document)

4.3. Which integers come before numbers:

a) 10 2 ; f) 10 8 ; l) 10 16;
b) 1010 2 ; g) 20 8 ; m) 20 16;
c) 1000 2 ; h) 100 8 ; m) 100 16;
d) 10000 2 ; i) 110 8 ; o) A10 16 ;
e) 10100 2 ; j) 1000 8 ; p) 1000 16 ?


(Answers at the end of the document)

4.4. What is the end of an even binary number? What digit ends with an odd binary number? What digits can end in an even ternary number?
(Answers at the end of the document)

4.5. What is the largest decimal number that can be written with three digits:

    • a) in binary system;
    • b) in the octal system;
    • c) in hexadecimal system?

(Answers at the end of the document)

4.6. In what number system is 21 + 24 = 100?

Solution. Let x be the desired base of the number system. Then 100 x = 1 x 2 + 0 x 1 + 0 x 0 , 21 x = 2 x 1 + 1 x 0 , 24 x = 2 x 1 + 4 x 0 . Thus, x 2 \u003d 2x + 2x + 5 or x 2 - 4x - 5 \u003d 0. The positive root of this quadratic equation is x \u003d 5.
Answer. Numbers are written in the quinary number system.

4.7. In which number system is the following true?

    • a) 20 + 25 = 100;
    • b) 22 + 44 = 110?

(Answers at the end of the document)

4.8. The decimal number 59 is equivalent to the number 214 in some other number system. Find the basis of this system.
(Answers at the end of the document)

4.9. Convert the numbers to decimal, then check the results by converting back:

a) 1011011 2 ; e) 517 8 ; k) 1F 16;
b) 10110111 2 ; g) 1010 8 ; m) ABC 16;
c) 011100001 2 ; h) 1234 8 ; m) 1010 16;
d) 0.1000110 2 ; i) 0.348; o) 0.A4 16;
e) 110100.11 2 ; j) 123.41 8 ; o) 1DE,C8 16 .


(Answers at the end of the document)

4.10. Convert numbers from decimal to binary, octal, and hexadecimal, then check the results by converting back:

a) 125 10; b) 229 10 ; c) 88 10 ; d) 37.25 10 ; e) 206.125 10 .
(Answers at the end of the document)

4.11. Convert the numbers from binary to octal and hexadecimal, and then check the results by converting back:

a) 1001111110111.0111 2 ; d) 1011110011100.11 2 ;
b) 1110101011.1011101 2 ; e) 10111.1111101111 2 ;
c) 10111001.101100111 2 ; f) 1100010101.11001 2 .


(Answers at the end of the document)

4.12. Convert hexadecimal numbers to binary and octal systems:

a) 2CE 16; b) 9F40 16; c) ABCDE 16; d) 1010.101 16 ; e) 1ABC,9D 16 .
(Answers at the end of the document)

4.13. Write out integers:

    • a) from 101101 2 to 110000 2 in the binary system;
    • b) from 202 3 to 1000 3 in the ternary system;
    • c) from 14 8 to 20 8 in the octal system;
    • d) from 28 16 to 30 16 in hexadecimal system.

(Answers at the end of the document)

4.14. For decimal numbers 47 and 79, perform a chain of translations from one number system to another:


(Answers at the end of the document)

4.15. Make tables for adding single-digit numbers in ternary and quinary number systems.
(Answers at the end of the document)

4.16. Make multiplication tables of single digit numbers in ternary and quinary number systems.
(Answers at the end of the document)

4.17. Add up the numbers and then check the results by doing the appropriate decimal additions:


(Answers at the end of the document)

4.18. What number systems are used for the following additions? Find the bases of each system:


(Answers at the end of the document)

4.19. Find those substitutions of decimal digits for letters that make the results written out correct (different numbers are replaced by different letters):


(Answers at the end of the document)

4.20. Subtract:


(Answers at the end of the document)

4.21. Multiply the numbers and then check the results by doing the appropriate decimal multiplications:

a) 101101 2 and 101 2 ; e) 37 8 and 4 8 ;
b) 111101 2 and 11.01 2 ; f) 16 8 and 7 8 ;
c) 1011.11 2 and 101.1 2 ; g) 7.5 8 and 1.6 8 ;
d) 101 2 and 1111.001 2 ; h) 6.25 8 and 7.12 8 .


(Answers at the end of the document)

4.22. Divide 10010110 2 by 1010 2 and check the result by multiplying the divisor by the quotient.
(Answers at the end of the document)

4.23. Divide 10011010100 2 by 1100 2 and then do the appropriate decimal and octal division.
(Answers at the end of the document)

4.24. Calculate the values ​​of expressions:

    • a) 256 8 + 10110.1 2 * (60 8 + 12 10) - 1F 16;
    • b) 1AD 16 - 100101100 2: 1010 2 + 217 8;
    • c) 1010 10 + (106 16 - 11011101 2) 12 8 ;
    • d) 1011 2 * 1100 2: 14 8 + (100000 2 - 40 8).

(Answers at the end of the document)

4.25. Arrange the following numbers in ascending order:

    • a) 74 8 , 110010 2 , 70 10 , 38 16 ;
    • b) 6E 16 , 142 8 , 1101001 2 , 100 10 ;
    • c) 777 8 , 101111111 2 , 2FF 16 , 500 10 ;
    • d) 100 10 , 1100000 2 , 60 16 , 141 8 .

(Answers at the end of the document)

4.26. Write a decreasing series of numbers +3, +2, ..., -3 in single-byte format:

    • a) in direct code;
    • b) in reverse code;
    • c) in an additional code.

(Answers at the end of the document)

4.27. Write the numbers in direct code (format 1 byte):

a) 31; b) -63; c) 65; d) -128.
(Answers at the end of the document)

4.28. Write the numbers in reverse and additional codes(format 1 byte):

a) -9; b) -15; c) -127; d) -128.
(Answers at the end of the document)

4.29. Find the decimal representations of numbers written in two's complement:

a) 1 1111000; b) 1 0011011; c) 1 1101001; d) 1,0000,000.
(Answers at the end of the document)

4.30. Find decimal representations of numbers written in reverse code:

a) 1 1101000; b) 1 0011111; c) 1 0101011; d) 1,0000,000.
(Answers at the end of the document)

4.31. Subtract numbers by adding their inverse (complementary) codes in 1 byte format. Indicate in what cases the bit grid overflow occurs:

a) 9 - 2; d) -20 - 10; g) -120 - 15;
b) 2 - 9; e) 50 - 25; h) -126 - 1;
c) -5 - 7; f) 127 - 1; i) -127 - 1.

Answers

4.1. V) ternary: 0, 1, 2, 10, 11, 12, 20, 21, 22, 100, 101, 102, 110, 111, 112, 120, 121, 122, 200, 201; G) quinary: 0, 1, 2, 3, 4, 10, 11, 12, 13, 14, 20, 21, 22, 23, 24, 30, 31, 32, 33, 34.

4.2. A) 10 2 ; b) 110 2 ; V) 1000 2 ; G) 10000 2 ; e) 101100 2 ; e) 2 8 ; and) 10 8 ; h) 40 8 ; And) 200 8 ; To) 10000 8 ; l) 10 16 ; m) 20 16 ; m) 100 16 ; O) 9AFA 16 ; P) CDF0 16 .

4.3. A) 1 2 ; b) 1001 2 ; V) 111 2 ; G) 1111 2 ; e) 10011 2 ; e) 7 8 ; and) 17 8 ; h) 77 8 ; And) 107 8 ; To) 777 8 ; l) F16; m) 1F 16 ; m) FF16; O) A0F 16 ; P) FFF 16 .

4.4. An even binary number ends in 0, an odd binary number ends in 1, and an even ternary number ends in 0, 1, or 2.

4.5. A) 7; b) 511; V) 4091.

4.7. A) in none; b) in hexadecimal.

4.8. Foundation 5.

4.9. A) 91; b) 183; V) 225; G) 35 / 64 ; e) 52,75; e) 335; and) 520; h) 668; And) 7 / 16 ; To) 83 33 / 64 ; l) 31; m) 2748; m) 4112; O) 41 / 64 ; P) 478 25 / 32 .

4.10. A) 1111101 2 ; 1758; 7D 16 ; b) 11100101 2 ; 3458; E5 16 ; V) 1011000 2 ; 130 8 ; 58 16 ; G) 100101,01 2 ; 45,2 8 ; 25,4 16 ; e) 11001110.001 2 ; 316.18; CE,2 16 .

4.11. A) 11767.34 8 ; 13F7.7 16; b) 1653.5648; 3AB,BA 16 ; V) 271.5478; B9,B38 16 ; G) 13634.68; 179C,C16; e) 27.76748; 17,FBC 16 ; e) 1425.628; 315,C8 16 .

4.12. A) 1011001110 2 ; 1316 8 ; b) 1001111101000000 2 ; 117500 8 ; V) 10101011110011011110 2 ; 2536336 8 ; G) 1000000010000,000100000001 2 ; 10020,0401 8 ; e) 1101010111100,10011101 2 ; 15274,472 8 .

4.13. A) 101101 2 , 101110 2 , 101111 2 , 110000 2 ; b) 202 3 , 210 3 , 211 3 , 212 3 , 220 3 , 221 3 , 222 3 , 1000 3 ; V) 14 8 , 15 8 , 16 8 , 17 8 , 20 8 ; G) 28 16 , 29 16 , 2A 16 , 2B 16 , 2C 16 , 2D 16 , 2E 16 , 2F 16 , 30 16 ;

4.14. A) 47 10 - 101111 2 - 57 8 - 47 10 - 57 8 - 101111 2 - 2F 16 - 47 10 - 2F 16 - 101111 2 - 47 10 ; b) 79 10 - 1001111 2 - 117 8 - 79 10 - 117 8 - 1001111 2 - 4F 16 - 79 10 - 4F 16 - 1001111 2 - 79 10 .

+ 0 1 2 3 4
0 0 1 2 3 4
+ 0 1 2 1 1 2 3 4 10
0 0 1 2 2 2 3 4 10 11
1 1 2 10 3 3 4 10 11 12
2 2 10 11 4 4 10 11 12 13