atanh, atanhf, atanhl

计算反双曲正切。

语法

double atanh( double x );
float atanhf( float x );
long double atanhl( long double x );
#define atanh(X) // Requires C11 or higher

float atanh( float x );  // C++ only
long double atanh( long double x );  // C++ only

参数

x
浮点值。

返回值

atanh 函数返回 x 的反双曲正切(弧双曲正切)。 如果 x 大于 1 或小于 –1,则将 errno 设置为 EDOM 且结果是 quiet NaN。 如果 x 等于 1 或 -1,则分别返回正无穷或负无穷且将 errno 设置为 ERANGE

输入 SEH 异常 _matherr 异常
± QNaN、IND
X ≥ 1; x ≤ -1

注解

由于 C++ 允许重载,因此你可以调用采用并返回 atanhfloat 值的 long double 重载。 在 C 程序中,除非使用 <tgmath.h> 宏调用此函数,否则 atanh 始终采用并返回 double

如果使用 <tgmath.h>atanh() 宏,则参数的类型将决定选择哪个版本的函数。 有关详细信息,请参阅泛型类型数学

默认情况下,此函数的全局状态范围限定为应用程序。 若要更改此行为,请参阅 CRT 中的全局状态

要求

函数 C 标头 C++ 标头
atanh, atanhf, atanhl <math.h> <cmath> 或 <math.h>
atanh <tgmath.h>

有关兼容性的详细信息,请参阅 兼容性

示例

// crt_atanh.c
// This program displays the hyperbolic tangent of pi / 4
// and the arc hyperbolic tangent of the result.
//

#include <math.h>
#include <stdio.h>

int main( void )
{
   double pi = 3.1415926535;
   double x, y;

   x = tanh( pi / 4 );
   y = atanh( x );
   printf( "tanh( %f ) = %f\n", pi/4, x );
   printf( "atanh( %f ) = %f\n", x, y );
}
tanh( 0.785398 ) = 0.655794
atanh( 0.655794 ) = 0.785398

另请参阅

数学和浮点支持
acoshacoshfacoshl
asinhasinhfasinhl
coshcoshfcoshl
sinhsinhfsinhl
tanhtanhftanhl