double dichotomy(double infinum, double supremum, double epsilon) {
double x;
while (supremum - infinum > epsilon) {
x = (infinum + supremum) / 2;
if (func(supremum) * func(x) < 0)
infinum = x;
else
supremum = x;
}
return (infinum + supremum) / 2;
}