Java Utililty Methods Float Number Clamp

List of utility methods to do Float Number Clamp

Description

The list of methods to do Float Number Clamp are organized into topic(s).

Method

floatclamp(float f, float min, float max)
Keeps f within min and max.
return Math.max(min, Math.min(f, max));
floatclamp(float input, float min, float max)
clamp
return (input < min) ? min : (input > max) ? max : input;
floatclamp(float min, float max, float val)
clamp
float _min = Math.min(min, max);
float _max = Math.max(min, max);
return Math.max(Math.min(val, _max), _min);
floatclamp(float min, float max, float value)
clamp
if (min > value)
    return min;
if (max < value)
    return max;
return value;
floatclamp(float min, float x, float max)
Clamps a value between a min and a max, both inclusive.
return Math.min(max, Math.max(x, min));
floatclamp(float n, float minValue, float maxValue)
clamp
return max(minValue, min(n, maxValue));
floatclamp(float num, float min, float max)
Returns the value of the first parameter, clamped to be within the lower and upper limits given by the second and third parameters
if (num < min) {
    return min;
} else {
    return num > max ? max : num;
floatclamp(float v)
Clamps the value so the result is between 0.0 and 1.0.
return 0 > v ? 0 : 1 < v ? 1 : v;
floatclamp(float v, float min, float max)
Clamp the given value to the given range.
if (min < max) {
    if (v < min)
        return min;
    if (v > max)
        return max;
} else {
    if (v > min)
        return min;
...
floatclamp(float val, float low, float high)
Clamps a value between a lower and upper bound.
if (val < low)
    return low;
if (val > high)
    return high;
return val;