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

doubleclamp(double a, double min, double max)
clamp
return a < min ? min : a > max ? max : a;
doubleclamp(double d, double min, double max)
clamp
if (d < min)
    d = min;
if (d > max)
    d = max;
return d;
doubleclamp(double d, double min, double max)
clamp
if (min > max)
    throw new IllegalArgumentException("min > max");
if (d >= max)
    return max;
if (d <= min)
    return min;
return d;
doubleclamp(double d, double min, double max)
Clamps d between min and max.
if (d < min)
    return min;
else if (d > max)
    return max;
else
    return d;
doubleclamp(double d, double min, double max)
Gibt eine Zahl zurueck, die im gegebenen Intervall liegt: [min; max].
return Math.max(Math.min(d, max), min);
doubleclamp(double f)
Returns the given float clamped to 1/1000th precision.
return (f > -1e-3) && (f < 1e-3) ? 0 : (f > 1e5 ? 1e5f : (f < -1e5 ? -1e5f : f));
doubleclamp(double f, double f1, double f2)
clamp
return f < f1 ? f1 : (f > f2 ? f2 : f);
doubleclamp(double min, double arg, double max)
Clamps arg between min and max.
return Math.min(max, Math.max(min, arg));
doubleclamp(double min, double max, double val)
clamp
if (val > max)
    return max;
else if (val < min)
    return min;
else
    return val;
doubleclamp(double min, double max, double value)
Constrains the value between the given borders (inclusive).
return Math.min(Math.max(min, value), max);