tanh()函数以及C ++中的示例
C++tanh()函数
tanh()函数是cmath标头的库函数,用于查找给定值(双曲线角)的双曲正切,它接受数字(x)并返回x的双曲正切。
tanh()函数语法:
tanh(x);
参数:x–是用于计算双曲正切值的数字(双曲天使)。
返回值:double-返回double类型的值,它是双曲线角度x的双曲线正切值。
示例
Input:
float x = 2.45;
Function call:
tanh(x);
Output:
0.985217C++代码演示tanh()函数示例
//示例
//tanh()功能
#include <iostream>
#include <cmath>
using namespace std;
//main()部分
int main(){
float x;
x = -10.23;
cout<<"tanh("<<x<<"): "<<tanh(x)<<endl;
x = 0;
cout<<"tanh("<<x<<"): "<<tanh(x)<<endl;
x = 2.45;
cout<<"tanh("<<x<<"): "<<tanh(x)<<endl;
return 0;
}输出结果
tanh(-10.23): -1 tanh(0): 0 tanh(2.45): 0.985217
参考:C++tanh()函数
热门推荐
10 儿子立冬祝福语简短独特
11 对当兵的祝福语简短
12 侄儿高考试祝福语简短
13 伴郎红包祝福语朋友简短
14 媳妇生日简短祝福语朋友
15 公司年会祝福语简短最好
16 元旦感恩祝福语简短大全
17 红包祝福语简短10字
18 周六早晨祝福语简短