# Distribution of IEEE 754 single precision floating point over number line

"What is the maximum and minimum difference between two successive real numbers representable in IEEE 754 Single Precision and Double Precision Floating Point Representations respectively?"

In order to answer this question, I am unable to visualise how Floating Points are spread over the real number line, assuming the precision of real numbers is same as that of IEEE 754 single precision & double precision respectively.
So I am looking for graphs of the following two functions based on IEEE 754 single precision representations.
$f\left ( x \right ) = \left\{\begin{matrix} 0 & ,\text{if x can't be represented in IEEE 754 single precision.} \\ 1 & ,\text{if x can be represented in IEEE 754 single precision.} \end{matrix}\right.$
$f\left ( n \right ) = \left\{\begin{matrix} d, & \text{where d is the diffrence between n-th and (n-1)th floating points representable in IEEE 754 single precision. }\\ 0, & \text{if n-th or (n-1)th floating point number does not exists in IEEE 754 single precision representations.} \end{matrix}\right.$ Considering only normalised values and zero. and not considering Infinities, NaN and denormalised numbers.

Could anybody please help me out with these graphs so that I can understand floating points properly.

• I don't think this is a helpful approach. The required quantities follow from the way the format is set up in an arithmetic way. That said, just take a shorter floating-point format -- $k$ bits so that your machine and plotting software can handle $2^k$ data points -- and draw them all. – Raphael Jan 12 '16 at 8:29

The idea is that a (not denormalized) floating point number is stored as $2^x \times 1.m_0 \ldots m_{k-1}$ (in binary), where $x$ is the exponent and $m_0 \ldots m_{k-1}$ is the mantissa of length $k$. Two successive numbers with this exponent differ by $2^{x-k}$, since this minimal difference is $2^x \times 0.0\ldots01$, with $k-1$ zeroes after the dot. The minimal and maximal differences (among not denormalized numbers) are attained for the minimal and maximal $x$.