From one ss to another. Conversion from one number system to another

Purpose of the service. The service is designed to convert numbers from one number system to another in online mode. 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.

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 new system numbering until the remainder remains a number smaller 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
  2. 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, for which the significance or weight of a digit depends on its location in the number. The relationship between the systems is expressed in a table.
Number system correspondence table:
Binary SSHexadecimal SS
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

Table for conversion to octal number system

Example No. 2. Convert the number 100.12 from the decimal number system to the octal number system and vice versa. Explain the reasons for the discrepancies.
Solution.
Stage 1. .

We write the remainder of the division in reverse order. We get the number in the 8th number system: 144
100 = 144 8

To convert the fractional part of a number, we sequentially multiply the fractional part by base 8. As a result, each time we write down the whole part of the product.
0.12*8 = 0.96 (integer part 0 )
0.96*8 = 7.68 (integer part 7 )
0.68*8 = 5.44 (integer part 5 )
0.44*8 = 3.52 (integer part 3 )
We get the number in the 8th number system: 0753.
0.12 = 0.753 8

100,12 10 = 144,0753 8

Stage 2. Converting a number from the decimal number system to the octal number system.
Reverse conversion from octal number system to decimal.

To translate an integer part, you need to multiply the digit of a number by the corresponding degree of digit.
144 = 8 2 *1 + 8 1 *4 + 8 0 *4 = 64 + 32 + 4 = 100

To convert the fractional part, you need to divide the digit of the number by the corresponding degree of digit
0753 = 8 -1 *0 + 8 -2 *7 + 8 -3 *5 + 8 -4 *3 = 0.119873046875 = 0.1199

144,0753 8 = 100,96 10
The difference of 0.0001 (100.12 - 100.1199) is explained by a rounding error when converting to the octal number system. This error can be reduced if you take a larger number of digits (for example, not 4, but 8).

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?

IN Unified State Exam program in computer science includes several tasks related to the translation of 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 digits 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.

The calculator allows you to convert whole and fractional numbers from one number system to another. The base of the number system cannot be less than 2 and more than 36 (10 digits and 26 Latin letters after all). The length of numbers must not exceed 30 characters. To enter fractional numbers, use the symbol. or, . To convert a number from one system to another, enter the original number in the first field, the base of the original number system in the second, and the base of the number system to which you want to convert the number in the third field, then click the "Get Record" button.

Original number written in 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 -th number system.

I want to get a number written in 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 -th number system.

Get entry

Translations completed: 3036712

You may also be interested:

  • Truth table calculator. SDNF. SKNF. Zhegalkin polynomial

Number systems

Number systems are divided into two types: positional And not positional. We use the Arabic system, it is positional, but there is also the Roman system - it is not positional. In positional systems, the position of a digit in a number uniquely determines the value of that number. This is easy to understand by looking at some number as an example.

Example 1. Let's take the number 5921 in the decimal number system. Let's number the number from right to left starting from zero:

The number 5921 can be written in the following form: 5921 = 5000+900+20+1 = 5·10 3 +9·10 2 +2·10 1 +1·10 0 . The number 10 is a characteristic that defines the number system. The values ​​of the position of a given number are taken as powers.

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

The number 1234.567 can be written in the following form: 1234.567 = 1000+200+30+4+0.5+0.06+0.007 = 1·10 3 +2·10 2 +3·10 1 +4·10 0 +5·10 -1 + 6·10 -2 +7·10 -3 .

Converting numbers from one number system to another

Most in a simple way converting a number from one number system to another is to first convert the number into a decimal number system, and then the resulting result into the required number system.

Converting numbers from any number system to the decimal number system

To convert a number from any number system to decimal, it is enough to number its digits, starting with zero (the digit to the left of the decimal point) similarly to examples 1 or 2. Let's find the sum of the products of the digits of the number by the base of the number system to the power of the position of this digit:

1. Convert the number 1001101.1101 2 to the decimal number system.
Solution: 10011.1101 2 = 1·2 4 +0·2 3 +0·2 2 +1·2 1 +1·2 0 +1·2 -1 +1·2 -2 +0·2 -3 +1·2 - 4 = 16+2+1+0.5+0.25+0.0625 = 19.8125 10
Answer: 10011.1101 2 = 19.8125 10

