# What is the maximum difference between two successive real numbers in the given floating point representation?

The following is a scheme for floating point number representation using 16 bits.

Sign :- Bit 15

Exponent:-Bit 14-9

Mantissa :- Bit 8-0

Let $s, e,$ and $m$ be the numbers represented in binary in the sign, exponent, and mantissa fields, respectively. Then the floating point number represented is: $(−1)^s(1+m×2^{−9})2^{e−31}$ {if $e\not = 111111$}, and $0$ otherwise.

What is the maximum difference between any two successive real number in this system?

And also does two successive real numbers means that there can no real number in between those two (in the given representation)?

• I make it $2^{22}$. Oct 7, 2014 at 17:12
• You first. You said you had an answer. Oct 7, 2014 at 18:02
• Successive means there are none in between so the answer to your last question is yes. I claim that $2^{20}$ and $(1+2^{-9})\cdot 2^{20}$ are successive reals in this system, with a difference of $2^{11}$ This shows the maximum is rather greater than $2^{-9}$ Oct 7, 2014 at 18:19
• I'm afraid it's you that's being shoddy here, Atul. Your textbook is right, as you might have realised when you saw my comment. Oct 7, 2014 at 18:29

Denote by $[p,q]$ the set of integers $k$ with $p\leq k\leq q$. Then $e\in[0,62]$, $\>m\in[0,511]$. The set $R$ of representable real numbers is therefore given by $$R=\left\{\pm\left(1+[0,511]\cdot 2^{-9}\right)2^{[0,62]-31}\right\}\cup\{0\}\ .$$ The smallest positive number in $R$ is $2^{-31}$, then we have $512$ jumps of size $2^{-40}$, bringing us to $2^{-30}$, and so on in jumps of ever doubling size, until we reach $2^{31}$. Then come $511$ jumps of size $2^{-9}\cdot 2^{31}=2^{22}$, bringing us to $(2-2^{-9})2^{31}$. The latter is the largest representable number in this system.

It follows that the largest occurring difference between numbers in $R$ is $2^{22}$.

• So that means that after $2^{10}$ we won't be able to represent every integer thereafter? Oct 7, 2014 at 19:14
• @Atul Gangwar: When $e\leq40$ the jumps are $\leq1$, when $e\geq 41$ the jumps are $\geq2$, and your conclusion follows. Oct 7, 2014 at 19:27

Please allow me to express my views in an attempt to further simplify this explanation. Experts are welcome to suggest any improvements.

In the scientific representation mentioned by the OP, Mantissa M is represented by 9 bits (0-8) and Exponent e by 6 bits.

Hence, the maximum value that can be expressed by Mantissa and Exponent bits are 511 and 63 respectively. However, as (in IEE 754), Exponent bits all 1s and Mantissa non-zeros means NaN, so the max possible value for E bits shall be 62.

Now the story starts as: Minimum positive number being -> Minimum M and minimum E.

Hence, in scientific notation, [1 + .000000000] x 2^(e-bias) = 1.000000000 x 2^-31 which can be written as [1 x 2^-31 + (0 x 2^-9 x 2^-31)]. This is the smallest positive number which can be represented.

The next number in sequence will be (increment that 0) (2^-31 + 1 x 2^-9 x 2^-31) This can go on till the increment reaches 511. The next increment will be possible only by incrementing the exponent and resetting the Mantissa to 0. (Ex: 1.8 -> 1.9 -> 2.0)

This way the maximum exponent that can be reached is 2^(62-31) = 2^31.

With this, the Mantissa increments will be (2^31 + [0 to 511] x 2^-9 x 2^31) which implies that every single increment from [0 to 511] causes a jump of 2^22.

It is also worth noting that the general maximum possible number using the above notation is (2-2^-9) x 2^31. It is 2-2^-9 because adding one more in the 9 decimal bits (1.111111111) will make it 2.

Hope this helps others too!

largest value = $2^{31} + 511.2^{22}$

2nd largest value = $2^{31} + 510.2^{22}$

so largest difference between them = $2^{22}$

• Your answer doesn't add anything to the accepted answer. Dec 11, 2014 at 4:38
• I think this does provide a simplified and abridged version of the story! Dec 12, 2014 at 11:45
• It doesn't show why the difference between the top two largest numbers is the maximum difference between any two successive real number, and that is very important. @Vaibhav Dec 13, 2014 at 16:26