# How to scale a ratio to a limited range?

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:

This is my javascript implementation.

• Can you have more than eleven inputs? Dec 19, 2015 at 23:30
• Yes @GitGud the input is a real >= 0, and the output is a real bet. 0 and 10 inclusive. Dec 19, 2015 at 23:32
• $f(x)\approx 10\frac x {1+x}$
– A.S.
Dec 19, 2015 at 23:37
• In fact, I'd argue it's THE function you should use since $x\to \frac{x}{1+x}$ is transformation from odds (your input) to probabilities - very meaningful output.
– A.S.
Dec 19, 2015 at 23:42
• Deleted my question about the nearest integer function. I'm the second person to believe the outputs need be integers for some reason. Dec 19, 2015 at 23:45