This seems a little brittle because, due to rounding errors, the buckets may not be identical in size, so we may fall back to the binary search function. Are you sure it works in all cases? For example I'd try an array whose size is 7 or 3.