(Stanat and McAllister [1977]) Every integer can be represented (nonuniquely) in the form \(a \times 2^b\) , where \(a\) and \(b\) are integers. The floating-point representation for an integer uses a bit string of length \(p\) to represent an integer by using the first \(m\) bits to encode \(a\) and the remaining \(p - m\) bits to encode \(b\), with the latter two encodings performed as described in Exercise 12.
- What is the largest number of distinct integers that can be represented using the floating-point notation for a given \(p\)?
We have \(m\) bits to represent \(a\) and \(p - m\) bits to represent \(b\) so by the product rule there are:
\[2^m \cdot 2^{p-m} = 2^p\]
possible integers
- Repeat part (a) if the floating-point representation is carried out in such a way that the leading bit for encoding the number \(a\) is 1.
\[2^{m-1} \cdot 2^{p-m} = 2^{p-1}\]
- Repeat part (a) if 0 must be included.
\[(2^{m}-1) \cdot 2^{p-m}\]