#include <stdio.h>
#include <math.h>
double test_func0(double x)
{
return (2*x*x*x - 4*x*x + 3*x - 6);
}
double test_func1(double x)
{
return (6*x*x - 8*x + 3);
}
void newton(double *x, double precision)
{
double x0, x1;
x0 = *x;
x1 = x0 - test_func0(x0) / test_func1(x0);
while(fabs(x1 - x0) > precision)
{
x0 = x1;
x1 = x0 - test_func0(x0) / test_func1(x0);
}
*x = x1;
}