2. Convert the number E8F.2D 16 to the decimal number system.
Solution: E8F.2D 16 = 14·16 2 +8·16 1 +15·16 0 +2·16 -1 +13·16 -2 = 3584+128+15+0.125+0.05078125 = 3727.17578125 10
Answer: E8F.2D 16 = 3727.17578125 10

Converting numbers from the decimal number system to another number system

To convert numbers from the decimal number system to another number system, the integer and fractional parts of the number must be converted separately.

Converting an integer part of a number from a decimal number system to another number system

An integer part is converted from a decimal number system to another number system by sequentially dividing the integer part of a number by the base of the number system until a whole remainder is obtained that is less than the base of the number system. The result of the translation will be a record of the remainder, starting with the last one.

3. Convert the number 273 10 to the octal number system.
Solution: 273 / 8 = 34 and remainder 1. 34 / 8 = 4 and remainder 2. 4 is less than 8, so the calculation is complete. The record from the balances will look like this: 421
Examination: 4·8 2 +2·8 1 +1·8 0 = 256+16+1 = 273 = 273, the result is the same. This means the translation was done correctly.
Answer: 273 10 = 421 8

Let's consider the translation of regular decimal fractions into various number systems.

Converting the fractional part of a number from the decimal number system to another number system

Recall that a proper decimal fraction is called real number with zero integer part. To convert such a number into a number system with base N, you need to sequentially multiply the number by N until fraction will not reset or the required number of digits will not be received. If, during multiplication, a number with an integer part other than zero is obtained, then the integer part is not taken into account further, since it is sequentially entered into the result.

4. Convert the number 0.125 10 to the binary number system.
Solution: 0.125·2 = 0.25 (0 is the integer part, which will become the first digit of the result), 0.25·2 = 0.5 (0 is the second digit of the result), 0.5·2 = 1.0 (1 is the third digit of the result, and since the fractional part is zero , then the translation is completed).
Answer: 0.125 10 = 0.001 2

People did not immediately learn to count. Primitive society focused on a small number of objects - one or two. Anything larger was called “many” by default. This is what is considered the beginning of the modern number system.

Brief historical background

In the process of development of civilization, people began to feel the need to separate small collections of objects united by common characteristics. Corresponding concepts began to arise: “three”, “four” and so on up to “seven”. However, this was a closed, limited series, the last concept in which continued to carry the semantic load of the earlier “many”. A striking example of this is folklore, which has come down to us in its original form (for example, the proverb “Measure seven times, cut once”).

The emergence of complex counting methods

Over time, life and all processes of human activity became more complex. This, in turn, led to the emergence of a more complex number system. At the same time, people used the simplest counting tools for clarity of expression. They found them around them: they drew sticks on the walls of the cave using improvised means, made notches, laid out numbers of interest to them from sticks and stones - this is just a small list of the diversity that existed then. Subsequently, modern scientists this species was given the unique name "unary number system". Its essence is to write a number using a single type of symbol. Today this is the most convenient system that allows you to visually compare the number of objects and signs. It was most widespread in primary schools (counting sticks). Modern devices in their various modifications can easily be considered the legacy of the “pebble counting”. The emergence of the modern word “calculation” is also interesting, the roots of which come from the Latin calculus, which is translated as “pebble”.

Counting on fingers

Given the extremely meager vocabulary of primitive man, gestures quite often served as an important addition to the transmitted information. The advantage of the fingers was their versatility and their constant presence with the object that wanted to convey information. However, there are also significant disadvantages: significant limitation and short duration of transmission. Therefore, the entire count of people who used the “finger method” was limited to numbers that are multiples of the number of fingers: 5 - corresponds to the number of fingers on one hand; 10 - on both hands; 20 is the total number on the arms and legs. Due to the relatively slow development of the numerical stock this system lasted for quite a long period of time.

First improvements

With the development of the number system and the expansion of the capabilities and needs of mankind, the maximum number used in the cultures of many nations became 40. It was also understood as an indefinite (uncountable) quantity. In Rus', the expression “forty forties” has become widespread. Its meaning boiled down to the number of objects that cannot be counted. The next stage of development is the appearance of the number 100. Then division into tens began. Subsequently, the numbers 1000, 10,000, and so on began to appear, each of which carried a semantic load similar to seven and forty. In the modern world, the boundaries of the final account are not defined. Today, the universal concept of “infinity” has been introduced.

