-
Three types of representations for the number of machines were introduced: the original code, the complement code, and the inverse code, which encoded the sign bit and the numeric bit together, and the original value corresponding to the number of machines was called the true value 1 Original code notation In the original code notation method, the value is expressed as an absolute value, and the leftmost part of the value is represented by "0" and "1" to represent positive and negative numbers respectively, and is written as [x] The original code representing x. For example, in an 8-bit binary number, the original codes of the decimal numbers 23 and -23 are represented as:
23] Original 00010111 [ 23] Original 10010111 It should be noted that the original code of 0 has two representations, namely "00......0" and "10......0", all of which are treated as 0. 2 Complement notation Generally, when adding the original code of two different signs, it is actually subtracting, and then the symbol is determined according to the size of the absolute value of the two numbers. Can it be achieved uniformly by addition?
Let's start with a fact. For a clock, turn the hands from 6 to 2, either 8 or 4 backwards, which is expressed in the formula: 6 8-12 2 and 6-4 2 Here 12 is called its "modulus".
8 and -4 are complements for modulo 12. In computers, 2 is used as the modulo for additive operations, so it is possible to introduce complements and convert subtraction operations into addition operations. The way to find the complement of a binary number is that the complement of a positive number is the same as its original code; The complement of a negative number is to find the inverse of the original code except for the sign bit, and then add 1 to the lowest bit.
It is common to use [x] complement to represent the complement of x, and the complement of 4 and -4 is expressed as: [4] complement 00000100 [-4] complement 11111100 example 6-4. Because [6] complement 00000110, [-4] complement 11111100 so 00000110-00000100 00000110 11111100 00000010 3 Inverse code notation The inverse code of a positive number is equal to the number itself, and the inverse code of a negative number is equal to its absolute value.
For example: [12]反00001100 [-12]反11110011 Summarizing the above rules, the following formula can be obtained: x-y x (the complement of y) x (the inverse of y 1).
-
Positive numbers are the same, negative numbers are different.
-
Positive, it's positive.
Positive numbers, like unsigned numbers, do not have any yards.
Negative numbers, it's different.
Negative numbers, which must be represented by complements, are required by the hardware.
In addition, in the computer, there is no source code and reverse code, so you don't have to care about them.
-
Complement, from: Complement.
General common sense:
Clock hour hand,Rewind 3 hours, you can use ".Positive dial 9 hours"instead.
The same goes for the minute handReverse x minutes, you can use ".Forward dial 60 xIn lieu of.
60 is the cycle of the minute hand.
Decimal number, two digits: 0 99,The cycle is a hundred
1 can be replaced with +99.
For example: 25 1 = 24
Ignore the carry of 100 and the result is the same.
Then, the complement of 1 is 99.
The complement of 2 is 98.
The complement of x is the negative number of the period.
With the help ofComplements, you can use addition instead of subtraction.
So, the computer can save on hardware.
Octal binary: 0000 0000 1111 1111 (0 255).
The cycle is 256.
Then, 1 can be replaced by 1111 1111 (+255).
That is, the complement of 1 is 1111 1111 (= 256 1 +255).
The complement of 2 is 1111 1110 (= 256 2 +254).
The complement of x is the negative number of the period.
128, you can replace it with 1000 0000 (= 128).
Positive numbers, no transformation is required, just direct operation.
In computers, negative numbers are stored and calculated with complements.
The original code and the reverse code, useless, they do not exist in the computer.
-
The complement of the complement is the original code!
The inverse code and the complement code with only negative numbers in the signed number are not the same, and the positive numbers are the same, involving the symbology conversion!
The original code is to take the negative plus 1 to find the complement
The complement is to find the original code or to add 1 (except for the sign bit).
-
In the C language, the source code of the negative number is calculated, that is, it is first regarded as a positive number, and the positive number of the decimal number is converted into a binary number, and a 1 is added in the highest digit, and the rest of the empty digits are filled with 0 to obtain the source code.
Generally speaking, the complement of a positive number is the source code itself, and the complement of a negative number is the inversion of the source code except for the sign bit (1 to 0, 0 to 1) and then add 1.
-
Same.
Positive original code = inverse code = complement. The purpose of introducing complements is to make it easier for computers to do subtraction.
For example: according to the time of 12 hours, the current accurate time is 4 o'clock, there is a table showing 7 o'clock, if you want to calibrate the time, we can set the hour hand back 7-4 = 3 squares, you can also dial forward 12-3 = 9 squares, the computer can do subtraction can be converted into -3 = +9, which can simplify the hardware equipment of the computer to do complex subtraction.
The original code is the complement.
The complement of a positive integer is its binary representation, which is the same as the original code.
Example: The complement of +9 is 00001001. (Note:.)
This +9 complement is represented by 8-bit binary binary, and there are many ways to represent the complement, as well as 16-bit binary complement representation, as well as 32-bit binary complement representation, 64-bit complement representation, etc. Each complement representation can represent only a limited number of numbers. )
Find the complement of a negative integer, and add 1 to all bits of its original code except for the sign bit (0 becomes 1, 1 becomes 0, and the sign bit is 1 unchanged).
The same number is different in different complement representations. For example, the complement of -15 is 11110001 in 8-bit binary, but in the 16-bit complement representation, it is 1111111111110001. The following are all represented in 8-bit binary.
The above content reference: Encyclopedia - Complement.
-
Similarly, the original code of a positive number = inverse code = complement code. The purpose of introducing complements is to make it easier for computers to do subtraction.
For example: according to the time of 12 hours, the current accurate time is 4 o'clock, there is a table showing 7 o'clock, if you want to calibrate the time, we can set the hour hand back 7-4 = 3 squares, you can also dial forward 12-3 = 9 squares, the computer can do subtraction can be converted into -3 = +9, which can simplify the hardware equipment of the computer to do complex subtraction.
However, the definition of complement is obtained: a positive number is still positive, and a negative number x is rounded by subtracting | from 2x|。The complement that was introduced in order to simplify subtraction turned out to be subtraction in the process of finding complements.
In this way, the inverse code notation was introduced to facilitate the supplement. The inverse code of the complement code is to simplify the subtraction, the minus sign is turned into a negative number, and then the negative number is turned into a complement to find the addition, which has nothing to do with positive numbers. So whether it is a positive integer or a positive decimal, the original code, the reverse code, and the complement code are all the same.
Origin code is a method of representing the binary points of numbers in a computer. The original code refers to the code obtained by adding the sign bit to the left of a binary number, and when the binary number is greater than 0, the sign bit is 0; When the binary number is less than 0, the sign bit is 1; When the binary number is equal to 0, the sign bit can be either 0 or 1. The original code is the simplest encoding method for the number of signs, which is convenient for input and output, but it is more complicated as an addition and subtraction operation.
Numeric bits represent the absolute value of the truth value. Where there are less than n-1 digits, the decimal is added to the right of the lowest digit; The integer is added to the left of the highest digit to make up the n-1 digit. ** in the decimal point".
It is added for clarity when writing, and does not appear in the machine.
Complement In a computer system, numerical values are always represented and stored by complements. The reason is that, with complements, it is possible to unify the sign bits and numerical fields; At the same time, addition and subtraction can also be handled in a unified manner. In addition, the operation process of the complement and the original code is the same, and no additional hardware circuitry is required.
There are three ways to represent the number of symbols in a computer, namely the original, inverse, and complement. The three representations have two parts, the sign bit is 0 for "positive", 1 for "negative", and the numerical bit is different for the three representations. For computers, the concept and approach are exactly the same.
For n-bit computers, let n=8, the maximum number that can be represented is 11111111, if you add 1 to become 100000000 (9 bits), but because there are only 8 bits, the highest bit 1 is naturally lost. It's back to 00000000, so the modulo of the 8-bit binary system is 2 8. In such a system, the subtraction problem can also be reduced to an addition problem, and the subtraction can be represented by the corresponding complement.
The use of complements in the processing of computer logarithms is called complements.
Inverse code is a type of numerical storage, but because complement is more effective in representing the form of numbers in computers, most computers do not use inverse codes to represent numbers.
-
Yes, the original code of a positive number is inverse and complement.
Could it be that the "original reversal"?
Isn't that strange?
Not surprising! They don't understand the language in the first place.
Again, in the C language, there is something like this: "i = i + 1;”。
This equation, in the eyes of a math teacher, is certainly not true.
No matter what the value of i is, this "equation" is not an equation.
It can be seen from this that the mathematics of computer science majors is also chaotic.
Who did you learn the basic knowledge of computer experts?
Go without saying.
-
In computer systems, numerical values are always represented and stored in complement codes.
The original code and the reverse code do not exist in the computer. They are also useless.
The same, or not, doesn't mean anything.
Complement, in fact, is a positive number that "replaces a negative number".
With the use of complements, there are no more negative numbers in the computer.
By the way, subtraction is eliminated.
So, the computer only needs an adder to go all over the world.
How can a complement (i.e., a positive number) be used instead of a negative number?
The theoretical basis lies in the periodicity of the counting system.
For example,2-digit decimal number (0 99)., the counting cycle is
So: 25 1 = 24
25 + 99 = one hundred) 24
As long as you:Discard carrying,With only 2 digits, 99 can be used instead of 1.
In the same way, 98 can be used instead of 2.
These positive numbers are called "complements of negative numbers".
Transformation formula: Complement of negative periods.
In addition, turning back the hour hand for 3 hours and going forward for 9 hours is equivalent, the period is 12.
2, +3 2, positive and negative angles, also equivalent, the period is 2.
The transformation formula is all the same.
computer,For an 8-digit base number, the period is 2 8 = 256.
The complement of 1 is: 1 + 256= 255 = 1111 1111 (binary).
The complement of 2 is:254 = 1111 1110 (binary).
To find the complement, you don't have to go through the "original code reverse code to add a sign bit unchanged".
Foreigners who are not good at math need to do what kind of tricks!
Only negative numbers need to be transformed into complements (positive numbers).
Positive numbers do not need to be transformed, nor are they allowed to be transformed, they must be added directly.
So, if it's positive, it doesn't have a complement.
Some people say, "Positive... It's all the same.
This is being taken into the ditch by a foreigner.
The original code is reversed, and it doesn't exist, how can there be anything equal!
-
The original code, the reverse code, and the complement code of a positive number are its binary numbers.
The negative source code is its binary number.
The anti-code is the original code, you take the negation 0, the negation is 1, and the 1-negation is 0
The complement is the reverse plus 1
For example, the original code, reverse code, and complement code of +5 are all 1,101
The original code of -5 is 0,101
Inverse code 0,010
Complement 0,011
The positive sign is denoted by 1.
The negative sign is denoted by 0.
-
In the computer, there is no original code and reverse code, but the complement code is used, which represents positive and negative numbers.
The meaning of using complements: you can convert subtraction or negative numbers to addition. Thus simplifying the hardware of the computer.
For example, in clocks, the cycle of one rotation of the hour hand is 12 hours.
If you reverse 3 hours, you can use a forward dial of 9 hours instead.
9, that's 3Complements
Calculation: 12 3 = 9.
For example, if a two-digit decimal number is limited (0 99), the period is 100.
Then, subtract one, and you can replace it with +99.
Ignoring carrying, the result is the same for both algorithms.
Thus, 99 is the complement of 1.
The complements of other negative numbers, you can find them yourself!
When binary and complement are used in computers, they are renamed "complements".
The commonly used octa-bit binary is: 0000 0000 1111 1111.
They represent the decimal system: 0 255, and the period is 256.
Then, 1, you can useIn lieu of.
So: the complement of 1 is 1111 1111 = 255.
In the same way: the complement of 2 is 1111 1110 = 254.
Continue: The complement of 3 is 1111 1101 = 253.
Finally: 128, the complement is 1000 0000 = 128.
The formula is calculated as the negative number of the negative number 256 plus code.
Positive numbers, you can do it directly, you don't need to find the complement.
It can also be said that a positive number is a complement in itself.
The application of complements, e.g. 7 3 = 4.
The process of calculating with complement is as follows:
7
3
Add (1).= 4 complements.
Discard carrying,Only eight digits are reserved as a result
The original code and the reverse code are useless. In the computer, there are no them at all.
Of course it's exactly the same, because tomatoes (or tomatoes) are both fruits and vegetables (you know that), hehe. >>>More
Wonton and wonton are the same. Places like northern China are commonly called wontons, while Liangguang and Tianjin are called wontons. >>>More
Like and love, of course, there is a difference! Like is possession, love is fulfillment, for example, if you see a beautiful rose, if we like it, we don't care whether they have thorns or not, we have to pick it off, keep it for ourselves, and don't care about the life or death of the flower, but I like it, and love is to take care of her, water her, fertilize, and be reluctant to destroy her, let alone let others destroy.
The same is to play outdoors, travelers will take the trouble to search for various information from the Internet before traveling, the best route, the fastest time, and the most economical cost; Tourists will want to go to ** and carefully compare the ** services of various travel agencies. >>>More
Difference Between Mortgage and Bond:
Mortgage, known as mortgage in the banking or real estate world, refers to the act of providing private assets (whether immovable or not) as debt security, and mostly occurs when the bank lends a mortgage loan when purchasing real estate or discounts non-immovable items at a pawnbroker. >>>More