2 ms·
There are pathological cases where this can converge very slowly. If the denominators are very different, the new "midpoint" is very close to one of the previo
by recursive 4y ago
There are pathological cases where this can converge very slowly. If the denominators are very different, the new "midpoint" is very close to one of the previous bounds. For example, estimating 0.5000000000001 this way takes a ton of iterations.
I found a potential optimization though. If you find that you're repeatedly adjusting the upper/lower bound, you can start adding increasing multiples. It's a provisional step, dependent on the result still being on the same side of the target.