# Function that bind a range of values between 3.5 and 70 to 0.5 and 1.5

Notice that I'm definitely not an expert in math, and I'm going to use this function in a game for something connected to lights (however, is very math-specific, that's why I'm posting here and not on gamedev).

I need a function to "bind" every value between 3.5 and 70 to values between 0.5 and 1.5 Where 3.5 => 0.5 and 70 => 1.5. So for example the value 36.75 will be 1.0.

Also, if possible, I would like to change the first two values to have a different range and the other 2 values to a different range.

Are there any math function that satisfact what I'm asking (if exists)?

Sorry if it looks as an easy question for someone, but really I'm quite noob in math^^

-
You could perform linear interpolation, at the simplest: $$y=\frac{1.5-0.5}{70-3.5}(x-3.5)+0.5$$ – J. M. Apr 24 '12 at 12:57
Mhh that's interesting, I didn't think about it, why don't you put it as an answer? – Fire-Dragon-DoL Apr 24 '12 at 13:04
Graph of a straight line passing through (0.5,3.5) and (1.5,70), thats what you need. – Tomarinator Apr 27 '12 at 17:12