#include #include float f(float x) { return exp(-x*3.0)*(x-1.0)+x*x*x; } float df(float x) { return exp(-x*3.0)*(-3.0*x+4.0)+3.0*x*x; } float tolx(float x) { return fabs(x)*1.0e-6+1.0e-6; } void main () { int zeroinder(float *, float *, float (*)(float), float (*)(float), float (*)(float)); float x,y; x=0.0; y=1.0; if (zeroinder(&x,&y,f,df,tolx)) printf("Calculated zero and function value:\n %e %e" "\nOther straddling approximation and function value:" "\n %e %e\n",x,f(x),y,f(y)); else printf("No zero found."); }