-
I know this stuff :
The original code is the reverse code and the complement code. Be.
-
In computers, numbers are divided into signed and unsigned numbers. For signed numbers, you need to use the first bit for the symbol and the rest of the bits for the value.
Original, inverse, and complementary codes are all methods used to represent signed numbers.
For a negative number, for example, its original, inverse, and complementary codes need to be calculated according to the binary rules in the computer.
1.Original code: The negative sign bit is unchanged, and the rest of the digits are reversed and added by 1. Then the original code is.
2.Inverse code: The original code symbol bit remains unchanged, and the rest of the bits are reversed. Then the anti-code is.
3.Complement: On the basis of the inverse code, positive numbers are added to 0 and negative numbers are added to 1. Then the complement is.
Note that floating-point numbers are represented slightly differently in computers and may be based on standards such as IEEE 754, which may result in some minor differences. For example, you might see a binary 32-bit with the sign being the highest bit, followed by an 8-bit exponent, and finally a 23-bit mantissa number.
-
The original code of 10 is 10001010, and the reverse code is reversed.
11110101, complement 11110110.
The sign of the negative number is 1, and the highest bit of the grinding stool cherry is 1, so when it comes to the original code and the complement code, the number of bits should be limited. To put it simply, take eight digits as an example:
The source code is the binary of its own value.
yards, so -10 = 10001010.
The inverse code is inverted by bit, and the sign bit is not changed, so -10 = 11110101.
The complement is added to the blind plexus anti-code, -10 = 11110110.
-
ofComplementIt's the same as the original code, both. in the source codeReverse codeIn the rules of complement and so on, we can know that if a number is positive, then its original code, inverse code, and complement code are the same, so the complement and the original code are.
Because the computer can only store binary data, for a number, the computer should use a certain encoding method to store, the original code, the reverse code, and the complement code are the encoding methods for the machine to store a specific number.
The original code is the most easily understood and calculated representation of the human brain, and the representation of the complement is: the complement of the positive number is itself, and the complement of the negative number is on the basis of its original code, the symbol bit remains unchanged, and the rest of the people are reversed, and finally the stool stares at +1 (that is, on the basis of the reverse code +1).
Change rules for changing the original code to the inverse code:
1. The representation of the inverse code is: the inverse code of the positive number is itself.
2. The inverse code of the negative number is based on its original code, the symbol bit remains unchanged, and the rest of the bits are negated.
It can be seen that if a coarse code represents a negative number, the human brain cannot intuitively see its value. Usually, it is converted to the original code and then calculated.
Advantages of original, inverse, and complement codes:
1. The advantage of the original code is that its representation is very simple and relatively intuitive.
2. The reverse code solves the problem of negative addition operation, and converts the subtraction operation into addition operation, so as to simplify the operation rules.
3. Subtraction, multiplication and division can be achieved by addition. It can simplify the combinator in the calculation machine.
, you can let the sign bit directly participate in the operation as a numeric value, and still get the correct result in the end.
-
To find its **, you must first specify the code length (number of digits).
-
Machine Count: A binary representation of a number in a computer is called the number of machines for that number. Machine numbers are signed, and the computer stores the symbol with the highest digit of a number, 0 for positive numbers and 1 for negative numbersFor example, the number +3 in decimal is 8 bits long, and converting it to binary is 00000011.
If it's -3, it's 10000011. Then -1 is 10000001
Source code. If the machine word length is n, then the original code of a number is a binary number with n bits, where the highest bit is the sign bit: a positive number is 0, and a negative number is 1. The remaining n-1 digits represent the absolute value of the number.
For example: x=+101011 , x]original = 0010 1011
x=-101011 , x] original = 1010 1011
If the number of digits is insufficient, 0 is used to complete.
ps: The original, inverse, and complementary codes of positive numbers are the same, and there are two original and inverse codes of 0, because here 0 is divided into +0 and -0.
Reverse codeKnowing the original code, then you only need to have the ability to distinguish between 0 and 1 to easily find the reverse code, why? Because the inverse code is based on the original code, the symbol bit does not change, and the other bits are negated by bit (that is, 0 becomes 1, 1 becomes 0).
For example: x=-101011 , x] original = 1010 1011 , [x] anti = 1101 0100
ComplementThe complement code is not as simple as the usual thing, that is, on the basis of the reverse code, add 1 according to the normal addition operation.
For example: x=-101011, x]primitive=1010 1011, cover[x]inverse=1101 0100,[x]complement=1101 0101
The complement of a negative number is simpler to remember in this way: the sign bit does not change, and everything else starts from the low position until the first 1 is met; After encountering the first 1, keep this 1, and then negate it bitwise.
Example: -7] Original = 1 000011 1
7] complement = 1 111100 1
ps: The complement of 0 is unique, if the machine word length is 8 then [0] complement = 0000 0000.
-
Finding the inverse code and the original code? What are you begging them for? In computer systems, numerical values are always represented and stored in complement codes.
In the computer, there is no hunger for the original code and the reverse code.
You just want to find out the original code and the reverse code, and there is no place to put it!
For the complement 1111 1101, do "binary to decimal" to get the true value.
Remember: the first nucleus is negative.
Therefore, the true value of the sedan is: 128 + 64 + 32 + 16 + 8 + 4 + 1 = 3.
-
The highest position is 1, indicating that this is a negative number.
Complement = Inverse Plum cavity.
1, then inverse = complement-1 = 1111 1100.
Original code = reverse code, except for the sign bit of the part of the ear = 1000 0011.
-
The original code of 10110 is 110110; Na Qixi anti-code.
for 101001; Complement
101010.
The original code is 01011; The reverse code is 01011; The complement is 01011.
The original code notation hole adds a sign bit in front of the value (i.e., the highest bit is the sign bit): the positive number is 0, the negative number is 1 (0 has two meanings: +0 and -0), and the rest of the bits represent the size of the value.
-
0 is divided into +0 and -0 in the computer, their original code, complement.
The reverse code is as follows: 1, [+0] original code = 0000 0000, [0] original code = 1000 0000;
2. [+0] anti-code = 0000 0000, [0] anti-code = 1111 1111;
3. [+0] complement = 0000 0000, [0] complement = 0000 0000.
Here you will find that the complements of +0 and -0 are the same, i.e. the complements of 0 have only one representation.
In computers, there are three representations of the number of symbols: original, inverse, and complement.
-
Inverse code: 1,110010 (except for the sign bit, you take the negation) Complement: 1,110011 (except for the sign bit, you take the negation, the last digit plus one) Frame shift:
0,110011 (negation of the complement symbol bit) Note: 1. First judge the positive or negative of the pure brigade original code, because for positive numbers, the original code and the complement inverse code are expressed in the same form (the sign bit is 0, and the numerical part is the same as the true value).
2. For the inverse code and the complement code, it is necessary to distinguish: the problem of knowing [x complement], finding [-x complement] (together with the sign digits, each is negated, and the last digit is added to one).
In computer systems, numerical values are always represented and stored in complement codes. >>>More
Regarding the original code and the reverse complement, you can borrow this book. >>>More
Original code: 10001101
Reverse code: 11110010 >>>More
The binary positive number of the original code is the reverse complement of the codeWhy the same? >>>More
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: >>>More