I think, it does work for monotonic functions only.

An example: `f(x) = 1/(x-1)**2` for `x` in `[0, 2]`.