Binary:mathematicsanddigital circuit The numeration system with radix 2 in is a binary system with radix 2 representing the system.In this system, two different symbols 0 (representing zero) and 1 (representing one) are usually used to represent[1]。The discoverer isLeibniz。numberelectronic circuit Medium,Logic gateThe implementation ofcomputerAnd computer dependent devices.Each number is called aBit(Abbreviation of Bit, Binary digit)[2]。
At basebLocation counting system (wherebIt's a positiveNatural number, calledbase),bThe basic symbols (or numbers) correspond to the minimum of 0bNatural number.To generate other numbers, the position of the symbol in the number is used.The sign of the last bit multiplies its own value by the value of the left bitb。Generally speaking, ifbIs the basebThe number in the base system is expressed asAnd write down the numbers in orderazeroaoneatwoathree...ak。These numbers are from 0 tob-Natural number of 1[3]。
Generally speaking,bNumbers in the base system have the following forms:
numberandIs the corresponding numberproportion[3]。
Binary Count
German mathematicians from the 17th century to the 18th centuryLeibniz, the first proposal in the worldBinary notationPeople.Use binary notation, only use 0 and 1 symbols, no other symbols[4]。
Binary data is also usedCounting method, whichPosition powerIt's based on 2power。For example, binary data 110.11 enters 1 every 2, and the order of weight is 2 ², 2 ¹, 2 º、。With n bitsinteger, m bitdecimalThe binary data of is expressed by weighted coefficient expansion, which can be written as[5]:
Binary data can generally be written as:
[Example]: Write binary data 111.01 as weightedcoefficientForm of.
There are four cases of binary addition: 0+0=0, 0+1=1, 1+0=1, 1+1=10 (0 carry is 1)[5]。
multiplication
There are four cases of binary multiplication: 0 × 0=0, 1 × 0=0, 0 × 1=0, 1 × 1=1[5]。
subtraction
There are four cases of binary subtraction: 0 - 0=0, 1 - 0=1, 1 - 1=0, 10 - 1=1[5]。
division
There are two cases of binary division (divisor can only be 1): 0 ÷ 1=0, 1 ÷ 1=1[5]。
example
The arithmetic operation of two binary numbers 1001 and 0101 can be expressed as:
Binary
Decimal conversion
Announce
edit
Convert binary to decimal
Method: "Sum by weight expansion". The specific step of this method is to first write the binary number into the weighted coefficient expansion, and then sum according to the decimal addition rules[6]。
[Example]:
Rule: the number in the single digit is 0, the number in the ten digit is 1,The number of decimal digits is - 1, the number of percentile digits is - 2,Decreasing in sequence.
Convert decimal to binary
It is necessary to convert a decimal number into a binary numberintegerPart and decimal parts are converted separately and then combined together[7]。
The integer part adopts the method of "divide by 2 and take remainder, reverse order".Specifically, divide decimal integers by 2 to get amerchantandremainder;Then remove the quotient by 2, and a quotient and a remainder will be obtained. Do this until the quotient is less than 1. Then take the remainder obtained first as the low significant bit of the binary number, and the remainder obtained later as the high significant bit of the binary number, and arrange them in sequence[7]。Example: 125.
Integer part
The decimal part shall be rounded by multiplying by 2.That is, multiply the decimal fraction by 2 and get the integer of the result (must be 0 or 1), then repeat the previous step with the remaining decimal fraction until the remaining decimal fraction is 0, and finally arrange the integer parts obtained each time from left to right in order to get the corresponding binary decimal.For example, the process of converting decimal decimal 0.8125 to binary decimal is as follows[7]:
Fractional part
Fractional part, HD
Universal decimal conversion
DifferentBaseThe essence of conversion is to determine the number at different weight positions.transformationpositive integerThere is a simple algorithm for the decimal system of, that is, by using the target radix for long division;Remainder gives the "number" starting from the lowest order[3]。For example, 1020304 goes from decimal to decimal:
Convert decimal to hexadecimal
For another example, 10110111 goes from binary to binary:
Binary to pentadecimal
Computer adopts binary reason
Announce
edit
first,Binary counting systemOnly twoDigital。0 and 1, so any element with two different stable states can be used to represent a bit of a number.In fact, there are many components with two obvious stable states.For example,Neon lamp"On" and "off" of;"On" and "Off" of the switch;"High" and "Low", "Positive" and "Negative" of voltage;"Holes" and "no holes" on the paper tape;"With signal" and "without signal" in the circuit;magnetic material The South Pole and the North Pole, etc.It is easy to use these different states to represent numbers.Not only that, but more importantly, the two completely different states are not only different in quantity, but also in quality.In this way, the anti-interference ability and reliability of the machine can be greatly improved.It is much more difficult to find a simple and reliable device that can represent more than two states[8]。
Secondly, binary counting systemFour arithmetic operationsThe rules are very simple.In addition, the four operations can finally be reduced to addition anddisplacementIn this way, the circuit of the calculator in the electronic computer becomes very simple.Moreover, the line is simplified and the speed can be increased.This is also tenCarry counting systemIncomparable[8]。
Third, the use of binary representations in electronic computers can save equipment.It can be proved theoretically that the ternary system saves the most equipment, followed by the binary system.However, most electronic computers still use binary system because binary system has advantages that other systems, including ternary system, do not have.In addition, since only two symbols "0" and "1" are used in binaryBoolean algebraTo analyze and synthesize the logic circuits in the machine.This provides a very useful tool for designing electronic computer circuits[8]。
Fourth, the binary symbols "1" and "0" exactly correspond to "true" and "false" in logic operation, which is convenient for computer logic operation.