(i) Binary
Computer processing information, are only "0" and "1" Two simple numbers of information, or use this number to encode the information. This system is called binary. To understand a computer, you first need to know how to represent a number in your computer.
Any type of number can be described in the following four rules:
Cardinal rules, rounding rules, right rules, operation rules. This distinguishes the number of different system representations, usually with the right enclosing another subscript letter to denote the system in parentheses, the decimal number in D, the binary in B, and the hexadecimal number in H.
Binary system
The following four rules are described as follows: The binary number is only "0" and "1" two digits, the base is 2, the largest number is 1, every 2 carry, you are the power of 2. For example, (0101101010) The rights of members are from 27, 26, 25, 24, 23, 22, 21, 20, respectively.
The arithmetic arithmetic rule of binary number is the same as the decimal number except the precession and borrow.
binary addition rule
0+0=0 1+0=1
0+1=1 1+1=10
Binary subtraction Rule
0-0=0 0-1=1-Borrow
1-0=1 1-1=0
Binary multiplication Rules
0x0=0 1x0=0
0x1=0 1x1=1
Example 4:2 in number 11110 101=110
110
101) # 11110
-) 101
101
-) 101
00
The advantages of binary are:
Binary only "0" and "1" two digits, very easy to say. The high and low voltage, the cut-off and saturation of the transistor, the magnetization direction of magnetic materials can be expressed as "0" and "1" states.
Binary number of each of only 0 and 12 states, only need two devices can be expressed, so the binary number of devices to save. Because of the simple state, the Anti-interference force is strong and the reliability is high.
The main disadvantage of binary system is that the digit is too long, it is inconvenient to read and write, people are not used to it. For this purpose, octal and hexadecimal are used as abbreviations for binary systems. In order to adapt to people's habits, usually in the computer are used in binary number, input and output in decimal number, by the computer to complete the binary silk and decimal between the conversion.
0+1=1 1+1=10
(ii) conversion between hexadecimal and the numbering
Hexadecimal has 0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f a total of 16 digits, where a-f represents 10-15 of the number, the base is 16, the maximum number is 15 in F, every 16 carry.
Hexadecimal number is an abbreviation of binary number, four-bit binary silk number has 16 kinds of combinations, corresponding to 0-15 of decimal number. Binary number conversion to hexadecimal number of methods, starting from small points left by four-bit section, the highest and lower than four bits, add 0 to fill four-bit section, and then replace with an equivalent hexadecimal number. In turn, the 16 binary is converted to binary by writing each hexadecimal number in 4-bit binary, with the left or right side of the system to be omitted.
Decimal numbers are converted to binary numbers, and the base multiplication and division method is usually used. The integer part and the fractional part are converted separately, and the two parts are finally combined, that is, the converted binary number.
The integer partial conversion uses Cardinal division, divided by the cardinality of the binary number 2 to take the remainder, and then divides the quotient by 2 to take the remainder, repeating the process until the quotient is 0. The first remainder is the lowest digit of the binary number, which is incremented sequentially, and the last remainder is the highest digit of the binary number.
The fractional part transformation uses the cardinal multiplication, namely multiplies the Cardinal 2 to take the whole number, then multiplies the remaining decimal number by 2 to take the whole number, until the desired precision (the conversion of the decimal part may appear infinite loop and infinite loop). The first integer is the first digit of the binary decimal number, descending in descending order, and the last integer is the lowest digit of the binary decimal number.
Because the bits of any number of numbers are represented in decimal numbers, any number of numbers can be converted to an equivalent decimal number.
(iii) conversion between the numbering
How to convert decimal numbers into binary, octal
Decimal number conversion to binary rule: The decimal number is removed 21 times, until the quotient is 0, the resulting remainder from the last obtained remainder in turn read that, that is, "except for 2".
For example: converting 41 to Binary
1 0 1 0 0 1
0125102041
i.e. (d=) (101001) B
Decimal conversion to octal rule: similar to binary, "except eight".
Example: 41 converting to octal
51 Yu
0541
That is, 41 converts to an octal system of 51.
How to convert binary and octal into decimal system
Binary Conversion to decimal: (A1...an-1an) 2
= (a1x2^ (n-1) +...+anx2^0) 10
Octal conversion to decimal: (A1...an-1an) 8
= (a1x8^ (n-1) +...+an-1x8^1+anx8^0) 10
Example: (10001010) 2= (1x2^7+0x2^6+0x2^5+0x2^4+1x2^3+0x2^2+1x2^1+0x2^0) 10 = (138) 10
(532) 8= (5x8^2+3x8^1+2x8^0) 10 = (346) 10
How to convert binary and octal systems into one another
Binary octal rule: Group decimal numbers from low to high, each three-digit group, which can represent numbers between 0 and 7, and then write down the numbers represented by each group.
Example: (11001001) 2 = (011) (001) (001)
3 1 1
= (311) 8
Octal binary rule: each octal digit is represented by a three-bit binary number, and the sequence consisting of this 0 and 1 removes the unwanted leading 0.
Example: (5163) = (101) (001) (110) (011) = (101001110011) 2
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.