# Calculate value in range from percentage

Let's say i have

N1 = -584

N2 = 110

Z = 0.64

How do i calculate from Z which value is it in range of N1..N2? Z is range from 0 to 1.

-
For example, i need to calculate where object should be placed on X axis, but i know only the percentage where it can be (0 - far left = -584, 1 = far right, +110) – Deniss Kozlovs Oct 3 '12 at 23:19

If by $Z=0.64$ you want a number that $64\%$ of the way from $-584$ to $110,$ the expression is $-584 + 0.64(110-(-584))$

-
 Exactly! Thanks! – Deniss Kozlovs Oct 3 '12 at 23:17

We want to map numbers in the interval $[0,1]$ to numbers in your interval $[-584,110]$ by a function $fx)$ of the shape $f(x)=px+q$.

We want $f(0)=-584$, and $f(1)=110$, so $q=-584$ and $p=694$.

So our function is $694x-584$. Plug in $x=0.64$.

Remark: Exactly the same idea will work if our target interval is, say, $[a,b]$. We get $q=a$ and $p=b-a$. So the linear function $f(x)$ that maps $[0,1]$ to $[a,b]$ is given by $f(x)=(b-a)x+a$.

-