binary search, closest match