code: @Pure
  	public static double clamp(double v, double min, double max) {
  		assert min <= max : AssertMessages.lowerEqualParameters(1, min, 2, max);
  		if (v < min) {
  			return min;
  		}
  		if (v > max) {
  			return max;
  		}
  		return v;
  	}
docs: Clamp the given value to the given range.
  
  <p>If the value is outside the {@code [min;max]}
  range, it is clamp to the nearest bounding value
  {@code min} or {@code max}.
  
  @param v is the value to clamp.
  @param min is the min value of the range.
  @param max is the max value of the range.
  @return the value in {@code [min;max]} range.