• Convert numbers from one number system to another online. Converting numbers to binary, hexadecimal, decimal, octal number systems Multiplication and division in hexadecimal number system

    Purpose of the service. The online calculator is designed for adding binary numbers in forward, reverse and complement codes.

    The following are also used with this calculator:
    Converting numbers to binary, hexadecimal, decimal, octal number systems
    Multiplying binary numbers
    Floating point format
    Example No. 1. Represent the number 133.54 in floating point form.
    Solution. Let's represent the number 133.54 in 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 No. 2. Represent the binary number 101.10 2 in normalized form, written in the 32-bit IEEE754 standard.
    Truth table


    Calculation of limits

    Arithmetic in binary number system

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

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

    • converting the original numbers into the specified code;
    • bitwise addition of codes;
    • analysis of the obtained result.
    When performing an operation in reverse (modified reverse) code, if as a result of addition a carry unit appears in the sign bit, it is added to the low order bit of the sum.
    When performing an operation in two's complement (modified two's complement) code, if a carry unit appears in the sign bit as a result of addition, it is discarded.
    The subtraction operation 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 No. 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 No. 2. Solve examples on subtracting binary numbers using the 1's complement and cyclic carry method.
    a) 11 - 10.
    Solution.
    Let's imagine the numbers 11 2 and -10 2 in reverse code.

    The binary number 0000011 has a reciprocal code of 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 digit (1 + 1 = 10). Therefore, we write 0, and move 1 to the 3rd digit.
    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

    A carryover from the sign bit has occurred. Let's add it (i.e. 1) to the resulting number (thus 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

    The result of the addition: 00000001. Let's convert it to decimal representation. To translate an integer part, you need to multiply the digit of a 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 (decimal notation): 1

    b) 111-010 Let's imagine the numbers 111 2 and -010 2 in reverse code.
    The reverse code for a positive number is the same as the forward code. For a negative number, all digits of the number are replaced by their opposites (1 by 0, 0 by 1), and a unit is entered in the sign digit.
    The binary number 0000111 has a reciprocal code of 0.0000111
    The binary number 0000010 has a reciprocal code of 1.1111101
    Let's add the numbers 00000111 and 11111101
    An overflow occurred in the 0th digit (1 + 1 = 10). Therefore, we write 0, and move 1 to the 1st digit.

    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 digit (1 + 1 = 10). Therefore, we write 0, and move 1 to the 2nd digit.
    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 digit (1 + 1 + 1 = 11). Therefore, we write 1, and move 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 digit (1 + 1 = 10). Therefore, we write 0, and move 1 to the 4th digit.
    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 move 1 to the 5th digit.
    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 digit (1 + 1 = 10). Therefore, we write 0, and move 1 to the 6th digit.
    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 move 1 to the 7th digit.
    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 move 1 to the 8th digit.
    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

    A carryover from the sign bit has occurred. Let's add it (i.e. 1) to the resulting number (thus 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 convert the whole part, you need to multiply the digit of the number by the corresponding degree of digit.
    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 (decimal notation): 5

    Addition of binary floating point real numbers

    On 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 writing a number in which the position of the decimal point is always given before the significant digit of the mantissa, i.e. the 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, order alignment is performed towards a higher order:

    Algorithm for adding floating point numbers:

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

    Example No. 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 additional 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 No. 3. Write a decimal number in the binary number system and add two numbers in the binary number system.

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

    The result has already been received!

    Converting integers and fractions from one number system to any other - theory, examples and solutions

    There are positional and non-positional number systems. The Arabic number system, which we use in everyday life, is positional, but the Roman number system is not. In positional number systems, the position of a number uniquely determines the magnitude of the number. Let's 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 determines the number system (in this case it is 10). The values ​​of the position of a given number are taken as powers.

    Consider the real decimal number 1287.923. Let's number it starting from zero, position of the number from the decimal point to the left and 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 many digits (0,1,2,3,4,5,6,7,8,9), in the octal number system it consists of many digits (0,1, 2,3,4,5,6,7), in the binary number system - from a set of digits (0,1), in the hexadecimal number system - from a 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 the numbers 10,11,12,13,14,15. In the table Tab.1 numbers are presented 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 convert numbers from one number system to another, the easiest way is to first convert the number to the decimal number system, and then convert from the decimal number system to 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 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 number system to decimal SS. Solution:

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

    Converting numbers from the decimal number system to another number system

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

    The integer part of a number is converted from decimal SS to another number system by sequentially dividing the integer part of the number by the base of the number system (for binary SS - by 2, for 8-ary SS - by 8, for 16-ary SS - 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 can be seen from Fig. 1, the number 159 when divided by 2 gives the quotient 79 and remainder 1. Further, the number 79 when divided by 2 gives the quotient 39 and remainder 1, etc. As a result, constructing a number from division remainders (from right to left), we obtain 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 a decimal SS to an octal SS, you need to sequentially divide the number by 8 until you get an integer remainder less than 8. As a result, constructing a number from division remainders (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 convert 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, the remainders are 4, 12, 13, 9. In the hexadecimal number system, the number 12 corresponds to C, the number 13 to D. Therefore, our hexadecimal number is 4CD9.

    To convert regular decimal fractions (a real number with a zero integer part) into a number system with base s, it is necessary to sequentially multiply this number by s until the fractional part is pure zero, or we obtain the required number of digits. If, during multiplication, a number with an integer part other than zero is obtained, 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 convert 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 sequentially 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 the multiplication results in a number with a zero integer part, then a zero is written to the left of it. The multiplication process continues until the fractional part reaches a pure zero or we obtain the required number of digits. Writing 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 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, the result is 0. Consequently, the following result is obtained:

    0.125 10 =0.001 2 .

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

    0.214 10 =0.36C8B4 16 .

    Example 10 . Let's convert the number 0.512 from the decimal number system to 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 convert 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). Further combining these results we get:

    159.125 10 =10011111.001 2 .

    Example 12 . Let's convert 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 obtain.

    Examples of converting numbers to different number systems

    Example No. 1
    Let's convert the number 12 from decimal to binary number system
    Solution

    Let's convert the number 12 10 to the 2-ary number system, using sequential division by 2, until the incomplete quotient is equal to zero. The result will be a number from division remainders written from right to left.

    12 : 2 = 6 remainder: 0
    6 : 2 = 3 remainder: 0
    3 : 2 = 1 balance: 1
    1 : 2 = 0 balance: 1

    12 10 = 1100 2

    Example No. 2
    Let's convert the number 12.3 from decimal to binary number system

    12.3 10 = 1100.010011001100110011001100110011 2

    Solution

    Let's convert the integer part of the 12th number 12.3 10 into the 2-ary number system, using sequential division by 2, until the incomplete quotient is equal to zero. The result will be a number from division remainders written from right to left.

    12 : 2 = 6 remainder: 0
    6 : 2 = 3 remainder: 0
    3 : 2 = 1 balance: 1
    1 : 2 = 0 balance: 1

    12 10 = 1100 2

    Let's convert the fractional part 0.3 of the number 12.3 10 into the 2-ary number system, using sequential multiplication by 2, until the fractional part of the product turns out to be zero or the required number of decimal places is reached. If the result of multiplication is that the integer part is not equal to zero, then it is necessary to replace the value of the integer part with zero. The result will be a number from the integer parts of the works, written from left to right.

    0.3 · 2 = 0 .6
    0.6 · 2 = 1 .2
    0.2 · 2 = 0 .4
    0.4 · 2 = 0 .8
    0.8 · 2 = 1 .6
    0.6 · 2 = 1 .2
    0.2 · 2 = 0 .4
    0.4 · 2 = 0 .8
    0.8 · 2 = 1 .6
    0.6 · 2 = 1 .2
    0.2 · 2 = 0 .4
    0.4 · 2 = 0 .8
    0.8 · 2 = 1 .6
    0.6 · 2 = 1 .2
    0.2 · 2 = 0 .4
    0.4 · 2 = 0 .8
    0.8 · 2 = 1 .6
    0.6 · 2 = 1 .2
    0.2 · 2 = 0 .4
    0.4 · 2 = 0 .8
    0.8 · 2 = 1 .6
    0.6 · 2 = 1 .2
    0.2 · 2 = 0 .4
    0.4 · 2 = 0 .8
    0.8 · 2 = 1 .6
    0.6 · 2 = 1 .2
    0.2 · 2 = 0 .4
    0.4 · 2 = 0 .8
    0.8 · 2 = 1 .6
    0.6 · 2 = 1 .2

    0.3 10 = 0.010011001100110011001100110011 2
    12.3 10 = 1100.010011001100110011001100110011 2

    Example No. 3
    Let's convert the number 10011 from the binary system to the decimal number system
    Solution

    Let's convert the number 10011 2 to the decimal number system; to do this, first write down the position of each digit in the number from right to left, starting from zero

    Each digit position will be a power of 2, since the number system is 2-digit. It is necessary to sequentially multiply each number 10011 2 by 2 to the power of the corresponding position of the number and then add it, followed by the product of the next number to the power of its corresponding position.

    10011 2 = 1 ⋅ 2 4 + 0 ⋅ 2 3 + 0 ⋅ 2 2 + 1 ⋅ 2 1 + 1 ⋅ 2 0 = 19 10

    Example No. 4
    Let's convert the number 11.101 from the binary system to the decimal number system

    11.101 2 = 3.625 10

    Solution

    Let's convert the number 11.101 2 to the decimal number system; to do this, first write down the position of each digit in the number

    Each digit position will be a power of 2, since the number system is 2-digit. It is necessary to sequentially multiply each number 11.101 2 by 2 to the power of the corresponding position of the number and then add it, followed by the product of the next number to the power of its corresponding position.

    11.101 2 = 1 ⋅ 2 1 + 1 ⋅ 2 0 + 1 ⋅ 2 -1 + 0 ⋅ 2 -2 + 1 ⋅ 2 -3 = 3.625 10

    Example No. 5
    Let's convert the number 1583 from the decimal system to the hexadecimal number system

    1583 10 = 62F 16

    Solution

    Let's convert the number 1583 10 to the 16-ary number system, using sequential division by 16, until the incomplete quotient is equal to zero. The result will be a number from division remainders written from right to left.

    1583 : 16 = 98 remainder: 15, 15 = F
    98 : 16 = 6 balance: 2
    6 : 16 = 0 balance: 6

    1583 10 = 62F 16

    Example No. 6
    Let's convert the number 1583.56 from the decimal system to the hexadecimal number system

    1583.56 10 = 62F.8F5C28F5C28F5C28F5C28F5C28F5C2 16

    Solution

    Let's convert the integer part 1583 of the number 1583.56 10 into the 16-ary number system, using sequential division by 16, until the incomplete quotient is equal to zero. The result will be a number from division remainders written from right to left.

    1583 : 16 = 98 remainder: 15, 15 = F
    98 : 16 = 6 balance: 2
    6 : 16 = 0 balance: 6

    1583 10 = 62F 16

    Let's convert the fractional part 0.56 of the number 1583.56 10 into the 16-ary number system, using sequential multiplication by 16, until the fractional part of the product turns out to be zero or the required number of decimal places is reached. If the result of multiplication is that the integer part is not equal to zero, then it is necessary to replace the value of the integer part with zero. The result will be a number from the integer parts of the works, written from left to right.

    0.56 · 16 = 8 .96
    0.96 · 16 = 15 .36, 15 = F
    0.36 · 16 = 5 .76
    0.76 · 16 = 12 .16, 12 = C
    0.16 · 16 = 2 .56
    0.56 · 16 = 8 .96
    0.96 · 16 = 15 .36, 15 = F
    0.36 · 16 = 5 .76
    0.76 · 16 = 12 .16, 12 = C
    0.16 · 16 = 2 .56
    0.56 · 16 = 8 .96
    0.96 · 16 = 15 .36, 15 = F
    0.36 · 16 = 5 .76
    0.76 · 16 = 12 .16, 12 = C
    0.16 · 16 = 2 .56
    0.56 · 16 = 8 .96
    0.96 · 16 = 15 .36, 15 = F
    0.36 · 16 = 5 .76
    0.76 · 16 = 12 .16, 12 = C
    0.16 · 16 = 2 .56
    0.56 · 16 = 8 .96
    0.96 · 16 = 15 .36, 15 = F
    0.36 · 16 = 5 .76
    0.76 · 16 = 12 .16, 12 = C
    0.16 · 16 = 2 .56
    0.56 · 16 = 8 .96
    0.96 · 16 = 15 .36, 15 = F
    0.36 · 16 = 5 .76
    0.76 · 16 = 12 .16, 12 = C
    0.16 · 16 = 2 .56

    0.56 10 = 0.8F5C28F5C28F5C28F5C28F5C28F5C2 16
    1583.56 10 = 62F.8F5C28F5C28F5C28F5C28F5C28F5C2 16

    Example No. 7
    Let's convert the number A12DCF from the hexadecimal system to the decimal number system

    A12DCF 16 = 10563023 10

    Solution

    Let's convert the number A12DCF 16 to the decimal number system; to do this, first write down the position of each digit in the number from right to left, starting from zero

    Each digit position will be a power of 16, since the number system is 16-digit. It is necessary to sequentially multiply each number A12DCF 16 by 16 to the power of the corresponding position of the number and then add it, followed by the product of the next number to the power of its corresponding position.
    2

    1 0 -1 -2 -3 NumberA1 2 DCF1 2 A
    Each digit position will be a power of 16, since the number system is 16-digit. It is necessary to sequentially multiply each number A12DCF.12A 16 by 16 to the power of the corresponding position of the number and then add, followed by the product of the next number to the power of its corresponding position.
    A 16 = 10 10
    D 16 = 13 10
    C 16 = 12 10
    F 16 = 15 10

    A12DCF.12A 16 = 10 ⋅ 16 5 + 1 ⋅ 16 4 + 2 ⋅ 16 3 + 13 ⋅ 16 2 + 12 ⋅ 16 1 + 15 ⋅ 16 0 + 1 ⋅ 16 -1

    1 0 Number1 0 1 0 1 0 0 0 1 1
    Each digit position will be a power of 2, since the number system is 2-digit. It is necessary to sequentially multiply each number 1010100011 2 by 2 to the power of the corresponding position of the number and then add, followed by the product of the next number to the power of its corresponding position.

    1010100011 2 = 1 ⋅ 2 9 + 0 ⋅ 2 8 + 1 ⋅ 2 7 + 0 ⋅ 2 6 + 1 ⋅ 2 5 + 0 ⋅ 2 4 + 0 ⋅ 2 3 + 0 ⋅ 2 2 + 1 ⋅ 2 1 + 1 ⋅ 2 0 = 675 10

    Let's convert the number 675 10 to the 16-ary number system, using sequential division by 16, until the partial quotient is equal to zero. The result will be a number from division remainders written from right to left.

    675 : 16 = 42 remainder: 3
    42 : 16 = 2 remainder: 10, 10 = A
    2 : 16 = 0 balance: 2

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

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

    The following are also used with this calculator:

    Ways to represent numbers

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

    Algorithm for converting numbers from one number system to another

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

    Example No. 1.



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

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

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

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

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

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

    1010010.101 2 = 1·2 6 +0·2 5 +1·2 4 +0·2 3 +0·2 2 +1·2 1 +0·2 0 + 1·2 -1 +0·2 - 2 +1 2 -3 =
    = 64+0+16+0+0+2+0+0.5+0+0.125 = 82.625 10 An example of conversion from octal to decimal number system. 108.5 8 = 1*·8 2 +0·8 1 +8·8 0 + 5·8 -1 = 64+0+8+0.625 = 72.625 10 An example of conversion from hexadecimal to decimal number system. 108.5 16 = 1·16 2 +0·16 1 +8·16 0 + 5·16 -1 = 256+0+8+0.3125 = 264.3125 10

    Once again we repeat the algorithm for converting numbers from one number system to another PSS

    1. From the decimal number system:
      • divide the number by the base of the number system being translated;
      • find the remainder when dividing an integer part of a number;
      • write down all remainders from division in reverse order;
    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).