Java Utililty Methods Double Number Clamp

List of utility methods to do Double Number Clamp

Description

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

Method

shortclampRoundShort(double in)
Clamps and rounds a number to the range supported by short data type.
return (in > Short.MAX_VALUE ? Short.MAX_VALUE
        : (in >= Short.MIN_VALUE ? (short) Math.floor(in + 0.5) : Short.MIN_VALUE));
doubleclampToPercentageOrNAN(double input)
clamp To Percentage Or NAN
if (Double.isNaN(input)) {
    return Double.NaN;
} else if (input < 0.0) {
    return 0.0;
} else if (input > ONE_HUNDRED_PERCENT_CPU_VALUE) {
    return ONE_HUNDRED_PERCENT_CPU_VALUE;
} else {
    return input;
...
doubleclampVector(double d)
clamp Vector
return d < 0 ? 0 : (d > 1 ? 1 : d);