Share via


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 ,而結果會是無訊息的 NaN。 若 x 為無訊息 NaN、不確定或無限大,則會傳回相同的值。

輸入 SEH 例外狀況 _matherr 例外
± QNaN、IND、INF none none
x< 1 none none

備註

當您使用 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

另請參閱

數學和浮點支援
asinh, asinhf, asinhl
atanh, atanhf, atanhl
cosh, coshf, coshl
sinh, sinhf, sinhl
tanh, tanhf, tanhl