淡泊明志 宁静致远
分类: C/C++
2006-12-06 10:04:21
【C语言库函数源代码】
【本程序在Dev C++ 4.9.9.2 下编译通过】
double my_atan(double x)
{
register double ret;
__asm__(
"fld1\n\t"
"fpatan"
: "=t" (ret)
: "0" (x)
);
return ret;
}//求x的反正切值。
int main()
{
double a =
0.5;
printf("atan(%f) = %f\n",a,atan(a));
printf("my_atan(%f) =
%f\n",a,my_atan(a));
a = -0.5;
printf("atan(%f) = %f\n",a,atan(a));
printf("my_atan(%f) =
%f\n",a,my_atan(a));
system("pause");
return 0;
}