clear; clc;

low = 1;
high = 2;
eps = 1e-10;

while high - low > eps
    mid = (low + high) / 2;

    f_high = high ^ 3 - high - 2;
    f_low = low ^ 3 - low - 2;
    f_mid = mid ^ 3 - mid - 2;

    if f_high * f_mid < 0
        low = mid;
    else
        high = mid;
    end
end

mid
residual = f_mid