How to determine the set of real numbers corresponding to a given floating point number?
The powers of two are more interesting than most other numbers.
Assume you are using double precision IEEE 754 format floating point numbers. Let $u = 2^{-52}$, Then the next floating point number larger than 1 is $1+u$, and the next floating point number smaller than 1 is $1 - u/2$.
A real number x is rounded to 1 if $1-u/4 ≤ x ≤ 1+u/2$. For any floating-point number f with $1 &lt; f &lt; 2$, x is rounded to f if $f - u/2 ≤ x ≤ f + u/2$ if the last bit of f is even, and if $f - u/2 &lt; x &lt; f + u/2$ if the last bit of f is odd.
Numbers x with $f - u/2 &lt; x &lt; f + u/2$ are always rounded to f, because f is the nearest floating point number. For the numbers $x = f ± u/2$, $f$ and $f ± u$ are equally far away, so the round-to-even rule decides.