acosh, acoshf, acoshl

计算反双曲余弦。

语法

double acosh( double x );
float acoshf( float x );
long double acoshl( long double x );
#define acosh(X) // Requires C11 or higher

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

参数

x
浮点值。

返回值

acosh 函数返回 x 的反双曲余弦(弧双曲余弦)。 这些函数在 x ≥ 1 的域上有效。 如果 x 小于 1,则将 errno 设置为 EDOM 且结果是 quiet NaN。 如果 x 是 quiet NaN、不确定数或无穷大,则将返回相同的值。

输入 SEH 异常 _matherr 异常
± QNaN、IND、INF
x< 1

备注

使用 C++ 时,你可以调用采用并返回 acoshfloat 值的 long double 重载。 在 C 程序中,除非使用 <tgmath.h> 宏调用此函数,否则 acosh 始终采用并返回 double

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

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

要求

函数 C 标头 C++ 标头
acosh, acoshf, acoshl <math.h> <cmath>
acosh <tgmath.h>

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

示例

// crt_acosh.c
// Compile by using: cl /W4 crt_acosh.c
// This program displays the hyperbolic cosine of pi / 4
// and the arc hyperbolic cosine of the result.

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

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

   x = cosh( pi / 4 );
   y = acosh( x );
   printf( "cosh( %f ) = %f\n", pi/4, x );
   printf( "acosh( %f ) = %f\n", x, y );
}
cosh( 0.785398 ) = 1.324609
acosh( 1.324609 ) = 0.785398

另请参阅

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