Suppose I have the number 0.342543 and I want to round it to the 2 places after the radix point using round to the nearest algorithm. In school I was taught that I should look at the next digit and if it's less than 5, I should just truncate the digits. If it's greater than 5, then I should increase the digit by one. I'm why is that? Can you guys show me that using expansion form, i.e.
Let's write our number as $$ 0 + 3\times \frac{1}{10^{-1}} + 4\times \frac{1}{10^{-2}} + 2\times \frac{1}{10^{-3}} + 5\times \frac{1}{10^{-4}} + 4\times \frac{1}{10^{-5}} + 3\times \frac{1}{10^{-6}}$$ From here we can see that...
Thanks!
Let's consider your example. Is $0.345243$ closer to $0.34$ or $0.35$? That depends only on whether it's above or below $0.345$, the number in the middle between $0.34$ and $0.35$. How can you check whether a number $x$ starting with $0.34$ is greater than $0.345$? If $x$ is greater than $0.345$, the next digit after $0.34$ must be at least $5$ or greater, and if $x$ is less than $0.345$, then the digit after $0.34$ must be less than $5$. Therefore the next digit is enough to tell whether $x$ is closer to $0.34$ than to $0.35$.