Why is the eight-bit binary number in the range (-128 ~~ + 127) Understanding,-128127
- There are three methods for a computer to express the number of symbols: the original code, the reverse code, and the complement code.
- 8-digitOriginal and reverse codeThe value range is-127 ~ 127.
- 8-digitComplementThe value range is-128 ~ 127.
- The value range is-128 ~ 127, it must be indicated by a supplementary code. 2017000-11111111 indicates-128 to-1, and 2017-12-01111111 indicates that the 127 1111 of the 0-1111 complement code is converted to the 1000 0001, that is,-1. The complement code is a binary method that represents a negative number.
- The concept of complement code is introduced: the complement code of a negative number is to add one to the anticode, while the positive number remains unchanged, and the source code of a positive number is the same. (-0) is replaced by (-128) in the complement code, so the range of the complement code is: (-128 ~ 0 ~ 127) a total of 256.
- Note:(-128) there is no corresponding source code and reverse Code, (-128) = (10000000 ).
- The so-called original code is the Binary Fixed-point representation, that is, the highest bit is the symbol bit, "0" indicates positive, "1" indicates negative, and the remaining bit indicates the value size.
- Anti-code Notation:A positive number is the same as its original code. A negative number is used to reverse the original code by bit, except for the symbol bit.
- Supplementary Code Notation:The positive complement is the same as the original one. The negative complement is added with 1 at the end of the reverse code.