I was exploring a simple reverse sales-tax calculation in Wolfram Language while working on a small calculator project.
For a final price of $108 with an 8% sales tax:
108/(1 + 8/100)
gives:
100
So the pre-tax price is $100.
I then generalized the calculation as:
reverseTax[price_, rate_] := price/(1 + rate/100)
I'm curious how other Wolfram Language users would approach this. Would you use Manipulate to turn it into a small interactive calculator, or is there a more idiomatic way to structure this?
I'm also wondering how you would handle things like rounding the result to two decimal places and preventing invalid inputs, such as a negative tax rate. Would you handle that validation inside DynamicModule/Manipulate, or separately?
For anyone interested in the practical application, I also put together a simple online version of the reverse-tax calculation at https://calculatereversetax.com.