Checks whether x lies in interval defined by bounds in vec. If it does,
it returns value of x. In case that value of x is lower than lower bound specified
in vec, it returns its value. In case that value of x is greater than upper bound specified
in vec, it returns its value.