Q:

Is possible to make a binary search by searching between unknown values?

I have a function (we can call it f(x)), that will give me a number.
The value of x is between 0 and 1: f(0) will find the biggest number, f(1), the smallest.
But I don't know if, for example, f(0.2) will give me a different number from f(0); so I have to do a research to find all the number using binary search.
I know that I can iterate from x = 0 to x = 1, but I want to do less function call possible.
Have you any suggest?
I can start by calling f(0), f(1), f(0.5), and then f(0.25) or f(0.75) and so on and so on.
(Mathematically I can divide x endlessly, here I can choose a precision limit)

A:

First you must be sure that the function is monotone. If this is not sure you cannot use a binary search.  
Secondly define the accuracy you want.
Than perform the binary search until no improvement is made or the desired accuracy is reached.

