关于三角函数、反三角函数在VC和linux gcc下的编译

来源:互联网 发布:win10重装linux子系统 编辑:程序博客网 时间:2024/05/22 12:04

写法:

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