Calculating a percentage between two numbers

292 Views Asked by At

I have two numbers, a minimum value, and a maximum value.

I also have a percent. This percent helps me find a value between the two numbers, the minimum value and the maximum value.

I cannot figure out how to do this (perhaps because I’ve been staring at the numbers for so long)

For example, say I have a minimum of 0.08, and a maximum of 0.12 and a percent of 0.9 (i.e 90%)

I want to find the value which is 90% of the way between 0.08 and 0.12.

Any ideas?

Thanks

2

There are 2 best solutions below

0
On BEST ANSWER

Let $d$ be the positive difference between the minimum and maximum values. Let $p$ be the percent (measured by say $0.9$ instead of $90$%), and $x$ be the minimum value. Then the value $y$ that you are looking for can be found by

$$y=x+pd$$

Intuitively $pd$ gets the position between the min and max that you want, and adding it to $x$ gets you to the actual value you want.

0
On

Here is one approach: Given two numbers $x,y \in \Bbb R$, $x < y$ and a percentage $p \in [0,100]$, calculate the difference $y-x$, multiply with $p\%$ (note that $\% := 0.01$, so $p\% \in [0,1]$) and then $x + p\%(y-x)$ gives the desired result.

In the given example, w have $y-x = 0.04$ and $p\%(y-x) = 0.9 \cdot 0.04 = 0.036$, so that $x+p\%(y-x) = 0.08 + 0.036 = 0.116$ is the correct result.