Is the following numbers machines numbers on the IEEE single precision system?
$10^{304}$
$2^4+2^{27}.$
What do I have to do to know whether they are machine numbers on IEEE single precision?
Is the following numbers machines numbers on the IEEE single precision system?
$10^{304}$
$2^4+2^{27}.$
What do I have to do to know whether they are machine numbers on IEEE single precision?
A number $x$ is representable in IEEE single-precision format if it can be written in the form $x = S\cdot 2^{e}$ for an integer $S$ between $-(2^{24}-1)$ and $+(2^{24}-1)$ and an integer $e$ between -126 and +127.
In particular, $10^{304}$ can't, because it is much too big, but $2^4+2^{27}$ can: we can factor out $2^4$ from both terms to get:
$2^4+2^{27} = (2^{23}+1)\cdot2^4$
Where here $S = 2^{23}+1$ and $e=+4$.
The tricky thing about the second number is that the significand ($S$ value) of an IEEE single-precision number must fit into 23 bits, and here $S = 2^{23}+1$ = 1000,00000,00000,00000,00001
, which would seem to require 24 bits. But in IEEE format, the initial 1
is not stored, and is always implicit. So we can squeeze in that extra bit.