|
Well knowing it doesn't really help in 90 % of real life situations. Nobody goes in and manipulates bits directly, we all do higher level operations. But it's an interesting bit of trivia...
It's also interesting that the range doesn't change based on whether the first bit describes + vs - instead of another digit. 0 to 255 is 255 unique outcomes, and so is -127 to 128. Just like you can use floating points, or you can use scale and precision to move the decimal around, in this case you have a window of 255 slots, and you get two choices where to place that window.
But the real-world application for this knowledge is that if it's an identity column ( 1, 2, 3 ) that goes sequentially instead of using random numbers, you should use unsigned. You'll never have a negative value, and in most cases you can get away with a 32 bit int instead of a 64 bit long. Going unsigned puts the ceiling at about 4 billion instead of 2.
|