Decimal system, that is, carry system, is a carry method stipulated by people. For any binary system-X system, it refers to calculating every X number in a certain position into one bit. Decimal is a decimal one, hexadecimal is a hexadecimal one, binary is a binary one, and so on. The x system is every x carry.
share
concept
Carry system/position counting method is a counting method, so it is also called carry counting method/bit value counting method, which can represent all values with limited digital symbols. The number of digital symbols that can be used is called radix (en:radix) or radix. If the radix is n, it can be called N-ary, or N-ary for short. Decimal system is most commonly used now, and it is usually counted by 10 Arabic numerals 0-9.
For any number, we can use different carry systems to represent it. For example, the decimal number 57( 10) can be expressed as11(2) in binary, 2 12(5) in decimal and 765438+ in octal.
The numeration system, also known as the numeration system, refers to the method of representing numerical values with a set of fixed symbols and unified rules. Computer is a tool for information processing, and any information must be converted into binary data before it can be processed, stored and transmitted by computer.
Concept of position right
For formal binary representation, we can number each digit from 0, that is, the digit number is 0, 1, 2, ...; Symmetrically, the number after the decimal point is-1, -2, ...
In binary conversion, we might as well set the radix of the source system (the radix used before conversion) as R 1, the radix of the target system (the radix used after conversion) as R2, and the representation of the original value as ana (n-1) ... a2a1A0. A- 1A-。 There are (ana (n-1) ... a2a1a0.a-1a-2 ...) r1= (an * r n+a (n-1) * r (.
(Because the font can't be selected here, the explanation is as follows: in symbols such as an, A2, A- 1, n, 2,-1, the subscript should be added, and the power of the preceding mark should be added).
For example:
The decimal number is 1 10, where the hundredth 1 means 1 10 2, that is 100, and the tenth 1 means1.
A binary number 1 10, where the high order 1 means 1 2 2, that is, 4, and the low order 1 21,that is, 2, and the lowest order 0 means 0 2 0.
A hexadecimal number 1 10, where the high order 1 means 1 16 2, that is, 256, and the low order 1 means 1 1, that is, 6544.
It can be seen that in the digital system, the value represented by each bit is not only related to the size of the bit itself, but also related to the position of the bit. We call this relationship the bit weight of numbers.
The power of decimal number is based on 10, that of binary number is based on 2, and that of hexadecimal number is based on 16. The numbers are arranged in descending order from high to low.
Decimal conversion
1. Binary and hexadecimal numbers are converted into decimal numbers (weight sum)
The law of converting binary numbers and hexadecimal numbers into decimal numbers is the same. Binary numbers (or hexadecimal numbers) are expanded into polynomial sums in the form of bit weights, and the final sum is its corresponding decimal number-"weighted sum" for short.
For example, (100 1.0 1)2 is calculated in binary.
( 100 1.0 1)2
=8* 1+4*0+2*0+ 1* 1+0*( 1/2)+ 1*( 1/4)
=8+0+0+ 1+0+0.25
=9.25
Convert (38A. 1 1) 16 into a decimal number.
(38A. 1 1) 16
= 3×/the quadratic form of kloc-0/6+8×/the sixth form of kloc-0/6+/the tenth form of kloc-0/0×16+1power+6544.
=768+ 128+ 10+0.0625+0.0039
=906.0664
2. Decimal number is converted into binary number and hexadecimal number (except 2/ 16 remainder method).
Integer conversion. Decimal integers are usually converted into binary integers by dividing decimal numbers by two, that is, dividing decimal numbers by two continuously until the quotient is 0, and arranging the remainder in reverse order.
Example: Convert 25 to a binary number
25÷2= 12 remainder 1
12÷2=6 remainder 0
Similarly, when converting decimal numbers into hexadecimal numbers, you only need to convert the base 2 into 16.
Example: Convert 25 to a hexadecimal number
25÷ 16 = 1 remainder 9
116 = 0 remainder1
So 25=( 19) 16.
3. Conversion between binary number and hexadecimal number
Because the 4-bit binary number has the combination state of 16, that is, the hexadecimal number of 1 bit corresponds to the 4-bit binary number one by one, so the conversion between hexadecimal number and binary number is very simple.
(1) Hexadecimal numbers can be converted into binary numbers, as long as each hexadecimal number is changed into a corresponding 4-digit binary number-four digits for short.
Example: Convert (4AF8B) 16 to a binary number.
4 A F 8 B
0 100 10 10 1 1 1 1 1000 10 1 1
Therefore, (4af8b)16 = (1001111100655.
(2) Binary numbers are converted into hexadecimal numbers, and each group is written in turn.