I have a basic math question. I am trying to get a percentage of a range of numbers, and the algorithm bothers me.
Let's say I have a range from -5 to +5 , and I want to know what percentage is between the value. I know that -5 will be equivalent to 0% , and 5 will be 100% , with 0 being 50% .
I tried adding 5 to zoom in, but it just feels hacked. I would like him to feel dynamic, so that I can give him any range and work successfully.
Ex.
percent = (5 + value) * 100 / 10
How can I determine that value should be a common case?
source share