百度一下只有一篇文章是有用的
http://blog.163.com/shikang999@126/blog/static/1726248962012426103454943/
C语言代码:
#include<stdio.h>
#include<math.h>
#include<time.h>
int times=0,tot=0;
double arctan(double x)
{
times++;
if (x<0)
{return -arctan(-x);}
else if(x<0.25)
{
double s=0,n,t1=1,t2,t3,t4;
t2=x;
t3=x*x;
for(n=1;;n+=2)
{
tot++;
t4=t1*t2/n;
s+=t4;
if(t4>-0.00000000000000001 && t4<0.00000000000000001)
break;//允许误差
t1*=-1;
t2*=t3;
}
return s;
}
else if(x<0.75)
{return 0.46364760900080609+arctan((x-0.5)/(1+x*0.5));}
else if(x<1)
{return 0.64350110879328437+arctan((x-0.75)/(1+x*0.75));}
http://blog.163.com/shikang999@126/blog/static/1726248962012426103454943/
C语言代码:
#include<stdio.h>
#include<math.h>
#include<time.h>
int times=0,tot=0;
double arctan(double x)
{
times++;
if (x<0)
{return -arctan(-x);}
else if(x<0.25)
{
double s=0,n,t1=1,t2,t3,t4;
t2=x;
t3=x*x;
for(n=1;;n+=2)
{
tot++;
t4=t1*t2/n;
s+=t4;
if(t4>-0.00000000000000001 && t4<0.00000000000000001)
break;//允许误差
t1*=-1;
t2*=t3;
}
return s;
}
else if(x<0.75)
{return 0.46364760900080609+arctan((x-0.5)/(1+x*0.5));}
else if(x<1)
{return 0.64350110879328437+arctan((x-0.75)/(1+x*0.75));}