Check whether a value is between two limits