Advanced Conversion Basics _ Related Tips

Source: Internet
Author: User
Tags decimal to binary

Basic Knowledge

decimal
Base is 10, every 10 into 1. In decimal, 10 different number symbols are used altogether, and the weights are different when they are in various positions.

Binary System
Base is 2, every 2 into 1. In binary, 0 and 12 symbols are used.

octal
Base is 8, every 8 into 1. The octal system uses 8 different symbols, which are related to binary conversions:
0:000 1:001 2:010 3:011 4:100 5:101 6:110 7:111

hexadecimal
Base is 16, every 16 into 1. Hexadecimal uses 16 different symbols, which are related to binary conversions:
0:0000 1:0001 2:0010 3:0011 4:0100 5:0101 6:0110 7:0111 8:1000 9:1001 A:1010 B:1011 C:1100 D:1101 E:1110 F:1111

system conversion to decimal

Binary to decimal
Example: Converts binary number 101.01 to decimal
(101.01) 2 = 1x22 + 0x21 + 1x20 + 0x2-1 + 1x2-2 = (5.25) 10

octal to decimal
Example: Converts octal number 12.6 to decimal numbers
(12.6) 8 = 1x81 + 2x80 + 6x8-1 = (10.75) 10

hexadecimal to decimal
Example: Converts a hexadecimal number 2ab.6 to a decimal number:
(2ab.6) = 2x162 + 10x161 + 11x160 + 6x16-1 = (683.375) 10

Convert to Binary

octal into binary
Rule: In order, each 1-digit octal number is rewritten to the equivalent 3-bit binary number, the order is unchanged.
Example: (17.36) 8 = (001 111.011 110) 2 = (1111.01111) 2

hexadecimal to binary
Rule: Each 1-bit hexadecimal number is rewritten to an equivalent 4-bit binary number, in the same order.
Example: (3a8c.d6) 16 = (0011 1010 1000 1100.1101 0110) 2 = (11101010001100.1101011) 2

decimal integer to binary integer

Rule: In addition to two, until the quotient is zero, inverted row.
Example: Converts the decimal number 86 to binary
2 | 86. ... 0
2 | 43. ... 1
2 | 21st...... 1
2 | 10. ... 0
2 | 5. ... 1
2 | 2. ... 0
2 | 1. ... 1
Results: (86) 10 = (1010110) 2

decimal decimal to binary decimal

Rule: Take the whole by two, until the decimal part is divided into 0 or a given precision, shun Pai.
Example: Converts a decimal number of 0.875 to a binary number
0.875
X2
1.75
X2
1.5
X2
1.0
Results: (0.875) 10 = (0.111) 2

Convert to octal

Binary into octal
The whole number of parts starting from the least significant bit, to 3-bit group, the highest effective bit less than 3 bits to be filled with 0, each group can be converted into a octal value, conversion is complete octal integer.
The fractional part starts from the highest effective bit, with 3-bit one group, the least effective bit is less than 3 bits when 0 is complete, each group can convert to a octal value, the conversion is completed is the decimal number of octal.
Example: (11001111.01111) 2 = (11 001 111.011 110) 2 = (317.36) 8

hexadecimal to octal
First, use the 1 4 method to convert hexadecimal to binary, and then use the 3 and 1 methods to convert binary to 8.
Example: (1CA) 16 = (000111001010) 2 = (712) 8
Description: Before the decimal point of high 0 and the decimal point after the low zero can be removed.

decimal octal
Method 1: The method of addition of 8 is adopted.
Example: Converts a decimal number of 115 to a octal number
8| 115. ... 3
8| 14. ... 6
8| 1. ... 1
Results: (115) 10 = (163) 8
Method 2: First decimal binary method, and then the binary number into octal number
Example: (115) 10 = (1110011) 2 = (163) 8

Convert to hexadecimal

Binary to hexadecimal
The integer part begins with the least significant bit, with a 4-bit group, with a maximum effective bit of less than 4 bits, and 0, each group can be converted to a hexadecimal value, and the conversion is complete with a hexadecimal integer.
The fractional part starts with the most significant bit, takes 4-bit as a group, the least significant bit is less than 4 bits, and 0 is filled, each group can be converted to a hexadecimal value, and the conversion is finished with hexadecimal decimal numbers.
Example: (11001111.01111) 2 = (1100 1111.0111 1000) 2 = (cf.78) 16

octal to hexadecimal
First the octal into binary, then binary into hexadecimal.
Example: (712) 8 = (111001010) 2 = (1CA) 16

Decimal to hexadecimal

Method 1: The method of addition of 16 is adopted.
Example: Converts a decimal number of 115 to a octal number
16| 115. ... 3
16| 7. ... 7
Results: (115) 10 = (73) 16

Method 2: First decimal into binary, and then binary to hexadecimal.
Example: (115) 10 = (1110011) 2 = (73) 16

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.