]. Q20. What are the largest positive and negative numbers that can be stored? How are they
determined?
[Hint: The largest positive number that can be stored into n bits is 2
n-1
– 1. So, in 8-bits, we can
store up to 2
7
– 1 or 127. Similarly, the smallest negative number that can be stored in n bits is –
2
n-1
, which in an 8-bit comes to –128.
Please note that these two values are not the same. This is applicable to characters, as they take 1 byte or 8 bits.
On the other hand, integers take 2 bytes or 16 bits in computer memory, so the largest possible
value that can be stored into such an integer is 2
15
–1 or 32,767, whereas the smallest negative number
that can be stored is –32,768.