C语言中tan函数的参数,C语言中正切的相关函数总结

C语言tan()函数:正切函数头文件:

#include

tan() 函数用来求给定值的正切值,其原型为:

double tan(double x);

【参数】x 为给定的弧度值。

【返回值】返回 x 的正切值。

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

请看下面的代码:

#include

main(){

double answer = tan(0.5);

printf("tan(0.5) = %f\n", answer);

}

输出结果:

tan(0.5) = 0.546302

C语言tanh()函数:双曲线正切函数头文件:

#include

tanh() 用来求一个数的双曲正切值,其原型为:

double tanh(double x);

【参数】x 为双曲正切上的某点。

【返回值】返回 x 的双曲正切值,取值范围为 -1 到 1。

双曲正切的定义为 sinh(x)/cosh(x),即

a66c1744ad274f19897a59cbf2ce4bb2.png

双曲正切曲线示意图:

c74f00d899020a6e32814732975daa54.png

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

请看下面的代码:

#include

main(){

double answer = tanh(0.5);

printf("tanh(0.5) = %f\n", answer);

}

输出结果:

tanh(0.5) = 0.462117

C语言atan()函数:求反正切的值(以弧度表示)头文件:

#include

定义函数:

double atan(double x);

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

返回值:返回-PI/2 至PI/2 之间的计算结果。

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

范例

#include

main(){

double angle;

angle = atan(1);

printf("angle = %f\n", angle);

}

执行

angle = 1.570796

C语言atan2()函数:求反正切的值(以弧度表示)头文件:

#include

定义函数:

double atan2(double y, double x);

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

返回值:返回-PI/2 至PI/2 之间的计算结果。

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

范例

#include

main(){

double angle;

angle = atan2(1, 2);

printf("angle = %f\n", angle);

}

执行

angle = 0.463648

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值