Hardware and software setup

Number division number system online calculator. Arithmetic operations with numbers in positional number systems

Service assignment. 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 translate the number. You can enter both integers and numbers with a comma.

You can enter either whole numbers, such as 34 , or fractional numbers, such as 637.333 . For fractional numbers the accuracy of the translation after the comma 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 character 0...9, A, B, ..., F. Such a representation can be denoted in different ways, here only the character "h" is used after the last hexadecimal digit. For example, A5h. In program texts, the same number can be denoted both as 0xA5 and 0A5h, depending on the syntax of the programming language. A non-significant zero (0) is added to the left of the most significant hexadecimal digit represented by a letter to distinguish between numbers and symbolic names.
Decimals (decimal) numbers - each byte (word, double word) is represented by an ordinary number, and the sign of the decimal representation (letter "d") is usually omitted. The byte from 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 sometimes has to be done.
Octal (octal) numbers - each triple of bits (separation starts from the least significant) is written as a number 0-7, at the end the sign "o" is put. The same number would be written as 245o. The octal system is inconvenient in that the byte cannot be divided equally.

Algorithm for converting numbers from one number system to another

The conversion of integer 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 less than the base of the new number system. The new number is written as the remainder of the division, starting with the last one.
The conversion of the correct 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 reached. As a result of each multiplication operation, one digit of the new number is formed, starting from the highest.
The translation of an improper fraction is carried out according to the 1st and 2nd rules. The integer and fractional parts are written together, separated by a comma.

Example #1.



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

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

Example #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 hexadecimal, you must divide the number into parts, four digits each, following the same rules.
Example #3. 1010111010.1011 = 10.1011.1010.1011 = 2B12.13 HEX
here 0010=2; 1011=B; 1010=12; 1011=13

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

Example #4.
Example of converting 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 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 converting from hexadecimal to decimal number system. 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 translating numbers from one number system to another PSS

  1. From the decimal number system:
    • divide the number by the base of the number system being translated;
    • find the remainder after dividing the integer part of the number;
    • write down all remainders from division in reverse order;
  2. From the binary system
    • To convert to the decimal number system, you need to find the sum of the products of base 2 by the corresponding degree of discharge;
    • To convert a number to octal, you need to break the number into triads.
      For example, 1000110 = 1000 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 systems is expressed in a table.
Table of correspondence of number systems:
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 converting to octal number system

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

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

To translate the fractional part of a number, we successively multiply the fractional part by base 8. As a result, each time we write down the integer part of the product.
0.12*8 = 0.96 (whole part 0 )
0.96*8 = 7.68 (whole part 7 )
0.68*8 = 5.44 (whole part 5 )
0.44*8 = 3.52 (whole 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 decimal to octal.
Reverse conversion from octal to decimal.

To translate the integer part, it is necessary to multiply the digit of the number by the corresponding degree of digit.
144 = 8 2 *1 + 8 1 *4 + 8 0 *4 = 64 + 32 + 4 = 100

To translate the fractional part, it is necessary 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 due to a rounding error when converting to octal. This error can be reduced if we take a larger number of digits (for example, not 4, but 8).

Service assignment. Online calculator designed for addition binary numbers in direct, reverse and additional codes.

The following are also used with this calculator:
Converting numbers to binary, hexadecimal, decimal, octal number systems
Multiplication of binary numbers
Floating point format
Example #1. Express the number 133.54 as a floating point number.
Solution. Let's represent the number 133.54 in a normalized exponential form:
1.3354*10 2 = 1.3354*exp 10 2
The number 1.3354*exp 10 2 consists of two parts: the mantissa M=1.3354 and the exponent exp 10 =2
If the mantissa is in the range 1 ≤ M Representing a number in denormalized exponential form.
If the mantissa is in the range 0.1 ≤ M Let's represent the number in denormalized exponential form: 0.13354*exp 10 3

Example #2. Represent the binary number 101.10 2 in a normalized form, write in the 32-bit IEEE754 standard.
truth table


Limit Calculation

Arithmetic in binary system

Arithmetic operations in binary system are performed in the same way as in decimal. But, if in the decimal number system the transfer and loan are carried out by ten units, then in binary - by two units. The table shows the rules for addition and subtraction in the binary system.
  1. When adding two units in the binary number system, this bit will be 0 and there will be a transfer of one to the highest bit.
  2. When subtracting one from zero, one is borrowed from the highest order, where there is 1 . A unit occupied in this place gives two units in the place where the action is calculated, as well as one, in all intermediate places.

Adding numbers, taking into account their signs on the machine, is a sequence of the following actions:

  • converting the original numbers to the specified code;
  • bitwise addition of codes;
  • analysis of the result.
When performing an operation in an inverse (modified inverse) code, if as a result of addition a carry unit occurs in the sign bit, it is added to the least significant bit of the sum.
When performing an operation in an additional (modified additional) code, if as a result of addition a carry unit occurs in the sign bit, it is discarded.
The operation of subtraction in a computer is performed through addition according to the rule: X-Y=X+(-Y). Further actions are performed in the same way as for the addition operation.

Example #1.
Given: x=0.110001; y= -0.001001, add in reverse modified code.

Given: x=0.101001; y= -0.001101, add in additional modified code.

Example #2. Solve binary subtraction examples using the 1's complement and wrapping method.
a) 11 - 10.
Solution.
Let's represent the numbers 11 2 and -10 2 in the reverse code.

