min = 0 max = 100 v = 50
Given those values, I can calculate the percentage of "completion" for v
within the range [min,max]
like this:
(100.0 / max) * v
And I get 50%
- the desired value.
As you can see, I don't even use the min
variable. So I have problems when this happens:
min = -100 max = 100 v = -50
I would expect the above values to produce 25%
. But clearly, my earlier formula can't do that.
What can I do to calculate such values then? What changes are necessary?