C++ cmath atanh() 函数

定义和用法

atanh() 函数返回数的反双曲正切值。

atanh() 函数定义在 <cmath> 头文件中。

实例

返回不同数的反双曲正切值:

cout << atanh(0.78);
cout << atanh(0.5);
cout << atanh(1);

亲自试一试

语法

以下之一:

atanh(double number);
atanh(float number);

参数

参数 描述
number

必需。要查找其反双曲正切值的数,范围在 -1 到 1 之间。

如果值超出 -1 到 1 的范围,则返回 NaN(非数字)。

如果值等于 -1 或 1,则返回负无穷大或正无穷大。

如果该数为整数类型,则将被视为 double 类型。

技术细节

返回:

如果参数为 float 类型,则返回 float 值。

在其他情况下,返回 double 值,表示数的反双曲正切值。