bound the sample interval, return NaN when out of bounds