clip<T extends num> function

T clip<T extends num>(
  1. T val,
  2. T lower,
  3. T upper
)

Implementation

T clip<T extends num>(T val, T lower, T upper) {
  return min(upper, max(val, lower));
}