标签:
#include <stdio.h>
#include <math.h>
int
main()
{
double
a,b,c,d,n,m,x,y;
while
(
scanf
(
"%lf,%lf,%lf,%lf"
,&a,&b,&c,&d)!=EOF)
{
x=0;
m=a*x*x*x+b*x*x+c*x+d;
n=3*a*x*x+2*b*x+c;
y=x-m/n;
while
(
fabs
(x-y)>=1e-5)
{
x=y;
m=a*x*x*x+b*x*x+c*x+d;
n=3*a*x*x+2*b*x+c;
y=x-m/n;
}
printf
(
"%.6lf\n"
,y);
}
return
0;
}
标签:
原文地址:http://www.cnblogs.com/liuming1115/p/4479448.html