代码
#include<stdio.h>
double MYLOG(double a)
{
int N = 15;
int k,nk;
double x,xx,y;
x = (a-1)/(a+1);
xx = x*x;
nk = 2*N+1;
y = 1.0/nk;
for(k=N;k>0;k--)
{
nk = nk - 2;
y = 1.0/nk+xx*y;
}
return 2.0*x*y;
}
int main()
{
int N=100;
for(int a=1;a<N;a++)
printf("ln %d = %.10f \n",a,MYLOG(a));
getchar();
return 0;
}