C acosh() Function

Beginner
5 min read
Updated: Nov 2026
3 examples
math.h

Definition

In C, acosh() returns the inverse hyperbolic cosine of x. acosh(1) is 0. Larger inputs give a larger result.

You pass one double, and it must be 1 or greater. The result is a double that is 0 or greater. Include <math.h>.

Syntax

Pass a value of 1 or more. Start with this call.

C
acosh(1.0);
CallWhat it does
acosh(1.0)Returns 0, the smallest result this function gives.

Include <math.h>. On GCC, link with -lm.

Library declarations
C
double acosh(double x);
float acoshf(float x);
long double acoshl(long double x);

Parameters

ParameterDescription
xRequired. A double that is 1 or greater.

Return Value

Return ValueDescription
Inverse hyperbolic cosineA double that is 0 or greater.
NaNReturned when x is less than 1.

C Examples

Example 1 — Common acosh Values

Print results for the endpoint 1 and a larger input.

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

int main(void) {
    printf("acosh(1) = %.5f\n", acosh(1.0));
    printf("acosh(2) = %.5f\n", acosh(2.0));

    return 0;
}

How It Works

  1. Include math.h. Declares acosh; link with -lm on GCC.
  2. Endpoint. acosh(1) is 0 because cosh(0) = 1.
  3. Larger x. acosh(2) ≈ 1.31696.
  4. Always ≥ 0. The principal value is non-negative.

Example 2 — Verify with cosh

Round-trip a value: acosh then cosh should recover the original x.

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

int main(void) {
    double x = 2.5;
    double t = acosh(x);

    printf("acosh(%.1f) = %.5f\n", x, t);
    printf("cosh(t)     = %.5f\n", cosh(t));

    return 0;
}

How It Works

  1. Start with x ≥ 1. 2.5 is in the domain.
  2. Invert with acosh. You get the hyperbolic angle t.
  3. Apply cosh. cosh(t) returns to 2.5.
  4. Use as a check. Great for testing and understanding the inverse pair.

Example 3 — Match the Log Formula

Compare the library result with ln(x + sqrt(x*x - 1)) using log and sqrt.

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

int main(void) {
    double x = 2.0;
    double lib = acosh(x);
    double hand = log(x + sqrt(x * x - 1.0));

    printf("acosh(2)     = %.10f\n", lib);
    printf("ln formula   = %.10f\n", hand);

    return 0;
}

How It Works

  1. Library call. acosh(2) uses a carefully coded implementation.
  2. Hand formula. log + sqrt express the same math identity.
  3. They agree. For this value the digits match closely.
  4. Prefer acosh. The dedicated function is clearer and usually more robust near the domain edge.

Frequently Asked Questions

acosh() returns the inverse hyperbolic cosine of x. acosh(1) is 0.
x is required. It is a double that must be 1 or greater.
A double that is 0 or greater. If x is less than 1, the result is NaN.
Include <math.h>. On GCC, link with -lm.
No. Values below 1 are outside the domain, and the result is NaN.

Next: asin()

Compute the inverse sine and get an angle in radians.

asin() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

9 people found this page helpful