First chapter Conversion

Source: Internet
Author: User

Numbering conversion

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

Binary: There are 2 cardinality: 0,1

Octal: There are 8 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)

Conversion between decimal and other binary

One, (1) decimal- binary: decimal number divided by 2, except until 0 o'clock the remainder is written in the opposite direction, that is, the binary number.

Cases:

The resulting binary is: 11101 (2) [quotient is even when the remainder is 0; odd time remainder is 1]

(2) binary --Decimal

Calculation formula: AX20+BX21+CX22+...+MX2 (n-1) =

A represents the first digit to the right of the binary, and B represents the second digit to the right of the binary ... m represents the number of digits to the right of the binary (n-1).

Example: 1011001

1x20+0x21+1x22+1x23+0x24+0x25+1x26

=1+8+16+64

=89

Number of binary right digits 1 2 3 4 5 6 7 8
decimal number   1   2   4   8    32  64  128
Formula prototypes 20 21st 22 23 24 25 26 27

Second, (1) decimal--Eight decimal number is divided into 8, until the quotient is 0, the remainder is written in reverse order, that is, the octal system.

Example: 139 write eight binary as 213 (8)

(2) octal--Decimal

Calculation formula: ax80+bx81+cx82+...+mx8 (n-1) =

Principle with Binary

From the right nth bit 8 7 6 5 4 3 2 1
8 (n-1)              83      style= "font-size:16px;" >  bayi  
Actual number under decimal 2097152 262144 32768 4096 512 64 8

1

Three, (1) decimal--16 binary

Principle with Binary

(2) hexadecimal--Decimal

Principle with Binary

163 162 161 160
4096 256 16 1

Conversions between other binaries

Binary conversion to octal : for integers, use right-to-left each three-bit group, not enough three bits to the left of 0, each group is converted separately (right to left), that is, eight decimal.

Cases:

Octal is converted to binary: replaces each octet by a three-bit binary number. (Not enough three-bit front-fill 0)

Example: (1 7 3 5)

001 111 011 101

So, (1111011101) for the resulting binary number

Binary conversion to hex : Because 2 of the 4-square = 16, the same as the two-to-eight method, the binary number of each four bits are represented by a hexadecimal numeral, the integer part of the decimal point to the right to the left of each four-bit group conversion,

The number of decimal points starts from the left-to-right for each four-bit group.

Example: (1001 0111 0111 1001)

9 7 7 9

16 binary to binary: The conversion can be done as long as each hexadecimal number is represented by a four-bit corresponding binary number.

Example: (8 7 6 5)

1000 0111 0110 0101

Therefore, (1000 0111 0110 0101) for the resulting binary number

First chapter 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.