Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Why is the 16-bit minimum value of an integer variable -32768 instead of -32767?
Why is the 16-bit minimum value of an integer variable -32768 instead of -32767?
In the source code, both positive zero and negative zero represent zero; In the complement, positive zero is still zero, but "negative zero" is used to represent the minimum value (-32768), which is also a convention. Integers in memory are stored in the form of complement. If they are stored in the form of original code, 0 can be expressed as

0000 0000 0000 0000[+0] or 1000 0000 0000[-0]

So it can only mean -32767~32767. However, if stored with the complement, 0[+0 or -0] is uniquely determined as 000000000000000000. The extra bits are used to represent the smallest integer, that is, -32768.

So the smallest integer takes the value -32768.