BinaryBinary is a kind of system widely used in computing. Binary data is a number represented by 0 and 12 digits. Its base is 2, the rounding rule is "every two in one", the borrow rule is "borrowing one as two", which was found by the 18th century German mathematical philosophy master Leibniz. The current computer system is basically binary systems, the data in the computer is mainly in the form of complement storage. The binary in the computer is a very small switch, with "on" to indicate 1, "off" to represent 0. The invention and application of the computer, which was known as one of the important symbols of the third technological revolution in the 20th century, because digital computers can only be identified and processed by ' 0 '. 1 ' symbol string consists of code. Its operation mode is binary. 19th century Irish logic Georgesburg the thinking process of logical proposition into the symbol "0". 1 "of some algebraic calculus, binary is a carry system of every 2. 0, 1 is the basic operator. Because it only uses 0, 12 number symbols, very simple and convenient, easy to implement in electronic way. binary Data Representation binary data is also using the position counting method, and its bit right is the power of the base of 2. For example, binary data 110.11, every 2 in 1, the size of the order of 2², 2¹, 2º 、、。 For n-bit integers, the binary data of M-decimal places is represented by a weighted-coefficient expansion, which can be written as: binary data is generally written as: "Example 1102" writes binary data 111.01 as a weighting factor. Solution: binary and hexadecimal, octal, are rounded up with a power of two. binary is equal to 2 o'clock in the rounding. 0=000000001=000000012=000000103=000000114=000001005=000001016=000001107=000001118=000010009=0000100110= 00001010 ... That is, every binary one, the binary is widely used in the most basic operation, the computer's operating calculation base is based on the binary to run. Just use binary to perform operations, and show them in other systems. In fact, the binary three-bit a group is eight binary, four-bit a group is hexadecimal octaloctal, octal, abbreviation Oct or O, a counting method based on 8, using 0,1,2,3,4,5,6,7 eight digits, every eight into 1. Some programming languages often start with the number 0 to indicate that the number is octal. Octal numbers and binary numbers can be bitwise-corresponding (octal one corresponds to binary three-bit), so it is often used in computer languages. octal, abbreviation Oct or O, a counting method based on 8, using 0,1,2,3,4,5,6,7 eight digits, every eight into 1. Some programming languages often start with the number 0 to indicate that the number is octal. Octal numbers and binary numbers can be bitwise-corresponding (octal one corresponds to binary three-bit), so it is often used in computer languages. Octal notation (base 8) is common in computer systems, so we can sometimes see people using octal notation. Since the hexadecimal one can correspond to 4-bit binary digits, it is more convenient to use hexadecimal notation for binary binary. Therefore, octal applications are not as hexadecimal. Some programming languages provide the ability to use octal notation to represent numbers, and there are some older UNIX applications that use octal. Binary and octal conversions are similar to binary and hexadecimal conversions, except that the three-bit group rather than the four-bit operation is required. Table 2-2 lists the equivalent representations of binary and octal. In order to convert octal numbers to binary, each octal number is replaced with the corresponding three bits in table 2-2. For example, the result of converting octal 123 into binary is 001010011:
Table 2-2 Binary/Eight conversion tables
Binary |
Octal |
000 |
0 |
001 |
1 |
010 |
2 |
011 |
3 |
100 |
4 |
101 |
5 |
110 |
6 |
111 |
7 |
In order to convert a binary number to octal, simply divide the binary string into a set of three bits (0 if needed), then look at table 2-2 and replace the three-bit string with the corresponding octal number.hexadecimalHexadecimal (English name: hexadecimal) is a representation of data in a computer. is not the same as the representation in our daily life. It consists of 0-9,a-f, letters are not case sensitive. The correspondence with the 10 binary is: 0-9 corresponds to the number of 0-9;a-f corresponding 10-15;n can be represented by the number of 0~ (N-1), more than 9 with the letter a-f.
Binary Conversion DecimalThe weight of the No. 0 digit of the binary number is 2 of 0, and the 1th bit is 2 of the 1 square ... Therefore, there is a binary number: 101100100, converted to 10 binary: 356 calculate 0x2 with horizontal type
0.0221+1x22+0x23+0x24+1x25+1x26+0x27+1x28=3560 multiplied by how much is 0, so we can also skip directly to the bit with a value of 0:1x22+1x25+1x26+1x28=3564+32+64+256 =356Octal Conversion DecimalThe octal system is every 8 into 1. The octal number uses 0~7 to express a number in eight numbers. The weight of the No. 0 digit of the octal number is 8 of 0, the 1th is 8 of 1, and the 2nd is 8 2. Therefore, there is an octal number: 1507, converted to decimal: 839, the concrete method is as follows: can be directly calculated by horizontal: 7x80+0x81+5x82+1x83=839 can also be used as a vertical representation of the No. 0 position 7x80=7 1th bit 0x81=0 2nd place 5x82=320 3rd digit 1x83 =512 16 Decimal 16 binary is 16 in 1, but we only have 0~9 these 10 numbers, so we use a,b,c,d,e,f these six letters to represent 10,11,12,13,14,15 respectively. Letters are case insensitive. The No. 0 digit of the hexadecimal number has a weight of 16 0, the 1th bit has a weight of 16 1, and the 2nd digit is 16 2. So, on the nth (n starting from 0) bit, if it is a number β (β is greater than or equal to 0, and β is less than or equal to 15, that is: F), the size of the βx16 is n-th square. Suppose there is a 16-in number 2AF5 direct calculation is: 5x160+fx161+ax162+2x163=10997[1] can also be expressed in vertical: No. 0 bit: 5x160=5 1th bit: fx16^1=240 2nd bit: Ax16 2=2560 3rd bit: 2x163=8192-------------------------------10997 as you can see, All the binary conversion into 10, the key is the respective weights are different. Suppose someone asks you, why is the decimal number 1234 1234? You can give him such a formula: 1234 = 1x103+2x102+3x101+4x100          Binary octal hex