Skip to main content
11 events
when toggle format what by license comment
S Mar 15, 2020 at 0:17 history suggested CommunityBot CC BY-SA 4.0
xtra parenthesi
Mar 14, 2020 at 21:54 review Suggested edits
S Mar 15, 2020 at 0:17
Jul 2, 2019 at 20:48 comment added Tom @Daisy You only need to make sure that when both values are below 0, then max is the value with the largest absolute value. For example -50 and -20, then max=-50 and min=-20. Range will be -30, but that is fine. The negative sign is needed, since correctedStartValue will be negative as well.
Jul 2, 2019 at 20:46 comment added Tom @Daisy, well let's test it. If you're going from -10 to 10, then range is 10 - (-10) which is 10 + 10 and 20. Looks correct. Then assume input is 8. correctedStartValue would be 8 - (-10) = 18. That first looks strange, but lets keep going. The result would be (18*100) / 20 = 90%. And 90% looks fine to me for value 8 between -10 and 10.
Jul 2, 2019 at 20:36 comment added Daisy How would this work if the range has a negative number in either max or min?
May 23, 2017 at 12:18 history edited URL Rewriter Bot
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Feb 24, 2017 at 14:36 comment added Kaizar Laxmidhar I suspect the formula can work when either one or both the range numbers are negative.
Dec 13, 2016 at 12:43 history edited Tom CC BY-SA 3.0
Added the adjusted formula provided by dustin
Feb 17, 2016 at 23:11 comment added Dustin I needed to find the value in a range given the percentage. Taking this formula, I reworked it to val = ((percent * (max - min) / 100) + min
Sep 14, 2014 at 17:02 vote accept user45675
Sep 14, 2014 at 16:54 history answered Tom CC BY-SA 3.0