I'm trying to understand rounding of binary numbers using number representation as a sum of fractions. So suppose I have a number in binary: $$ 0.11011 = 0 + 1\times\frac{1}{2} + 1\times\frac{1}{4} + 0\times\frac{1}{8} + 1\times\frac{1}{16} + 1\times\frac{1}{32} $$
I want to round it to 2 significant digits after the radix point. I've read that:
If bit 3 is 0, round down
Can someone please explain me why it's so using fractions I showed in my example?
I will use a decimal analogy here.
Let's consider the case of rounding $x=123.45$ to the nearest integer $X$. The round-to-nearest approach requires that the rounded result $X$ is as close to the non-rounded number $x$ as possible. This means $|X-x|\leq\frac{1}{2}=0.5$. That requirement translates to:
In our example, $X=123$ (rounded down). If we were to round sequentially, one digit at a time, first to $123.5$, then to $124$, the result would not be the nearest possible to the unrounded value $x$.
The critical digit is $5$ because we are dealing with base $10$ here: $\frac{1}{2}=\frac{5}{10}$. For base $2$, the critical digit is $1$, therefore the analogous rule for binary representations is to round up if the leftmost to-be-rounded-away bit is $1$ (and higher, but there are no higher digits in the binary system), else to round down.