Whole and fractional numbers

Modern calculus systems take one as the smallest number of items. In most cases it is an indivisible quantity. However, with more accurate measurements, it is also subject to crushing. It is with this that the concept that appeared at a certain stage of development is connected fractional number. For example, the Babylonian system of money (scales) was 60 min, which was equal to 1 talan. In turn, 1 mina was equal to 60 shekels. It was on this basis that Babylonian mathematics widely used sexagesimal division. Fractions widely used in Russia came to us from the ancient Greeks and Indians. Moreover, the records themselves are identical to Indian ones. A minor difference is the absence of a fractional line in the latter. The Greeks wrote the numerator at the top and the denominator at the bottom. The Indian version of writing fractions was widely developed in Asia and Europe thanks to two scientists: Muhammad of Khorezm and Leonardo Fibonacci. The Roman number system equated 12 units, called ounces, to a whole (1 ass); accordingly, all calculations were based on duodecimal fractions. Along with the generally accepted ones, special divisions were also often used. For example, until the 17th century, astronomers used the so-called sexagesimal fractions, which were later replaced by decimal fractions (introduced into use by Simon Stevin, a scientist-engineer). As a result of further progress of mankind, the need arose for an even more significant expansion of the number series. This is how negative, irrational and familiar zero appeared relatively recently. It began to be used when introduced into modern systems calculus of negative numbers.

Using a non-positional alphabet

What is such an alphabet? It is characteristic of this number system that the meaning of the numbers does not change depending on their arrangement. A non-positional alphabet is characterized by the presence of an unlimited number of elements. Systems built on the basis of this type of alphabet are based on the principle of additivity. In other words, the total value of a number consists of the sum of all the digits that the entry includes. The emergence of non-positional systems occurred earlier than positional ones. Depending on the method of counting, the total value of a number is determined as the difference or sum of all the digits that make up the number.

There are disadvantages to such systems. Among the main ones we should highlight:

  • introducing new numbers when forming a large number;
  • inability to reflect negative and fractional numbers;
  • difficulty performing arithmetic operations.

Throughout human history, various number systems have been used. The most famous are: Greek, Roman, alphabetic, unary, ancient Egyptian, Babylonian.

One of the most common counting methods

Preserved to this day almost unchanged, it is one of the most famous. It is used to indicate various dates, including anniversaries. It has also found wide application in literature, science and other areas of life. The Roman number system uses only seven letters, each of which corresponds to a specific number: I = 1; V = 5; X = 10; L = 50; C = 100; D = 500; M = 1000.

Emergence

The very origin of Roman numerals is unclear; history has not preserved exact data on their appearance. At the same time, the fact is undeniable: the fivefold number system had a significant influence on Roman numbering. However, there is no mention of it in Latin. On this basis, a hypothesis arose about the ancient Romans borrowing their system from another people (presumably from the Etruscans).

Peculiarities

All integers (up to 5000) are written by repeating the numbers described above. Key Feature is the arrangement of signs:

  • addition occurs under the condition that the larger comes before the smaller (XI = 11);
  • subtraction occurs if a smaller digit comes before a larger one (IX = 9);
  • the same character cannot appear more than three times in a row (for example, 90 is written XC instead of LXXXX).

Its disadvantage is the inconvenience of performing arithmetic operations. However, it existed for quite a long time and ceased to be used in Europe as the main number system relatively recently - in the 16th century.

The Roman number system is not considered to be completely non-positional. This is due to the fact that in some cases the smaller number is subtracted from the larger one (for example, IX = 9).

Method of counting in Ancient Egypt

The third millennium BC is considered the moment of the emergence of the number system in Ancient Egypt. Its essence was to write the numbers 1, 10, 102, 104, 105, 106, 107 with special characters. All other numbers were written as a combination of these original characters. At the same time, there was a restriction - each digit had to be repeated no more than nine times. This method of counting, which modern scientists call the “non-positional decimal system,” is based on a simple principle. Its meaning is that the written number was equal to the sum of all the digits of which it consisted.

