How to scale a ratio to a limited range?

109 Views Asked by At

I'm writing an app and I want to present some ratios normalized on a scale of 0 to 10. It's information like (number of issues resolved : number of issues remaining open).

My idea is to write a function, and a few of its inputs & outputs would be:

f(0)   ->  0
f(0.1) ->  1.0
f(1)   ->  5.0
f(10)  ->  9.0
f(inf) -> 10.0

So, the input is a real number >= 0, and the output is a real between 0 and 10 inclusive.

So my immediate question is: Is there a well known formula that would create this kind of output? I got pretty close with some variations of y = a/(1 + be^(-kx)), but I'm mostly randomly guessing.

I'm interested in any way to solve this, as well as how to generate solutions for it.

Also: since I'm programming this, I could do this with a few functions which I alternatively invoke, depending on the input.

EDIT: Here's @A.S.'s solution, y=10*(x/(1+x)) which looks pretty much perfect:

enter image description here

This is my javascript implementation.