I want to normalize a range of decimals into a new range from 0 to 1.
Lets say the maximum value of the range is 0.865400 and the minimum value of the range is 0.0004530.
How can I convert values from the given range into a new range from 0 to 1 ?
I want to normalize a range of decimals into a new range from 0 to 1.
Lets say the maximum value of the range is 0.865400 and the minimum value of the range is 0.0004530.
How can I convert values from the given range into a new range from 0 to 1 ?
You seem to look for a way to rescale an arbitrary interval $[x,y]$ onto $[0,1]$, and do so while preserving the order on these two intervals. This will be achieved by an affine function $f : [x,y] \to [0,1]$, of the general form $f(t) = at + b$. It remains to find out $a$ and $b$.
The requirements placed upon $f$ insure that $f(x) = 0$ and $f(y) = 1$, which can be rewritten as
$$\left\{ \begin{eqnarray} ax + b = 0 \\ ay + b = 1 \end{eqnarray} \right.$$
whence it quickly follows that
$$a = \frac 1 {y-x}, \qquad b = -ax = - \frac x {y-x} ,$$
so that
$$\color{red} {f(t) =} \frac 1 {y-x} t - \frac x {y-x} = \color{red} {\frac {t-x} {y-x}} .$$