So this problem originates from thinking about scaling an pixel coordinate from one resolution to another and back again. Is that operation truly reversible, or is it possible for the pixel coordinate to start walking after being scaled repeatedly?
Considering this in one dimension, let's say we have a point with a value of $x_0$ on a finite line of length $w_0$ that we want to scale to length $w_1$ and back again.
Since we're in pixel coordinates, all results must be natural numbers. To avoid degenerate cases, the lines must have a length greater than 1, (i.e. $\left\{w \in \mathbb{N} \mid 1 \lt w \right\}$). Since $x_0$ is on a line of width $w_0$, $\left \{x_0 \in \mathbb{N} \mid 0 \leq x \lt w_0 \right \}$.
The scaled coordinates are calculated as $$ \begin{align*} x_1 &= Round \left(x_0 \, \frac{w_1 - 1}{w_0 - 1} \right) \\ x_0^\prime &= Round \left(x_1 \, \frac{w_0 - 1}{w_1 - 1} \right) \end{align*} $$ where $Round(x)$ rounds half up (the rounding function used by Javascript), defined for positive numbers as $$ Round(x) = \left \lfloor x + \frac{1}{2} \right \rfloor$$
So given all of this, does it hold that $x_0 = x_0^\prime$, or are there cases where this scaling is non-reversible?
Bonus question: Does this hold for other rounding functions, such as the IEEE 754's default round towards even? $$ Round(x) = \begin{cases} \left \lfloor x \right \rfloor &\text{if } \left \lfloor x \right \rfloor \mod 2 = 0 \\ \left \lceil x \right \rceil &\text{if } \left \lfloor x \right \rfloor \mod 2 \neq 0 \end{cases}$$
EDIT: After running it through a script, the relation definitely doesn't hold for all cases. It would be nice though if I could work out what conditions cause it to fail or some way of preventing this problem
If you scale down and back up, so $w_0 \gt w_1,$ it is guaranteed not to be reversible. There are fewer numbers to scale down to than you started with, so there must be multiple original numbers that scale down to the same $x_1$. For a given $x_1$ you always get back the same $x_0'$. For example, let $w_0=100, w_1=12,$ so $x_1=Round\left(\frac {x_0}9\right)$ Any $x_0$ from $32$ through $40$ will yield $x_1=4$, then $x_0'=36$.