Let fabs
be a function that returns the absolute value of a float.
Then the formula could look like this:
function calcRank(float v1, float v2) {
float k = fabs(v2-30.0);
if (k < 30.0) {
// Rule 1 and 2
rank = k/60.0 + (60.0-k) * v1 / 60.0;
} else {
// Rule 3
rank = v1;
}
return rank;
}
3
solved Custom Weighted Scale [closed]