Numerical Analysis , number reprentation in machine

49 Views Asked by At

Consider a hypothetical computer using the number representation:

  • base = 2; signed bit exists; 20 bit mantissa,
  • first mantissa bit is always 1 except for representing zero;
  • exponent $e$ belongs to $\Bbb Z$ (integers);

Find the smallest positive integer $n$ that does not belong to the representable numbers?

representation : signed_bit * 0.d1d2...d20 * 2^(e)


This is what I got, but could not understand it.

Between any two consecutive powers of $2$, there can be $2^{19} - 1$ equidistant numbers in this system. Therefore we need to set the gap between two successive numbers of this system to $2$ in order to satisfy the conditions of the question. This is possible when $2^{19} - 1$ equidistant numbers are positioned between $2^{p+1}$ and $2^p$ or the following is true $$(2^{p+1} - 2^p)/2^{19} = 2.$$ Solving this we obtain $p = 20$. Thus the smallest number missing from the number system of this machine is $2m + 1$.

The argument above also clearly indicates that as long as we take positive integers between $1$ and $2m$, they belong to the number system of the machine.

2

There are 2 best solutions below

0
On

As the first bit of the mantissa is a one, it can represent all integer numbers between $2^{19}$ and $2^{20}-1$, scaled by $2^{-20}$ (hence between $2^{-1}$ and $1-2^{-20}$, i.e. $0.5$ to $\sim1$).

Now, as the exponent is said to belong to $\mathbb Z$, there is no upper nor lower limit ! This statement doesn't make sense for a machine representation. Assuming the minimum exponent to be $e_{\min}$, the smallest representable positive number is $2^{e_{\min}-1}$.

0
On

Looking at the segment of the integers with gap 2 is one way, looking at the first number that requires 21 digits in a binary representation would be another solution path.

The gap-$2$ calculation correctly identified the interval $2^{20}.. 2^{21}$ as the first containing non-representable numbers. The first one in this interval is $2^{20}+1$. If you check its binary representation, you will find that it has a $1$ at positions $0$ and $20$, thus requiring $21$ binary digits, which your format can not deliver.


Note that if the format were normalized, with a leading $1$ for all non-zero numbers, then you have effectively 21 digits to represent numbers and the argument shifts one dyadic power up, the first non-representable number being $2^{21}+1$.