Namespaces
Variants

acosh, acoshf, acoshl

From cppreference.net
< c ‎ | numeric ‎ | math
Common mathematical functions
Functions
Basic operations
(C99)
(C99)
(C99)
(C99) (C99) (C99) (C23)
Maximum/minimum operations
Exponential functions
Power functions
Trigonometric and hyperbolic functions
Nearest integer floating-point
(C99) (C99) (C99)
(C23) (C23) (C23) (C23)
Floating-point manipulation
Narrowing operations
(C23)
(C23)
(C23)
(C23)
(C23)
(C23)
Quantum and quantum exponent
Decimal re-encoding functions
Total order and payload functions
Classification
Error and gamma functions
(C99)
(C99)
(C99)
(C99)
Types
Macro constants
Special floating-point values
Arguments and return values
Error handling
Fast operation indicators
定义于头文件 <math.h>
float acoshf ( float arg ) ;
(1) (C99 起)
double acosh ( double arg ) ;
(2) (C99 起)
long double acoshl ( long double arg ) ;
(3) (C99 起)
定义于头文件 <tgmath.h>
#define acosh( arg )
(4) (C99 起)
1-3) 计算 arg 的反双曲余弦值。
4) 类型泛型宏:若参数类型为 long double ,则调用 acoshl 。否则,若参数具有整数类型或类型 double ,则调用 acosh 。否则调用 acoshf 。若参数为复数,则宏调用对应的复数函数( cacoshf cacosh cacoshl )。

目录

参数

arg - 表示双曲线扇形面积的浮点值

返回值

若未发生错误,则返回 arg 的反双曲余弦值( cosh -1
(arg)
arcosh(arg) ),其定义域为 [0, +∞]

如果发生定义域错误,则返回一个由实现定义的值(在支持 NaN 的情况下返回 NaN)。

错误处理

错误报告方式遵循 math_errhandling 中的规范。

如果参数小于 1 ,则会发生定义域错误。

如果实现支持 IEEE 浮点算术 (IEC 60559),

  • 若参数小于1,则引发 FE_INVALID 并返回 NaN。
  • 若参数为1,则返回 +0。
  • 若参数为 +∞,则返回 +∞。
  • 若参数为 NaN,则返回 NaN。

注释

尽管C标准将此函数命名为"反双曲余弦",但双曲函数的反函数实际上是面积函数。它们的参数是双曲扇形的面积,而非弧长。正确的名称应为"反双曲余弦函数"(POSIX使用此名称)或"面积双曲余弦函数"。

示例

#include <errno.h>
#include <fenv.h>
#include <float.h>
#include <math.h>
#include <stdio.h>
// #pragma STDC FENV_ACCESS ON
int main(void)
{
    printf("acosh(1) = %f\nacosh(10) = %f\n", acosh(1), acosh(10));
    printf("acosh(DBL_MAX) = %f\nacosh(Inf) = %f\n", acosh(DBL_MAX), acosh(INFINITY));
    // 错误处理
    errno = 0; feclearexcept(FE_ALL_EXCEPT);
    printf("acosh(0.5) = %f\n", acosh(0.5));
    if (errno == EDOM)
        perror("    errno == EDOM");
    if (fetestexcept(FE_INVALID))
        puts("    FE_INVALID raised");
}

可能的输出:

acosh(1) = 0.000000
acosh(10) = 2.993223
acosh(DBL_MAX) = 710.475860
acosh(Inf) = inf
acosh(0.5) = -nan
    errno == EDOM: Numerical argument out of domain
    FE_INVALID raised

参考文献

  • C23 标准 (ISO/IEC 9899:2024):
  • 7.12.5.1 acosh 函数 (p: TBD)
  • 7.27 泛型数学 <tgmath.h> (p: TBD)
  • F.10.2.1 acosh 函数 (p: TBD)
  • C17 标准 (ISO/IEC 9899:2018):
  • 7.12.5.1 acosh 函数 (p: 175)
  • 7.25 泛型数学 <tgmath.h> (p: 272-273)
  • F.10.2.1 acosh 函数 (p: 379)
  • C11 标准 (ISO/IEC 9899:2011):
  • 7.12.5.1 acosh 函数 (p: 240)
  • 7.25 泛型数学 <tgmath.h> (p: 373-375)
  • F.10.2.1 acosh 函数 (p: 520)
  • C99标准(ISO/IEC 9899:1999):
  • 7.12.5.1 acosh函数(第221页)
  • 7.22 泛型数学 <tgmath.h>(第335-337页)
  • F.9.2.1 acosh函数(第457页)

参考

(C99) (C99) (C99)
计算反双曲正弦( arsinh(x)
(函数)
(C99) (C99) (C99)
计算反双曲正切( artanh(x)
(函数)
(C99) (C99)
计算双曲余弦( cosh(x)
(函数)
(C99) (C99) (C99)
计算复反双曲余弦
(函数)
C++ 文档 关于 acosh

外部链接

魏斯坦, 埃里克·W. 《反双曲余弦》 摘自 MathWorld —— 一个 Wolfram 网络资源。