C++ Standard Library C++ STL Library

C++ <cmath> - acosh() Function



The C++ <cmath> acosh() function returns inverse hyperbolic cosine of a value. The inverse hyperbolic cosine of x is defined as:

acosh

Syntax

double acosh (double x);
float acosh (float x);
long double acosh (long double x);
double acosh (T x);           

Parameters

x Specify the value equal to or greater than 1.

Return Value

Returns the inverse hyperbolic cosine of a value.
If the x is less than 1, domain error occurs.

Example:

In the example below, acosh() function is used to find out the inverse hyperbolic cosine of a value.

#include <iostream>
#include <cmath>
using namespace std;
 
int main (){
  cout<<acosh(0)<<"\n";
  cout<<acosh(2)<<"\n";
  cout<<acosh(4)<<"\n";
  return 0;
}

The output of the above code will be:

-nan
1.31696
2.06344

❮ C++ <cmath> Library