2
$\begingroup$

"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.

$\endgroup$
1
  • 1
    $\begingroup$ 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. $\endgroup$
    – Raphael
    Commented Jan 12, 2016 at 8:29

1 Answer 1

3
$\begingroup$

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$.

$\endgroup$
1
  • $\begingroup$ Note that the difference between two consecutive denormalised numbers is the same as the difference between two consecutive normalised numbers with the smallest possible exponent (e.g. the exp field =1). $\endgroup$
    – Grabul
    Commented Jan 12, 2016 at 21:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.