inbounds function

Clip value to a given range