limit
limit (num, low, high)
The limit function returns num, limited to the range from low to high :
num if low <= num <= high
low if num < low
high if num > high
Details
Since all comparisons with NaN return false, limit will not work as expected with NaNs. If a parameter may be NaN, use numtype to test it before calling limit.