However, how to express positive and negative numbers? Smart scientists use the form of complement to store negative numbers on the premise of limiting the number of binary digits (see complement for algorithm and details).
The first bit is the sign bit, that is, the sign used to represent this number (positive number: 0 negative number: 1), so the largest positive number of int type is 01111. 5438+05 1), its value is 2( 15)- 1, which is the power of 2 minus 1, that is, 32768- 1=32767.
Minimum negative number: 1000000000000. According to the operation of complement, the decimal number corresponding to this binary number is -32768, which also explains why the absolute difference between the largest positive number and the smallest negative number is 1.