return nan when out of bounds