If I take the value 100 and I want to and 10% tax to it and then a 7% tax to it, I am doing the following:
$\begin{align*} 100 \times \left(1 + \frac{10}{100}\right) &= 110\\ 100 \times \left(1 + \frac{7}{100}\right) &= 107\\ 100 + 10 + 7 &= 117. \end{align*}$
If I remove 10% and then 7% from 117, I do not get 100, I get 98.7094.... My formula is setup like this:
GrandTotal = 117
AjustedTotal = GrandTotal
Value = GrandTotal - (GrandTotal/(1 + (percent/100))
AdjustedTotal = AdjustedTotal - Value
If I am doing more than 1 percentage, I run into problems such as 10% and 7%.
Am I overdoing this and what am I doing wrong. Basically, I want to take a value and add taxes to it and then remove the same taxes to retrieve my original value.
I added a question about this on stackoverflow here, but I am stuck at programming the non-compounding part and the mixture of both.