The binary number 0000011 has return code 0,0000011

Let's add the numbers 00000011 and 11111101

7 6 5 4 3 2 1 0
1
0 0 0 0 0 0 1 1
1 1 1 1 1 1 0 1
0

7 6 5 4 3 2 1 0
1 1
0 0 0 0 0 0 1 1
1 1 1 1 1 1 0 1
0 0

An overflow occurred in the 2nd bit (1 + 1 = 10). Therefore, we write 0, and transfer 1 to the 3rd bit.
7 6 5 4 3 2 1 0
1 1 1
0 0 0 0 0 0 1 1
1 1 1 1 1 1 0 1
0 0 0

7 6 5 4 3 2 1 0
1 1 1 1
0 0 0 0 0 0 1 1
1 1 1 1 1 1 0 1
0 0 0 0

7 6 5 4 3 2 1 0
1 1 1 1 1
0 0 0 0 0 0 1 1
1 1 1 1 1 1 0 1
0 0 0 0 0

7 6 5 4 3 2 1 0
1 1 1 1 1 1
0 0 0 0 0 0 1 1
1 1 1 1 1 1 0 1
0 0 0 0 0 0

7 6 5 4 3 2 1 0
1 1 1 1 1 1 1
0 0 0 0 0 0 1 1
1 1 1 1 1 1 0 1
0 0 0 0 0 0 0

7 6 5 4 3 2 1 0
1 1 1 1 1 1 1
0 0 0 0 0 0 1 1
1 1 1 1 1 1 0 1
0 0 0 0 0 0 0 0

As a result, we get:
7 6 5 4 3 2 1 0
1 1 1 1 1 1 1
0 0 0 0 0 0 1 1
1 1 1 1 1 1 0 1
0 0 0 0 0 0 0 0

There was a carry from the sign bit. Let's add it (i.e. 1) to the resulting number (thereby carrying out the cyclic transfer procedure).
As a result, we get:
7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 1

Addition result: 00000001. Convert to decimal representation. To translate the integer part, it is necessary to multiply the digit of the number by the corresponding degree of digit.
00000001 = 2 7 *0 + 2 6 *0 + 2 5 *0 + 2 4 *0 + 2 3 *0 + 2 2 *0 + 2 1 *0 + 2 0 *1 = 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 = 1
Addition result (in decimal notation): 1

b) 111-010 Let's represent the numbers 111 2 and -010 2 in the reverse code.
The reverse code for a positive number is the same as the direct code. For a negative number, all digits of the number are replaced by opposite ones (1 to 0, 0 to 1), and one is entered in the sign bit.
The binary number 0000111 has a return code of 0.0000111
The binary number 0000010 has a return code of 1.1111101
Let's add the numbers 00000111 and 11111101
An overflow occurred in the 0th bit (1 + 1 = 10). Therefore, we write 0, and transfer 1 to the 1st bit.

7 6 5 4 3 2 1 0
1
0 0 0 0 0 1 1 1
1 1 1 1 1 1 0 1
0

An overflow occurred in the 1st bit (1 + 1 = 10). Therefore, we write 0, and transfer 1 to the 2nd bit.
7 6 5 4 3 2 1 0
1 1
0 0 0 0 0 1 1 1
1 1 1 1 1 1 0 1
0 0

