Convert hexadecimal characters to decimal

How to convert hexadecimal to decimal?

Hexadecimal conversion to decimal method: “Expand and sum by weight”, example hexadecimal: (2AF5)H=2*16^3+10*16^2+15*16^1+5*16^0=8192+2560+240+5=10997.

Hexadecimal (English name: Hexadecimal), is a representation of data in computers. It is different from the representation in our daily life. It consists of 0-9, A-F, and the letters are not case sensitive. Correspondence with the decimal system is: 0-9 corresponds to 0-9; A-F corresponds to 10-15; the number of N can be expressed in 0 ~ (N-1), more than 9 with the letters A-F.

Decimal, that is, ① full of ten into one, full of twenty into two, and so on …… ② by the weight of the expansion of the first weight 10 ^0, the second bit 10^1 …… and so on, the Nth bit 10^(N-1), the value of the number is equal to the sum of the value of each bit * the corresponding weight of that bit.

The progressive counting system, also known as rounding, is a human-defined method of counting with rounding (there are methods of counting without rounding, such as the primitive knot counting, the “positive” counting commonly used for singing tickets, and similarly, tallymark counting). For any of these systems, the X system means that the numbers in each position are rounded to the nearest X. For decimal systems, the numbers are rounded to the nearest ten. In decimal, it’s one to ten, in hexadecimal it’s one to sixteen, in binary it’s one to two, and so on, and in x-advanced it’s one to x.

How to convert hexadecimal to decimal

Category:Computer/Network>>Hardware

Problem description:

How to convert hexadecimal to decimal?

Answer:

ABCD in hexadecimal = A x 16 x 16 x 16 + B x 16 x 16 + C x 16 + D x 1 in decimal

Same inference for other digits

How to convert hexadecimal to decimal?

The specific algorithm for converting hexadecimal to decimal is:

1. First understand that the hexadecimal number (counting from right to left is bit 0, bit 1, bit 2 ……) has a weight of 0 to the 0th power of 16, bit 1 has a weight of 1 to the 16th power, bit 2 has a weight of 2 to the 16th power and so on in this order.

2, understand that ABCDEF said the binary digits are 10, 11, 12, 13, 14, 15.

3, hexadecimal into decimal formula is: to be from right to left with the binary of each number to multiply by the corresponding square of 16, and then these numbers are added.

Example 1:

2AF5 converted to decimal:

Bit 0: 5 * 16 ^ 0 = 5

Bit 1: F * 16 ^ 1 = 15 * 16 ^ 1 = 240

Bit 2: A * 16 ^ 2 = 10 * 16 ^ 2 = 2560

Bit 3: 2 * 16 ^ 3 = 8192 knot

The result is: 5*16^0+15*16^1+10*16^2+2*16^3=10997

Example 2: CE converted to decimal:

Bit 0: E*16^0=14*16^0=14

Bit 1: C*16^1=12*16^1=192

The result is: 14*16^0+12*16^1=206

Theory of Conversion

1. Conversion of Binary and Hexadecimal Numbers to Decimal:

Using the Expansion by Weights method to convert an arbitrary R-ary number anan-1…. .a1a0.a-1a-2… .a-m into a decimal number whose decimal value is the sum of the product of each digit and its bitwise power.

an×Rn+an-1×Rn-1+…+a1×R1+a0×R0+a-1×R-1+a-2×R-2+…+a-m×R-m

2, decimal converted to R decimal number rotation into R decimal number to be divided into two parts: the integer part of the integer to be divided by R to take the Remainder, until the quotient is 0, the remainder of the binary digits, the remainder of the digits from right to left (reverse order). Fractional part to multiply R to get the integer, the integer that is binary digits, integers from left to right (sequential).

3, hexadecimal into binary: each hexadecimal number corresponds to four bits of binary, bit by bit expansion.

4, binary into hexadecimal: the binary number from the decimal point to the left (for binary integers) or to the right (for binary decimals) every four bits to form a group, less than four complementary zero.

Hexadecimal to decimal hexadecimal to decimal conversion

Conversion of hexadecimal is a way for people to use symbols to count, the conversion between hexadecimal and decimal. Including decimal to hexadecimal and hexadecimal to decimal, hexadecimal to decimal conversion of the specific algorithm is as follows a few points:

First of all, understand that the hexadecimal number of the 0th bit of the weight of the 0th power of 16, the first bit of the weight of the 1st power of the 1st power of 16, the 2nd bit of the weight of the 2nd power of 16, and so on in this way down the list

2. Understand that ABCDEF that the binary digits are 10, 11, 12, 13, 14, 15

3. Hexadecimal into decimal formula is: to go from right to left with the binary of each number to multiply by the corresponding power of 16, and then these numbers add up to be

In short, the hexadecimal system, that is, every 16 into 1, each bit on can be From small to large for 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, a total of 16 different sizes of numbers. hexadecimal conversion that is, hexadecimal conversion between the different systems