private Point xBinarySearch(Point left, Point right) {
        int y = left.y; // the same for right and left
        Point mid;
        while (true) {
            if (abs(left.x - right.x) == 1) {
                if (abs(left.dF) <= abs(right.dF)) {
                    return left;
                } else {
                    return right;
                }
            }

            mid = new Point((right.x + left.x) / 2, y);
            if (mid.dF == 0 || mid.dF == left.dF || mid.dF == right.dF) return mid;

            //System.out.println((mid.dF + " : " + left.dF + " :: " + right.dF));
            //System.out.println("left.x : " + left.x + " right x : " + right.x + " x : " + mid.x);
            if (mid.dF * left.dF < 0) {
                right = mid;
            }
            if (mid.dF * right.dF < 0) {
                left = mid;
            }

        }

    }