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()函数
热门推荐
1 带狗狗训练
4 听力训练狗狗
6 怎训练狗狗
7 腹肌训练狗狗
8 网球训练狗狗
9 记叙文训练狗狗
10 狗狗太凶怎么训练
11 核心力量训练狗狗
12 狗狗乱叫怎么训练
13 发音训练狗狗
14 怎么训练狗狗叼东西给主人
15 荆州训练狗狗
16 篮球训练狗狗
17 做训练狗狗
18 训练狗狗坐姿