Clamp function

FIgure out how wide your input domain is. (Max minus min.)

Take the input value you're interested in and subtract the min of the domain. Divide by the width, and you have a number between 0 and 1 that tells you what fraction of the way your value is.

Figure out how wide the output range is. (f(max) minus f(min))

Now take your fraction of the width of the range, add f(min), and you're all set.

Is that what you need?