My front-end (SourcePawn) currently does the following:
float fPoints = 0.0;
float fWeight = 1.0;
fPoints += (results.FetchFloat(0) * fWeight);
fWeight *= 0.95;
SELECT points FROM table WHERE auth = 'authentication_id' AND points > 0.0 ORDER BY points DESC;
You can do this using variables:
SELECT points, (points * (@f := 0.95 * @f) / 0.95) as fPoints FROM table t CROSS JOIN (SELECT @f := 1.0) params WHERE auth = 'authentication_id' AND points > 0.0 ORDER BY points DESC;
A note about the calculation. The value of
@f starts at 1. Because we are dealing with variables, the assignment and the use of the variable need to be in the same expression -- MySQL does not guarantee the order of evaluation of expressions.
0.95 * @f reduces the value by 5%. However, that is for the next iteration. The
/ 0.95 undoes that to get the right value for this iteration.