I have a slider than returns percent from 0-1. So I have:
min:0.5
max:3
percent:0.5
I want to retrive what value from range this percent gives (in steps of 0.1). So half from 0.5-3 would be roughly 1.2 (or 1.3 if I round up). How would I calculate this? min can also be positive.
There are 35 steps in increments of 0.1 from 0.5 to 3.0 (0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2 etc... 2.9, 3.0) , so 50% for example would be on the half of that.
Assuming you want to compute $p$ percent value $v$ between min $m$ and max $M$, where $M > m$ and $0 \le p \le 1$, you compute $$ v = m + p(M-m) = pM + (1-p)m. $$
For your example, $m = 0.5, M = 3$ and $p = 50\% = 0.5$ so we get $$ v = 0.5 + 0.5(3-0.5) = 0.5+1.25=1.75, $$ which is exactly half-way between $M=3$ and $m = 0.5$, as expected.