An overflow occurred in the 2nd bit (1 + 1 + 1 = 11). Therefore, we write 1, and transfer 1 to the 3rd digit.
7 6 5 4 3 2 1 0
1 1 1
0 0 0 0 0 1 1 1
1 1 1 1 1 1 0 1
1 0 0

An overflow occurred in the 3rd bit (1 + 1 = 10). Therefore, we write 0, and transfer 1 to the 4th bit.
7 6 5 4 3 2 1 0
1 1 1 1
0 0 0 0 0 1 1 1
1 1 1 1 1 1 0 1
0 1 0 0

An overflow occurred in the 4th bit (1 + 1 = 10). Therefore, we write 0, and transfer 1 to the 5th bit.
7 6 5 4 3 2 1 0
1 1 1 1 1
0 0 0 0 0 1 1 1
1 1 1 1 1 1 0 1
0 0 1 0 0

An overflow occurred in the 5th bit (1 + 1 = 10). Therefore, we write 0, and transfer 1 to the 6th bit.
7 6 5 4 3 2 1 0
1 1 1 1 1 1
0 0 0 0 0 1 1 1
1 1 1 1 1 1 0 1
0 0 0 1 0 0

An overflow occurred in the 6th bit (1 + 1 = 10). Therefore, we write 0, and transfer 1 to the 7th bit.
7 6 5 4 3 2 1 0
1 1 1 1 1 1 1
0 0 0 0 0 1 1 1
1 1 1 1 1 1 0 1
0 0 0 0 1 0 0

An overflow occurred in the 7th bit (1 + 1 = 10). Therefore, we write 0, and transfer 1 to the 8th bit.
7 6 5 4 3 2 1 0
1 1 1 1 1 1 1
0 0 0 0 0 1 1 1
1 1 1 1 1 1 0 1
0 0 0 0 0 1 0 0

As a result, we get:
7 6 5 4 3 2 1 0
1 1 1 1 1 1 1
0 0 0 0 0 1 1 1
1 1 1 1 1 1 0 1
0 0 0 0 0 1 0 0

There was a carry from the sign bit. Let's add it (i.e. 1) to the resulting number (thereby carrying out the cyclic transfer procedure).
As a result, we get:
7 6 5 4 3 2 1 0
0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 1
0 0 0 0 0 1 0 1

Addition result: 00000101
We got the number 00000101. To translate the integer part, it is necessary to multiply the digit of the number by the degree of the digit corresponding to it.
00000101 = 2 7 *0 + 2 6 *0 + 2 5 *0 + 2 4 *0 + 2 3 *0 + 2 2 *1 + 2 1 *0 + 2 0 *1 = 0 + 0 + 0 + 0 + 0 + 4 + 0 + 1 = 5
Addition result (in decimal notation): 5

Addition of binary floating point real numbers

In a computer, any number can be represented in floating point format. The floating point format is shown in the figure:


For example, the number 10101 in floating point format can be written like this:


Computers use a normalized form of notation, in which the position of the comma is always given before the significant digit of the mantissa, i.e. condition is met:
b -1 ≤|M| Normalized number - this is a number that has a significant digit after the decimal point (i.e. 1 in the binary number system). Normalization example:
0,00101*2 100 =0,101*2 10
111,1001*2 10 =0,111001*2 101
0,01101*2 -11 =0,1101*2 -100
11,1011*2 -101 =0,11011*2 -11

When adding floating point numbers, the alignment of orders is performed towards a higher order:

Floating point addition algorithm:

  1. Alignment of orders;
  2. Addition of mantissas in the additional modified code;
  3. Normalization of the result.

Example #4.
A=0.1011*2 10 , B=0.0001*2 11
1. Alignment of orders;
A=0.01011*2 11 , B=0.0001*2 11
2. Addition of mantissas in the additional modified code;
MA add. mod. =00.01011
MB additional mod. =00.0001
00,01011
+ 00,00010
=
00,01101
A+B=0.01101*2 11
3. Normalization of the result.
A+B=0.1101*2 10

Example #3. Write a decimal number in binary-decimal notation and add two numbers in binary notation.

Consider the basic arithmetic operations: addition, subtraction, multiplication and division. The rules for performing these operations in the decimal system are well known - this is addition, subtraction, multiplication by a column and division by an angle. These rules apply to all other positional number systems. You just need to use special addition and multiplication tables for each system.

1. Addition

