1/*Package f64 provides helper functions for the float64 type.*/ 2package f64 3 4// Clamp returns the value if it fits within the parameters min and max. 5// Otherwise returns the closest boundary parameter value. 6func Clamp(value, min, max float64) float64 { 7 if value > max { 8 return max 9 } 10 if value < min { 11 return min 12 } 13 return value 14} 15