C++ cmath tanh() 函数
定义和用法
tanh()
函数返回数的双曲正切值。双曲正切值等价于 sinh(number) / cosh(number)
。
tanh()
函数在 <cmath>
头文件中定义。
实例
返回不同数的双曲正切值:
cout << tanh(3); cout << tanh(-3); cout << tanh(0); // 返回 0,因为 tanh(0) = 0 cout << tanh(1); // 返回接近 0.7616 的值,因为 tanh(1) ≈ 0.7616
语法
以下之一:
tanh(double number);
tanh(float number);
参数
参数 | 描述 |
---|---|
number |
必需。指定一个数。 如果该数是整数类型,则会被视为 |
技术细节
返回: |
如果参数是 否则返回一个 双曲正切值的范围是 -1 到 1 之间,包括 -1 和 1。 |
---|