Addition tables are easy to create using counting rules.

When adding, the numbers are summed up by digits, and if an excess occurs, then it is transferred to the left.

Example 1 Let's add the numbers 15 and 6 in different number systems.

Example 2 Let's add the numbers 15, 7 and 3.

Hexadecimal : F 16 +7 16 +3 16

15+7+3 = 25 10 = 11001 2 = 31 8 = 19 16 .

Examination:

11001 2 = 2 4 + 2 3 + 2 0 = 16+8+1=25,

31 8 = 3 . 8 1 + 1 . 8 0 = 24 + 1 = 25,

19 16 = 1 . 16 1 + 9 . 16 0 = 16+9 = 25.

Example 3 Let's add the numbers 141.5 and 59.75.

Answer: 141.5 + 59.75 = 201.25 10 = 11001001.01 2 = 311.2 8 = C9.4 16

Examination. Let's convert the received amounts to decimal form:

11001001,01 2 = 2 7 + 2 6 + 2 3 + 2 0 + 2 -2 = 201,25

311,2 8 = 3 . 8 2 + 1 . 8 1 + 1 . 8 0 + 2 . 8 -1 = 201,25

C9.4 16 = 12 . 16 1 + 9 . 16 0 + 4 . 16 -1 = 201,25

2. Subtraction

Subtraction in binary system

minuend

subtrahend

0

1

0

1

loan

Subtraction in hexadecimal number system

0

1

2

3

4

5

6

7

8

9

A

B

C

D

E

F

0

1

2

3

4

5

6

7

8

9

A

B

C

D

E

F

Borrowing a senior unit

Subtraction in octal number system

0

1

2

3

4

5

6

7

0

1

2

3

4

5

6

7

Loanhigh order units

Example 4 Subtract one from the numbers 10 2 , 10 8 and 10 16

Example 5 Subtract one from the numbers 100 2 , 100 8 and 100 16 .

Example 6 Subtract the number 59.75 from the number 201.25.

Answer: 201.25 10 - 59.75 10 = 141.5 10 = 10001101.1 2 = 215.4 8 = 8D.8 16.

Examination. Let's convert the resulting differences to decimal form:

10001101,1 2 = 2 7 + 2 3 + 2 2 + 2 0 + 2 -1 = 141,5;

215,4 8 = 2 . 8 2 + 1 . 8 1 + 5 . 8 0 + 4 . 8 -1 = 141,5;

8D,8 16 = 8 . 16 1+D . 16 0 + 8 . 16 -1 = 141,5.

How do we add in decimal notation?

Let's remember how we add numbers in the way we are already used to, in decimal.

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

Addition in binary is no different from addition in decimal. The main thing to remember is that the alphabet contains only two numbers: 0 and 1. Therefore, when we add 1 + 1, we get 0, and increase the number by another 1 digit. Look at the example above:

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

We analyzed one example, solve the second one yourself:

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

  1. Everything is as usual, we begin to fold from right to left. 4 + 3 = 7.
  2. 5 + 4 = 9. There can't be nine, so we subtract 8 from 9, we get 1. And add 1 more to the next digit.
  3. 3 + 7 + 1 = 11. Subtract 8 from 11, we get 3. And add one to the next digit.
  4. 6 + 1 = 7.
  5. There is nothing more to add. Answer: 7317.

Now do the addition yourself:

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

Subtraction in number systems

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

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

  1. We start as usual. 1 - 1 = 0.
  2. 1 – 0 = 1.
  3. You cannot subtract one from 0. Therefore, we will take one category from the elder. 2 - 1 = 1.
  4. Answer: 110.

Now decide for yourself:

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

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

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

Example for self solution:

Multiplication in number systems

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

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

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

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

Example for self solution:

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

Example for self solution:

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

For clarity, let's analyze the multiplication by 5 of the number 20A4.

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

An example for an independent solution.

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 number system that we use in everyday life is positional, while the Roman one 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 successive division of 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 during multiplication a number with a zero integer part is obtained, then zero is written to the left of it. The multiplication process continues until a pure zero is obtained in the fractional part or the required number of digits is obtained. Writing 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

Received:

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.

Liked the article? Share with friends!
Was this article helpful?
Yes
Not
Thanks for your feedback!
Something went wrong and your vote was not counted.
Thank you. Your message has been sent
Did you find an error in the text?
Select it, click Ctrl+Enter and we'll fix it!