Principle of the arithmetic of the conversion algorithm (binary octal decimal hexadecimal) _ Related tips

Source: Internet
Author: User
Tags arithmetic
1. Binary number, octal number, hexadecimal decimal number
There is a formula: binary number, octal number, hexadecimal number of the numbers of the number of each of the respective cardinality of the (N-1) of the second party, and the sum is the corresponding decimal number. Single digit, n=1 10, n=2 ... for example:
The 0 =0+4+2+0=6d of the 1 110b=1*2 of the +1*2 of the 2-time Square +0*2 of the two sides
The 0 =64+8+0=72d of the 1 110q=1*8 of the +1*8 of the 2-time Square +0*8 of the two sides
The 0 =256+16+0=272d of the 1 110h=1*16 of the +1*16 of the 2-time Square +0*16 of the two sides
2, decimal number to binary number, octal number, hexadecimal number
The method is the same, that is, the integer part uses the algorithm of the addition of the base, the fractional part uses the method of rounding, and then the integer and the fractional part are spliced into a number as the final result of the conversion.
Example: see level Four guidance 16 pages.
3. Convert binary number to other data type
3-1 binary to octal: starting from the decimal point position, the integer part to the left, the decimal part to the right, each three-digit binary system for a group of a octal number, less than three in 0 replenishment,
Is the representation of a corresponding octal number.
010110.001100b=26.14q
Octal to binary system can be turned on the contrary.
3-2 binary Turn decimal: see 1
3-3 binary ext. 16: Starting from the decimal point position, the integer portion to the left, the decimal portion to the right, and each four-digit binary is a set of digits in hexadecimal notation,
Less than four digits with 0 complement, is a corresponding hexadecimal number of representations.
00100110.00010100b=26.14h
Decimal conversion to individual system
In order to convert the decimal system to a different way, you just divide by the weights of each system to obtain the remainder, the first remainder when Single-digit, the second remainder as 10 digits, and so on until the divisor is less than the weight, and the last dividend is the highest digit.
one or 10 binary conversion system
such as: 55 into binary
2|55
27――1 Digit
13――1 second place
6――1 third place
3――0 Fourth place
1――1 fifth place
The last divisor 1 is the seventh place, which is 110111.
two or 10-in-turn octal
such as: 5621 converted to octal
8|5621
702――5 First (digit)
87――6 second place
10――7 third place
1――2 Fourth place
Last octal number: 127658
Three decimal digits hex
such as: 76521 to hexadecimal
16|76521
4726――5 First (digit)
295――6 second place
18――6 third place
1――2 Fourth place
Last 1276516.
the relation of binary and hexadecimal
2 in 0000 0001 0010 0011 0100 0101 0110 0111
16 in 0 1 2 3 4 5 6 7
2 in 1000 1001 1010 1011 1100 1101 1110 1111
16 in 8 9 A (a) b (a) C (a) d (e) F (15)
You can use a four-digit binary number to represent a 16 binary, such as 3a16 to binary:
3 is 0011,a to 1010, combined to 00111010. You can remove the left 0 to 1110102.
To the right to convert the binary to 16, simply divide the binary digits from right to left, each four-digit unit, and control each unit to a value of 16.
the relationship between binary system and octal system
Binary 000 001 010 011 100 101 110 111
Octal System 0 1 2 3 4 5 6 7
The relationship between binary and octal is similar to that of binary and hexadecimal, with a eight-binary number of 0 to 7, represented by a three-bit binary number. To convert 51028 to binary, 5 to 101,1 to 001,0 to 000,2 to 010, the binary of these numbers is merged to 1010010000102, which is the binary value.
To convert the binary to octal, the binary digits are separated by three-bit units from right to left, and the conceal units are controlled by a value of eight.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.