My colleague ran into the following problem while writing billing software.
Suppose you have a monetary amount $M$ and a tax rate $t$. For example, $M = 20.1253$ and $t = 0.07$.
The question is what are the formulas for the numbers $L$ and $H$ such that $L$ $(H)$ is the lowest (highest) number with 2 decimal places such that $T(L) = T(M)$ and $T(H) = T(M)$ with $T(x)={1\over100}[100tx + 0.5]$ where $[]$ is the greatest integer function.
In other words, what is the formula, in terms of $M$ and $t$, of the lowest and highest monetary amounts which have the same tax amount as $M$, given tax rate $t$ and rounding to the nearest penny including rounding exact halves upwards?