Binary Conversions-July 20

Source: Internet
Author: User
Tags decimal to binary

One, binary conversion

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

There are 2 cardinality in binary: 0,1

Octal has 8 cardinality: 0,1,2,3,4,5,6,7

Hex has 16 cardinality: 0--9,a,b,c,d,e,f (a=10,b=11,c=12,d=13,e=14,f=15)

Ii. conversion between decimal and other binary

(i) Decimal and binary

1, decimal turn binary

The decimal number divided by 2, in addition to the quotient of the remainder, from back to front to write backwards, that is, the binary number

Example: 36 divided by 2 quotient is: 18 9 4 2 1

The remainder is: 0 0 1 0 0 1

From right to left: 1 0 0 1 0 0

So the binary number is: 100100

2. Binary decimal

Calculation formula: ax2º+bx2¹+cx2²+......= ...

Where a represents the first digit to the right of the binary number, B represents the second digit on the right, C represents the three digits to the right, and so on.

Example: Binary number 1011001 is converted to a decimal number of 89

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

=1+8+16+64

=89

(b) Decimal and octal

1, decimal turn octal

The decimal number divided by 8, in addition to the quotient of the remainder, from back to front to write backwards, that is, eight binary

* Calculation method similar to "Decimal to binary system"

2, octal decimal

Calculation formula: ax8º+bx8¹+cx8²+......= ...

Where a represents the first digit to the right of the binary number, B represents the second digit on the right, C represents the three digits to the right, and so on.

Example: Octal number 2137 is converted to a decimal number of 1119

7x80+3x81+1x82+2x83

=7+24+64+1024

=1119

(c) Decimal and hexadecimal

1, decimal turn hex

The decimal number is divided by 16, in addition to the quotient of the remainder, from the back to the front to write backwards, that is, hexadecimal number

* Calculation method similar to "Decimal to binary system"

0--9,a,b,c,d,e,f (a=10,b=11,c=12,d=13,e=14,f=15)

2, hexadecimal to decimal

The calculation method is similar to binary, octal

Iii. conversions between other systems

(i) binary turn octal

2 of 3 is equal to 8, so every three digits from right to left is a group, each group is converted separately, that is, eight binary

Example: 1101111011

1 101 111 011

1x20 1x22+1x20 1x22+1x21+1x20 1x21+1x20

1 5 7 3

So the octal number is: 1573

(ii) octal into binary

Example: 1 5 7 3

1x20 1x22+1x20 1x22+1x21+1x20 1x21+1x20

1 101 111 011

(1=20 5=4+1=22 + 20 7=4+2+1=22+21+20 3=2+1=21+20)

(iii) binary hexadecimal

2 of the 4 is equal to 16, so the right-to-left every four digits for a group, each group is converted separately, that is, hexadecimal

Example: 1001 0111 0111 1001

1x23+1x20 1x22+1x21+1x20 1x22+1x21+1x20 1x23+1x20

9 7 7 9

So the hexadecimal number is: 9779

(d) hexadecimal to binary binary

Example: 1001 0111 0111 1001

1x23+1x20 1x22+1x21+1x20 1x22+1x21+1x20 1x23+1x20

9 7 7 9

So the binary number is: 1001011101111001

Iv. diagram of each of the binaries

* Octal and hexadecimal cannot be converted directly, only binary or decimal

Binary Conversions-July 20

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.