tan C · 数学函数
求正切值,参数是弧度而不是角度。
怎么用
double r = tan(弧度);
小例子
#include <stdio.h>
#include <math.h>
int main(void) {
printf("%f", tan(3.14159 / 4));
return 0;
}
运行结果
输出接近 1.000000
提醒:头文件是 math.h;π/2 等奇数倍处无定义
在代码里遇到不认识的词?打开代码点读机,点一下就懂 → ← C全部词条