Computers use single- (or, for more precise calculations, double-) precision floating-point formats to represent a subset of real numbers. While a decent chunk of real numbers can be stored with these formats, most real numbers including obviously irrational numbers like $\pi$, cannot be stored and can only be approximated. Some large numbers that are out of range cannot even be approximated.
My question is, is it possible to express, using for example the set-builder notation, the exact subset of $\mathbb{R}$ that these formats allow to be stored? To emphasize, I don't want upper and lower bounds, I want the exact set.
There are $+0, -0, +\infty, -\infty$, and lots of
NaN.Then there are the normal numbers of the form $$\pm M \times 2^{E - B},\quad M \in [2^P, 2^{P + 1}) \subset \mathbb{N},\quad E \in[1, 2^R - 1) \subset \mathbb{N},$$
and denormalized numbers which I think (maybe I have an off-by-one or two) are of the form $$\pm M \times 2^{1-B}, \quad M \in [1, 2^P)\subset \mathbb{N}.$$
The parameters:
$2$: base (usually $2$, sometimes $10$, rarely anything else)
$P$: precision (number of bits including implicit leading $1$, e.g. $24$ for single, $53$ for double).
$R$: range (number of bits for exponent, e.g. $8$ for single, $11$ for double)
$B$: bias (offset for exponent, not sure on exact value but around $127$ for single and $1023$ for double, maybe need to add $P$ to those values?).