Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / C

acosh — inverse hyperbolic cosine

The acosh function from <math.h> computes the nonnegative inverse hyperbolic cosine. It takes and returns double; an argument below 1 causes a domain error.

Version: C23; repository compiler flag, production runtime not attested

Syntax

#include <math.h>
double acosh(double x);

acosh(x) finds the nonnegative value y satisfying the mathematical relation cosh(y) = x. It is not the reciprocal 1 / cosh(x). Its declaration in <math.h> takes and returns double.

The real domain is x >= 1, and the result lies in [0, +∞]. For x < 1, a domain error occurs. Do not portably assume a particular result for that call.

With IEC 60559 support conforming to Annex F, acosh(1) returns +0 and acosh(+∞) returns +∞; for x < 1, it returns NaN and raises the invalid exception.

Examples

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

int main(void)
{
    double x = 1.0;
    double y = acosh(x);
    printf("acosh(1) == 0: %d\n", y == 0.0);
    return 0;
}

Result

acosh(1) == 0: 1

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources