constrain static method

double constrain(
  1. double amt,
  2. double low,
  3. double high
)

Implementation

static double constrain(double amt, double low, double high) {
  return (amt < low) ? low : ((amt > high) ? high : amt);
}