The specific algorithm for hexadecimal to decimal conversion?
The specific algorithm for converting hexadecimal to decimal is:
1. First understand that the hexadecimal number (counting from right to left is the 0th bit, the 1st bit, the 2nd bit ……) has the 0th bit with the weight of 0 to the power of 16, the 1st bit with the weight of 1 to the power of 16, the 2nd bit with the weight of 2 to the power of 16 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.
In the conversion of a basic principle:
Conversion of the expression of the “amount” of how much can not be changed. There are as many 111 apples in binary as there are 7 apples in decimal.
The digits in decimal are arranged like this …… million thousand hundred ten tenths percent thousandths ……
The digits in R are arranged like this ……R ^4R^3R^2R^1R^0R^-1R^-2R^-3……
It can be seen that neighboring digits differ from each other by one square of the progression.
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 the 0th, 1st, and 2nd ……) has the weight of the 0th digit as the 0th power of 16, the 1st digit as the 1st power of 16, the 2nd digit as the 2nd power of 16 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.
How to calculate hexadecimal to decimal?
Decimal to hexadecimal calculation, simply put, the integer divided by 16 to take the remainder until the quotient is 0, and then read from the last remainder to the first
Hexadecimal to decimal calculation, according to the power to expand and add up to get the decimal number.
How to convert hexadecimal to decimal
The steps to convert hexadecimal to decimal are as follows:
1, 0~F represent the numbers 0,1…. .14,15.
2, calculated from right to left, the first number is multiplied by the 0th power of 16, the second number is multiplied by the 1st power of 16, the third number is multiplied by the 2nd power of 16 …. and so on inwards.
3. Sum the results of the second step is the conversion result.
For example: 246AH conversion process is as follows:
First: A — “10 * 1 = 10
Second: 6 — “6 * 16 = 96
Third: 4 — “4 * 16 * 16 = 1024
Fourth: 2 — “2 * 16 * 16 * 16 = 8192
So the result is: 246AH=10+96+1024+8192=9322 (10)
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 the similar 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.