c#--binary Conversion!

Source: Internet
Author: User
Tags decimal to binary

in-process switching

the other binary decimal--the right-to-expand addition method is:

Since 101.11 (10), can be written as 1x102+0x101+1x100+1x10-1+1x10-2, i.e. (with 10 as the bottom of the power expansion) is called the right expansion type,

of which: 101.11 is called "digital"

(10) in the number of numbers is called "cardinality"

The value of each digit in the digital is called the "right"

Then other binaries can also be written in the right-click expansion

For example: the number "101.11" of the different binary notation is ~

Decimal notation is: 101.11 (10)

Binary representation is: 101.11 (2)

Octal notation is: 101.11 (8)

Hexadecimal representation is: 101.11 (16)

No.2 decimal into other binary

One, the integer part conversion: "In addition to the cardinality of the reverse method"

Take decimal to binary as an example: Divide the decimal integer 13 by the cardinality 2, get a quotient and a remainder, divide the quotient by 2, get a quotient and a remainder, and so on, until the quotient equals zero.

Second, the small part conversion: "Multiply the base rounding method"

Also take the decimal to binary system as an example: the decimal decimal 0.25 converted to binary decimals , with 2 successive decimal decimals, each of the resulting product of the integer part of the order in which they appear sequentially, the corresponding binary decimal.

The last integer is added to the decimal:

13.25 (10) =1101 (2) +0.01 (2) =1101.01 (2)

No.3 conversion between binary and 86 or 16: "Correspondence Relationship Interchange"

One, the conversion between binary and octal

Binary octal binary octal

000 0 100 4

                     001                      1                     101                         5

                     010                        2                   110                         6

011 3 111 7

Second, the conversion between binary and hexadecimal

binary hexadecimal binary hex

0000 0 1000 8

                    0001                      1                          1001                         9

                    0010                        2                        1010                         a

                    0011                          3                      1011                          B 

                    0100                            4                    1100                          c

                    0101                              5                  1101                         D

                    0110                                6                1110                          e

0111 7 1111 F

Added: the conversion between hexadecimal and octal has been binary as the center for the simplest!

To do is to choose their own can get the first career!

c#--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.