Unary counting method

A number system in which one sign is used when writing numbers - I - is called unary. Each subsequent number is obtained by adding a new I to the previous one. In this case, the number of such I is equal to the value of the number written using them.

Octal number system

This is a positional method of counting, based on the number 8. To display numbers, a digital series from 0 to 7 is used. This system is widely used in the production and use of digital devices. Its main advantage is the easy translation of numbers. They can be converted to and from. These manipulations are carried out by replacing numbers. From the octal system they are converted to binary triplets (for example, 28 = 0102, 68 = 1102). This method of counting was widespread in the field of computer production and programming.

Hexadecimal number system

Recently, this method of calculation has been used quite actively in the computer field. At the root of this system is the base - 16. The number system based on it involves the use of numbers from 0 to 9 and a number of letters of the Latin alphabet (from A to F), which are used to indicate the interval from 1010 to 1510. This method of counting as has already been noted, used in production software and documentation related to computers and their components. This is based on properties modern computer, the basic unit of which is 8-bit memory. It is convenient to convert and write it using two hexadecimal digits. The founder of this process was the IBM/360 system. This is the first time the documentation for it has been translated this way. The Unicode standard requires that any character be written in hexadecimal using at least 4 digits.

Recording methods

The mathematical design of the counting method is based on indicating it in a subscript in the decimal system. For example, the number 1444 is written as 144410. Programming languages ​​for writing hexadecimal systems have different syntaxes:


Conclusion

How they are studied Computer science is the main discipline within which the accumulation of data is carried out, the process of their design in a form convenient for consumption. Using special tools, all available information is processed and translated into a programming language. It is further used to create software and computer documentation. By studying various calculus systems, computer science involves the use, as mentioned above, of different tools. Many of them contribute to the implementation quick translation numbers. One of these “tools” is the table of number systems. It is quite convenient to use. Using these tables, you can, for example, quickly convert a number from hexadecimal to binary without having any special scientific knowledge. Today, almost every person interested in this has the opportunity to carry out digital transformations, since the necessary tools are offered to users on open resources. In addition, there are online translation programs. This greatly simplifies the task of converting numbers and reduces operation time.

1. Ordinal counting various systems Reckoning.

In modern life, we use positional number systems, that is, systems in which the number denoted by a digit depends on the position of the digit in the notation of the number. Therefore, in the future we will talk only about them, omitting the term “positional”.

In order to learn how to convert numbers from one system to another, we will understand how sequential recording of numbers occurs using the example of the decimal system.

Since we have a decimal number system, we have 10 symbols (digits) to construct numbers. We start counting: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. The numbers are over. We increase the bit depth of the number and reset the low-order digit: 10. Then we increase the low-order digit again until all the digits are gone: 11, 12, 13, 14, 15, 16, 17, 18, 19. We increase the high-order digit by 1 and reset the low-order digit: 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 introduce the notation 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 greater 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-digit system, in addition to ten digits, we need two letters ( and ):

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 the decimal number system to any other.

To convert a positive integer 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 down in one line the last quotient and all remainders, starting from the last.

Example 1. Let's convert the decimal number 46 to the binary number system.

Example 2. Let's convert the decimal number 672 to the octal number system.

Example 3. Let's convert the decimal number 934 to the hexadecimal number system.

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 for a decimal number.
For example, the 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 powers of the base of the number system. For example, let's take the number 1201 in the ternary number system. Let's number the digits from right to left starting from zero and imagine our number as the sum of the products of a digit and three to the power of the digit of the number:

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

Example 4. Let's convert the octal number 511 to the decimal number system.

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 binary number In a number with the 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 of the new number system.

For example, Let's convert the binary number 1100001111010110 to the octal system. To do this, we will 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 number:

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

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

Those.

Example 6. Let's convert the binary number 1100001111010110 to hexadecimal.

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. Conversion from a system with the base “power of two” (4, 8, 16, etc.) to binary.

This translation is similar to the previous one, made in reverse side: We replace each digit with a group of binary digits from the lookup table.

Example 7. Let's convert the hexadecimal number C3A6 to the binary number system.

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



mob_info