[+0] Anticode =0000 0000,[-0]Anticode = 1 1 1 1 1 1 1。
[+0] complement =0000 0000, [-0] complement =0000 0000.
You will find that the complement of +0 and -0 is the same. In other words, the complement of 0 has only one representation.
The following explains how the [-0] complement is obtained.
The complement of a negative number is the complement of the whole plus one. The sign bit carry is discarded. (Therefore, the first bit of the complement in which the sign bit is discarded is a numerical bit, not a sign bit, and the sign bit is discarded. )
In addition, explain the relationship between the sign bit of the original code and the sign bit of the complement. The sign bit of the complement does not keep the first bit of the original code unchanged, but the first 1 of the [-0] complement is the sign bit, and 7 1 of the mantissa is the numerical bit. After the mantissa is added with 1, the numerical value is carried. 11111+1=1000000 (in the process of calculating the complement, the first digit is not guaranteed to be the same first.
Therefore, the complement can represent one less number than the complement of the original code, so the complement can represent the number with the truth value of-128.
However, the number-128 is quite special, with only the original code and the complement, but no complement.
The complement of-128 is 1000 0000. Why is the complement of 128 1000 0000? Because the original value expression range of 8-bit binary is-127 to 127, * * has 256 combination sequences from 000000 to1165438+. The original value of+128 cannot be represented by 8 bits.
Extended data:
Numerical values are stored in the form of complement in the computer. Before discussing why computers use complement, let's first understand the concepts of original code, complement and complement.
For a number, the computer should use a certain coding method to store it. Original code, complement and complement are coding methods for storing specific numbers in computers.
The binary representation of a number in a computer is called the extension number of this number.
The number of machines is signed. In a computer, the most significant bit of a number is used to store symbols. A positive number is 0 and a negative number is 1. For example, decimal number +2, computer word length is 8 bits, which is [000000 10] when converted into binary. If it is -2, it is [100000 10].
Because the first bit is the sign bit, the formal value of the machine number is not equal to the real value. For example, the above signed number [10000 10], its highest bit 1 stands for negative, and its real value is -2 instead of the formal value130 ([10000010]).
Therefore, the real value corresponding to the signed machine number is called the real value of the machine number. ?
References:
Original code _ Baidu Encyclopedia
Anti-code _ Baidu encyclopedia
Supplement _ Baidu Encyclopedia