add clamping a value to a certain range