c语言正切函数tan()实例源码应用



c语言正切函数tan()实例源码应用。引入的头文件:#include <math.h>,定义正切函数tan():double tan(double x);

函数说明:tan()用来计算参数x 的正切值,然后将结果返回。

返回值:返回参数x 的正切值。

注意,使用 GCC 编译时请加入-lm。

正切函数tan()实例源码
#include <math.h>
main(){
double answer = tan(0.5);
printf(“tan(0.5) = %f\n”, answer);
}

执行
tan(0.5) = 0.546302