Various methods of conversion of the system

Source: Internet
Author: User
Tags decimal to binary

  One or two decimal in turn

The basic practice of converting binary numbers into decimal numbers is to first write the binary numbers as the expansion of the weighted coefficients, and then sum them by the decimal addition rule. This practice is called the "Add by weight" method.

  Second, decimal to binary system

When the decimal number is converted to binary, the integer and decimal parts of the decimal number are converted to each other, and then merged.

  1. Decimal integers converted to binary integers

Decimal integers are converted to binary integers using the method "in addition to 2 remainder, in reverse order". By using 2 to remove decimal integers, we can get a quotient and remainder; then with the 2 remover, you will get a quotient and remainder, so that until the quotient is 0 o'clock, then the obtained remainder as the low effective bit of the binary number, the remainder as the high effective bit of the binary number, in order.

  2. Decimal Decimal to binary decimal

Decimal decimals are converted to binary decimals using the "multiply by 2, sorted by order" method. This is done by using 2 decimal decimals, you can get the product, take out the integral part of the product, then use 2 times the remaining decimal parts, get a product, then take out the integral part of the product, and do so until the small part of the product is divided into 0, or the required precision is reached.

Then the removed integer part is arranged in order, and the first integer is taken as the high effective bit of the binary decimal number, and then the integer is taken as the low effective bit.

  1. Binary and decimal conversion

(1) Binary Turn decimal system

Method: "Expand by right"

Cases:

(1011.01) 2 = (1x23+0x22+1x21+1x20+0x2-1+1x2-2) 10

= (8+0+2+1+0+0.25) 10

= (11.25) 10

(2) Decimal Conversion binary system

· Decimal integer to binary number: "Divided by 2, output in reverse order"

Example: (89) 10 = (1011001) 2

2 89

2 44 ... 1

2 22 ... 0

2 11 ... 0

2 5 ... 1

2 2 ... 1

2 1 ... 0

0. ... 1

· Decimal decimal to binary number: "Multiplied by 2, sequential output"

Cases:

(0. 625) 10 = (0. 101) # 2

0. 625 X 2

1. 2 X

0. 5 X 2

1. 0

  2. Conversion of octal and binary systems

Example: Converts the octal 37.416 into binary numbers:

37. 4 1 6

011 111. 100 001 110

That is: (37.416) 8 = (11111.10000111) 2

For example: Convert binary 10110.0011 to octal:

0 1 0 1 1 0. 0 0 1 1 0 0

2 6. 1 4

That is: (10110.011) 2 = (26.14) 8

  3. hexadecimal and binary conversions

Example: Converts a hexadecimal number 5df.9 into two

Decimal Turn binary:

Divide between 2 and 1 to the result

Write the remainder and the last 1 down and down in reverse, which is the result.

For example: 302 converted into binary

302/2 = 151 0

151/2 = 75 1

75/2 = 37 1

37/2 = 18 1

18/2 = 9 0

9/2 = 4 1

4/2 = 2 0

2/2 = 1 0

So the binary system is 100101110

  Binary Turn Decimal

Starting from the last one, listed in order No. 0, 1, 2 ... the number of n digits (0 or 1) multiplied by 2 and the result added is the answer.

For example: 01101011. Turn decimal:

No. 0 Place: 1 times 2 of the 0 square =1

1 times 2 of 1 square =2

0 times 2 of 2 square =0

1 times 2 of 3 square =8

0 times 2 of 4 square =0

1 times 2 of 5 square =32

1 times 2 of 6 square =64

0 times 2 of 7 square =0

Then: 1+2+0+8+0+32+64+0=107.

Binary 01101011 = Decimal 107.

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.