I find that I frequently end up writing a function that I always call \"clamp()\", that is kind of a combination of min() and max(). Is t
clamp()
min()
max()
In some languages you have the function limit
num = limit(val, min, max)