How many digits of precision for a number R is required to guarantee that X * R = Y where X and Y are any two decimal place number? I'm sure there's a better way to express this question, so I apologize if I'm doing a poor job.
If I have a two decimal place number $x$, what are the number of decimal places required for number $r$ to guarantee that $x * r = y$, where $y$ is any two decimal place number (after rounding).
I'm not sure how to prove this, but it seems like the answer to my question is $5$. If that's true, why is it true?
To provide more context, the actual problem is I have two numbers $a$ and $b$ that have at most two decimal places of precision. I want to be able to "store" $c$, where $c = round(b/a, z)$, with fixed precision $z$ such that $round(c * a, 2) = b$.
An example is:
\begin{align}
a = 101 \\
b = 102 \\
z = 5 \\
c = round(\frac{b}{a}, z) = 1.00990 \\
round(a * c, 2) = round(101.9999, 2) = 102
\end{align}
I've tested a few different numbers and it seems like $5$ is the magic number for $z$ to make this work for two decimal numbers, but I'm not sure why. Anything smaller than 5 does not work reliably.
 A: My understanding is that we consider floating point arithmetic in the decimal system, so the stated problem reduces to the following problem.
Let $\mathcal S=\{1,\dots,999\}$ be the set of integers from $1$ to $999$. What is the smallest integer $d>0$ such that for all $x,y\in\mathcal S$ there exists $r$ such that $\mathrm{rnd}(xr)=y$ and $r=\sum_{k=a}^br_k\cdot 10^k$ for some suitable $r_k\in\{0,\dots,9\}$ and integers $a<b$ with $b-a=d+1$?
We show that $d=4$. Let $x\in\mathcal S$. Notice that for $\delta\in(0,1/x)$ we have $\{\mathrm{rnd}(x(1+s\delta)):s\in\mathbb Z\}=\mathbb Z$, since the distance $x(1+(s+1)\delta)-x(1+s\delta)=x\delta<1$ between two consecutive numbers is smaller than one and hence we cannot skip an entire interval $\{u\in\mathbb R:\mathrm{rnd}(u)=y\}=[y-0.5,y+0.5)$.
On the other hand, we also have to take into account the leading digits, which can be derived from the number of leading digits of $999/x$.
Now, assume that $x\in\{1,\dots,9\}$ has one digit. Then we clearly need at most three leading digits since $999/x\le 999/1=999$ has three leading digits. On the other hand, we may choose $\delta=0.1$ above since $x\cdot 0.1\le 9\cdot 0.1=0.9<1$. Notice that $999/2=499.5$, that $2\cdot 499=998$ and $2\cdot 500=1000$, so we need at least $d=4$ digits, but it also sufficies.
For $x\in\{10,\dots,99\}$ the same reasoning gives $999/x\le 99.9$ and $\delta=0.01$, and further $x\cdot 99.99=1000-0.01x>1000-1=999$ ensures that four digits suffice. For $x\in\{100,\dots,999\}$ we notice that one leading digit and $\delta=0.001$ suffices, meaning that, again, four digits suffice.
