0
$\begingroup$

Consider the set of floating point numbers $\mathbb{F}_{10,3,100}$. That is, decimal numbers with $3$ significant digits and exponents between $-98$ and $99$.

What is the distance between $1230000$ and the closest floating point number $\ne 1230000$ in the set $\mathbb{F}_{10,3,100}$?

My current thought process:

The closest floating point number in the set is when the significant digits are, in order, $2, 3, 0$, and the exponent is $e = 6$. This is when $F = 10^6\cdot(1 + {2 \over 10} + {3 \over 10^2} + {0 \over 10^3})$

But that is exactly equal to $1230000$.

I could play with the significant digits, making it $F = 10^6\cdot(1 + {2 \over 10} + {3 \over 10^2} + {1 \over 10^3})$, but something seems amiss.

P.S. new to floating point arithmetics, anyone has any good resources?

$\endgroup$
  • $\begingroup$ Note that you only have normalized floating point formats for base 2, in base 10 the first digit can be different from 1. $\endgroup$ – LutzL Feb 8 '17 at 20:37
  • $\begingroup$ Wouldn't that still produce exactly 1230000? i.e. $10^6 \cdot (1 + {2 \over 10} + {3 \over 10^2})$? $\endgroup$ – B.Li Feb 9 '17 at 5:50
  • $\begingroup$ Yes, as 1230000 is exactly representable. It means that between 1220000, 1230000 and 1240000 there are no other representable numbers. $\endgroup$ – LutzL Feb 9 '17 at 8:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.