【Linux】关于三角函数、反三角函数在VC和linux gcc下的编译
写法:1.都要包含 <math.h>2.三角函数,比如计算sin(30),应写double a;a = sin(30 * 3.1415926 /180);3.反三角函数,比如arctan(1),应写double b;b = atan(1) * 180 / 3.1415926; 在linux下,用gcc编译,最后要加 -lm ,比如:gc...
·
写法:
1.都要包含 <math.h>
2.三角函数,比如计算sin(30),应写
double a;
a = sin(30 * 3.1415926 /180);
3.反三角函数,比如arctan(1),应写
double b;
b = atan(1) * 180 / 3.1415926;
在linux下,用gcc编译,最后要加 -lm ,比如:
gcc test.c -lm
更多推荐
已为社区贡献1条内容
所有评论(0)