sin(x)的求解释!!!为什么x大于PI/2时,就死循环了咧???
/* Note:Your choice is C IDE */#include "stdio.h"
#include "math.h"
void main()
{
float x,X,e,E,s;
int n,i,I;
scanf("%f%f",&x,&e);
n=1;
i=1;
I=1;
s=x;
X=x;
do
{
n++;
i+=2;
I*=i*(i-1);
X*=x*x;
E=X/I;
if(n%2==0)
s+=-E;
else
s+=E;
}
while(fabs(E)>=e);
printf("%f\n",s);
}