clamp method

double clamp(
  1. double value
)

Implementation

double clamp(double value) => value < min ? min : (value > max ? max : value);