Binary search on real space
I realize now that the only time this is a problem is when the value I'm looking for is either of the starting boundaries. In all other cases, a boundary is only moved after it is checked.

So, all I had to do was check both boundaries once, before the loop starts. A fixed, slightly terser version of the original function:

/**
 * y: the target output value to find a matching input
 * minX: the smallest input value
 * maxX: the largest input value
 * ƒ:    a function that returns a value `y` given an `x`
 * ε:    the threshold to compare outputs versus the target (default:0)
 */
function binarySearch(y, minX, maxX, ƒ, ε) {
    if (ε===undefined) ε=0;
    let m=minX, n=maxX, k, Δ;
    if (Math.abs(y-ƒ(m))&lt;=ε) return m;
    if (Math.abs(y-ƒ(n))&lt;=ε) return n;
    while (m&lt;n) {
        Δ = y - ƒ( k = (n+m)/2 );
        if (Math.abs(Δ)&lt;=ε) return k;
        if (Δ&gt;0) m=k;
        else     n=k;
    }
}


Note that this function also fixes a ~bug in the while loop by changing the condition to m&lt;n instead of m&lt;=n.