
#include <stdio.h>
#include <math.h>
// 定义函数f(x)
double f(double x)
{
return pow(x, 3) - 5 * pow(x, 2) + 16 * x - 80;
}
// 计算弦与x轴的交点
double xpoint(double x1, double x2)
{
double xc= (x1 * f(x2) - x2 * f(x1)) / (f(x2) - f(x1));
return xc;
}
// 使用弦截法求根
double root(double x1, double x2)
{
double xc = xpoint(x1,x2);
if(fabs(f(xc))<=0.0001) return xc;
if(f(xc)*f(x1)<0)
{
return root(x1,xc);
}
else{
return root(xc,x2);
}
}
int main() {
double x1,x2;
while(1)
{
scanf("%lf %lf", &x1, &x2);
if(f(x1)*f(x2)<0)
{
printf("%.6lf\n",root(x1,x2));
break;
}
else{
printf("reinput:\n");
}
}
return 0;
}