Check range of y in HasNearLog

Fixes #803