I'm not even sure how to ask this question, so bear with me for a second.

Given a linear input value, such as floating point numbers between 0 and 1, how can I produce an output that favors higher input values?

For example, let's say I have a function that generates probability values between 0 and 1, where 0 is a definite NO and 1 is a definite YES. Between 0 and 1, anything above 0.9 is a likely YES and anything below 0.5 is a likely NO. Now, let's say I want to produce an output value based on those probabilities that favors (places more value on) the higher end of the scale, and that the output value should be integers between 0 and 255.

So, a manual example goes like this:

prob 0.00 = output 0
prob 0.50 = output 50
prob 0.75 = output 130
prob 0.90 = output 150
prob 0.92 = output 155
prob 0.94 = output 160
prob 0.96 = output 175
prob 0.98 = output 200
prob 1.00 = output 255

These exact outputs aren't of interest for me, I'm simply trying to show the concept---that the majority of the available output numbers are achieved from probabilities between 0.9 and 1.0.

Is this approximating a logarithmic scale? Something else? Any easy way to calculate this kind of output (something close to it concept, not precision)?


  • 2
    $\begingroup$ You could choose any function which starts at zero and increases faster than linearly, like a polynomial or an exponential. For example. $\endgroup$ Mar 11, 2012 at 19:33
  • $\begingroup$ i see, thanks. what would a polynomial example look like? $\endgroup$
    – mix
    Mar 11, 2012 at 20:57
  • $\begingroup$ $f(x) = 255x^2$ $\endgroup$ Mar 11, 2012 at 21:12

1 Answer 1


The answer (given in comments) is to use a polynomial function such as $255x^2$ (or $255 x^n$ for other values of $n$). Other nonlinear functions, such as $\exp$, can also be used but polynomials are very easy to evaluate. A related concept is sigmoid.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .