1. Binary conversion

Source: Internet
Author: User

(a) the numbering

The computer is binary, because the binary has simple operation, easy to achieve and reliable, for the logical design provides a favorable way to save equipment and other advantages, in order to facilitate the description, but also commonly used 86 or 16 binary as a binary abbreviation. The general count is a carry count, which is characterized by:

Every n is one, n is the number of symbols required for each carry-count system to denote a number of numbers as cardinality.

Binary: Every two in one, borrow one when two

Octal: Every eight into one, borrow one when eight

Hex: Every 16 in one, borrow one when 16

(b) Numerical conversions

The principle of conversion between different carry counts: the conversion between different carry counts is based on the principle that two rational numbers are equal, then the integers of two numbers and fractions are equal respectively. That is, if the first two numbers are equal, the conversion will still be equal.

Decimal: There are 10 cardinality: 0,1,2,3,4,5,6,7,8,9

Binary: There are two cardinality: 0,1

Octal: There are eight cardinality: 0,1,2,3,4,5,6,7

Hex: There are 16 cardinality: 0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f (a=10,b=11,c=12,d=13,e=14,f=15)

(iii) Reciprocal conversion between the binary systems

1. Decimal Turn Binary

The decimal number is divided by 2, and the remainder, except to 0 o'clock, is written in the opposite direction, which is the binary number

Example: 48 divided by 2 quotient is 24 12 6 3 1

The resulting remainder is 0 0 0 0 1 1

Write the remainder from right to left as 1 1 0 0 0 0

The resulting 110000 is a binary number

Binary goto Decimal

Calculation formula: ax2^0+bx2^1+cx2^2+......+mx2^ (n-1) =

In the above formula, a represents the number of first digits to the right of the binary number, B represents the number of second digits to the right of the binary number, and C indicates the number of the third digit to the right of the binary number ... ^ represents the second party.

2. Decimal to octal

The decimal number is divisible by 8 until the quotient is 0, and the resulting remainder is written in the reverse order, that is, its octal number.

Example: 49 written in eight binary as 61

Octal goto Decimal

Calculation formula: ax8^0+bx8^1+cx8^2+......+mx8^ (n-1) =

In the above formula, a represents the number of first digits to the right of the octal number, B represents the number of second digits to the right of the octal number, and C indicates the number of the third digit to the right of the octal number ... ^ represents the second party.

3. Decimal Turn hex

The decimal number is divisible by 16 until the quotient is 0, and the resulting remainder is written in reverse order, that is, its hexadecimal number.

Example: 75 divided by 16 to obtain the remainder of one (B) 4

Remainder is written from right to left as 4B

Hexadecimal goto Decimal

Calculation formula: ax16^0+bx16^1+cx16^2+......+mx16^ (n-1) =

In the above formula, a represents the number of first digits to the right of the hexadecimal number, B represents the number of second digits to the right of the hexadecimal number, and C represents the number of the third digit to the right of the hexadecimal number ... ^ represents the second party.

4. Binary turn octal:

for integers, use right-to-left each three-bit group, not enough three-bit on its left to 0, each group is converted separately, that is, eight-binary.

Example: (001 101 111 011)

1 5 7 3

Therefore, (1573) is the resulting octal number.

octal turn binary:

The conversion can be done by replacing each octet with a three-bit binary number.

Example: (1 7 3 5)

001 111 011 101

Therefore, (1111011101) is the resulting binary number.

5. Binary turn 16 binary:

for integers, each group is converted from right to left with a set of four bits, which is 16 binary.

Example: (1001 0111 0111 1001)

9 7 7 9

So, (9779) is the resulting hexadecimal number.

hex Turn binary:

The conversion can be done by replacing each hexadecimal with a four-bit binary number.

Example: (8 7 6 5)

1000 0111 0110 0101

So, (1000011101100101) is the binary number obtained.

1. Binary conversion

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.