So, it should be pretty straightforward unless you assume that a char is
8 bits, with a signed char having a range of +/-255.
Signed 8 bits would beĀ  -128 to +127.

<pedantic>
<!-- content generally known by everybody here --> Well, he had previously mentioned NINE bits per character. Besides, 9 bits and 18 bits improves the convenience of using octal notation.

And not everything uses "2's-Complement" for sign.
Using "Sign-Magnitude" would give 8 bits a range of +/-127
There could be some special uses for negative zero.

IEEE representation of floating point also has some "special numbers", otherwise we can't have ZERO (although 1 to an maximum "large" negative exponent would be "close", even without the official redefinition), along with using "Sign-Magnitude" for the whole thing, and "bias"/"excess" for handling negative exponents)


But, for a bigger example, MS-DOS used a SIGNED (2's-Complement) 32 bit number for file size! Giving files limits of -2147483648 and 2147483647. If you put FFFF FFFF into an MS-DOS directory entry in the file size field, it tells you -1. 00 00 00 80 (little endian byte order for 80000000) gives you -2147483648. Unfortunately, copying a negative sized file onto a disk does not increase free space. Hence the need for Stacker, DBLSPACE, and DRVSPACE while waiting for "Moore's Law" to catch up on disk size.

I could never get some of my students to spell "Complement" right.
"We've come to NEGATE the variable, not to praise it!"
</pedantic>

Reply via email to