Interface BinarySearch.DoubleSearchTarget
- Enclosing class:
BinarySearch
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Represents the search target that can be found through bisecting the double domain.
- Since:
- 8.0
-
Method Summary
Modifier and TypeMethodDescriptionintlocate(double low, double median, double high) Given a range of[low..high]inclusively withmedianas the mid point of the binary search, locates the target.
-
Method Details
-
locate
int locate(double low, double median, double high) Given a range of[low..high]inclusively withmedianas the mid point of the binary search, locates the target.Returns 0 if
medianis the target; negative to find it in the lower range of[low..median); or positive to find it in the upper range of(median..high].The
(low, median, high)parameters are finite values. And it's guaranteed thatlow <= median <= high.Different from
BinarySearch.IntSearchTargetandBinarySearch.LongSearchTarget, the(low, median, high)parameters don't necessarily split the range in half. Instead,medianis picked such that the number of distinct double precision values in the lower subrange is close to that of the higher subrange.
-