Current location - Training Enrollment Network - Mathematics courses - How to change one system into other systems in senior one mathematics?
How to change one system into other systems in senior one mathematics?
1 .10-> 2 gives a decimal number, such as 6. What if it is converted into a binary number? 10 binary number is converted into binary number, which is a process of continuous division by 2: divide the number to be converted by 2 to get quotient and remainder, and continue to divide the quotient by 2 until the quotient is 0. Finally, all the remainders are arranged in reverse order, and the number obtained is the conversion result. Sounds a little confused? Let's give an example. For example, convert 6 into a binary number. Divide the number to be converted by 2 to get the quotient and remainder. Then: the number to be converted in the ten-to-two diagram is 6,6 ÷ 2, the quotient is 3, and the remainder is 0. "Continue to divide the quotient by 2 until the quotient is 0 …" Now the quotient is 3, not 0, continue to divide by 2. Then: 3 ÷ 2, the quotient is 1, and the remainder is 1. "Divide the quotient by 2 until the quotient is 0 ..." Now the quotient is 1, not 0. Continue to divide by 2. Then: 1 ÷ 2, the quotient is 0 and the remainder is 1. "continue to divide the quotient by 2 until the quotient is 0 ... and finally arrange all the remainders in reverse order" great! Now the quotient is already 0. We get the remainder by three operations: 0, 1 and 1, and arrange all the remainder in reverse order, that is, 1 10! Hex, the result is 1 10. If the above paragraph is expressed in a table, it is: the quotient remainder of dividend calculation process is 66/23033/211/201(in computer, with /) 2. When 2-. Decimal number is converted into decimal number, the weight of the zeroth bit of binary number is 2 to the power of 0, and the weight of 1 bit is 2 to the power of 1 ... so there is a binary number: 01100. Convert to 10 decimal: The following is vertical: 01000100 Convert to the power of 0 * 2 of decimal ""0 = 0100 * 21= 0 2. 2 3 = 0 Fourth digit 0 * 2 4 = 0 Fifth digit 1 * 2 5 = 32 Sixth digit 1 * 2 6 = 64 Seventh digit 0 * 2 7 = 0+-. What is the multiple of 21+1* 22+0 * 24+1* 25+1* 26+0 * 27 =1000? Therefore, we can also skip the bits with the value of 0 directly:1* 22+1* 25+1* 26 =1003. The method of converting decimal number of ten -> 10 into octal number is similar to that of converting it into binary number, the only change is that the divisor is changed from 2 to 8. Let's look at an example of how to convert decimal number 120 into octal number. Table shows that the quotient remainder in the dividend calculation process is120120/815/8171128. 4.VIII- > octal is every octal 1. Octal numbers represent a number with eight numbers from 0 to 7. The weight of the 0 th bit of octal number is 8 to the 0 th power, the weight of the 1 bit is 8 to the 1 power, and the weight of the 2 nd bit is 8 to the 2 nd power ... So there is an octal number: 1507, which is converted into decimal: it means vertically: 1507 is converted into ten. 0 bit 7 * 8 0 = 7 bit 1 0 * 8 1 = 0 bit 2 5 * 8 2 = 320 bit 3 1 * 8 3 = 5 12-. We can also use the horizontal formula to calculate directly: 7 * 8 0+0 * 8 1+5 * 8 2+0 * 8 3 = 839. Therefore, the decimal number converted from the octal number 1507 is 839 5. The method of converting ten-> 10 into 16 is similar to the method of converting it into binary, the only change is that the divisor is changed from 2 to 16. Similarly, 120, when converted into 16, the quotient remainder 1201201678771607120 is converted into/kloc. 6. Sixteen -> 16 decimal refers to every 16 decimal 1, but we only have the number 0~9, so we use the letters A, B, C, D, E and F to represent 10 and1/respectively. Letters are case-insensitive. The weight of the zeroth digit of hexadecimal number is the power of 16, the weight of the zeroth digit is 1 of 16, and the weight of the second digit is the power of 1 6 ... Then, in the nth digit (where n starts from 0), if it is a number, Vertical calculation: 2AF5 is converted into 10 radix: 0: 5 *160 = 5; 1:F * 16 1 = 240; 2: A * 16 2。 163 = 8192+-10997 The direct calculation is: 5. 16 3 = 10997 (remember, in the above calculation, a means 10 and f means 15). Now we can see that the key to converting all bases into 10 bases lies in their different weights. Suppose someone asks you why the decimal number is 1234 1234? You can give him the following formula:1234 =1*103+2 *102+3 *101+4 *107. Eight (11001.1kloc-0/) (2) integer part: every three digits are grouped from the back to the front, the missing places are filled with 0, and then converted by decimal method. Then it is: 001=11= 3, and then we write the result in bottom-up order: 3 1, so this 3 1 is binary1/kloc. Then it is converted by decimal method to get: 10 1=5. Then we write the result in top-down order, which is: 5, so this 5 is the octal form of binary 0. 10 1, so: (1kloc-0/0065438+) 2 (31) 1 1 Then we write the results from bottom to top: 1 100 1, so this11kloc-0/is octal 3/kloc-. Decimal part: from the beginning to the end, each digit is converted into a three-digit binary number by decimal, and the missing part is supplemented by 0: 5-> 10 1 and then we write the result from bottom to top as:1kloc-0/,so this10/. Secondly-> the conversion between hexadecimal and hexadecimal is more important. However, there is no need to calculate the conversion between the two. Every C and C++ programmer can see binary numbers and convert them directly into hexadecimal numbers, and vice versa. We are the same, as long as we finish this section, we can do it. First, let's look at a binary number:111. What is this? You may want to calculate it like this:1* 20+1* 21* 2+1* 2 3 =1*1. However, since 111has only four digits, we must directly remember the weight of each digit and record it from high to low: 8, 4, 2,1. That is, the weight of the highest bit is 2 3 = 8, followed by 2 2 = 4, 21= 2, 2 0 =1. Remember 842 1, for any 4-bit binary number, we can quickly calculate its corresponding 10 binary value. The following is a list of all possible values of the four-digit binary number xxxx (the part skipped in the middle). The fast calculation method of four-digit binary number is decimal hexadecimal value11= 8+4+2+1=15f165448. 4+2+0 = 14 E 1 10 1 = 8+4+0+ 1 = 13d 1 100 = 8+4+0+0 = 12 C 10 1 / Kloc-0/= 8+0+2+65438 ... 0001= 0+0+1=10000 = 0+0 = 0 000 binary number is converted into For example, (the upper line is a binary number and the lower line is a corresponding hexadecimal number):111kloc-0/11065438. Convert F first: When we see F, we need to know that it is 15 (maybe you are not familiar with the five numbers A ~ F), and then how does 15 combine with 842 1? It should be 8+4+2+ 1, so all four digits are1:11. Then convert d: look at d and know that it is 13, 13. How to make up with 842 1? It should be: 8+4+ 1, that is: 1 10 1. So FD is converted into binary number:111111. Because it is quite straightforward to convert hexadecimal into binary, we can also convert a decimal number into binary number first. For example, decimal number 1234 is converted into binary number, and if you want to divide by 2 all the time to get binary number directly, you need to calculate it many times. So we can divide it by 16 first, and get the binary number 16. The quotient remainder of the dividend calculation process is1234/1677 277 77/1x4d213 (d) 40. The corresponding relationship is 0100-41101-d 0010-2. Similarly, if a binary number is long, we need to convert it into 10, except for the method we learned earlier. The following is an example of a binary number of type int: 011kloc-0/1101065438. 0 10 1 1 We convert it into 16:6 D5 af 1b in groups of four bits to edit this paragraph. The binary conversion of negative numbers is slightly different. Write a negative number in its complement form first (not discussed here), and then do it according to the method of converting binary into other binary. Example: -9 needs to be converted to octal form. Then: the complement of -9 is1111kloc-0/1. Then one stroke with three digits111-> 71/kloc-0->; 6 0 1 1->; Then we write the result in bottom-up order: 367, so 367 is the octal form of decimal number -9. Recently, a friend asked, "What is 0.8 hexadecimal number?" I think I have given a detailed explanation in my space. Why did he ask such a question? So I did some calculations and found some numbers such as 0.8, 0.6, 0.2 ............................................................................................................................. such as "0.8 hexadecimal"! No matter how you multiply 16, its remainder is always 8. what can I do? I didn't know it was so simple until I asked the teacher the next day! The specific method is as follows: 0.8 *16 = 12.8 0.8 *16 =12.8 ... Take the integer part of each result as12, that is, hexadecimal C. If the accuracy is required to be three decimal places in the question, then CCC, if necessary in the question. The following is the formula for converting decimal numbers into negative numbers R: n = (dmdm-1... d1d0)-r = dm * (r) m+dm-1* (r) m-1+... 4. ! ! ! ! ! Error: (-617) d = (-11) o = (-269) h Cause analysis: If it is a positive number, the above idea is correct, but due to the difference between positive and negative numbers in original code, complement and complement conversion. The correct method is to express -6 17 with its complement first, and then convert it into octal and hexadecimal (complement). Note: twos complement should use 16 bits. Correct answer: (-617) d = (176627) o = (fd97) h The method of converting negative decimal into octal or hexadecimal is (-12)10 = () 8 = (). 111111111. & lt/p & gt;