Observations onSigned Integers
Since half the bit values are used for negative numbers, signed integers have half the positive range of unsigned integers
- 16 bit unsigned: 0
65,535
- 16 bit signed: -32,768
0
+32,767
The most positive value and most negative value are adjacent bit patterns
- adding one to the most positive value generates the bit pattern for the most negative value (integer overflow)
- the bit pattern for the most positive value is the complement of the bit pattern for the most negative value: 7FFF and 8000, 7FFFFFFF and 80000000
-1 is always all bits turned on
- 8 bits: FF
- 16 bits: FFFF
- 32 bits: FFFFFFFF
- adding 1 to -1 turns all bits off: zero