Luís Marques wrote:
A naive binary chop doesn't work correctly. The fact that there are
hundreds or thousands of times as many representable numbers between 0
and 1, as there are between 1 and 2, is problematic for
divide-and-conquer algorithms. A naive binary chop would divide the
interval [0 .. 2] into [0 .. 1] and [1 .. 2]. Unfortunately, this is
not a true binary chop, because the interval [0 .. 1] contains more
than 99% of the representable numbers from the original interval!
How about adding a template to do a binary chop (binary search?) to
std.algorithm?
findRoot() (which needs to be updated to take advantage of compiler
improvements) does the job in the most important case. I'm quite proud
of it; as far as I know, it's uses a better algorithm than anything else
on the planet. <g>