C++ Standard Library C++ STL Library

C++ <complex> - acosh() Function

The C++ <complex> acosh() function returns the complex inverse hyperbolic cosine of a complex number z. It is a function on complex plane, and has one branch cut, extending left from 1 along the real axis to -∞, continuous from above.

Mathematically, it can be expressed as:

complex acosh


template<class T> complex<T> acosh (const complex<T>& z);          


z Specify the complex number.

Return Value

Returns the complex inverse hyperbolic cosine of z.


The example below shows the usage of <complex> acosh() function.

#include <iostream>
#include <complex>
using namespace std;
int main (){
  complex<double> z1 (2, 2);
  complex<double> z2 (2, 0);
  complex<double> z3 (0, 2);

  //calculate the complex inverse hyperbolic cosine
  cout<<"acosh(z1): "<<acosh(z1)<<"\n";
  cout<<"acosh(z2): "<<acosh(z2)<<"\n";
  cout<<"acosh(z3): "<<acosh(z3)<<"\n";

  return 0;

The output of the above code will be:

acosh(z1): (1.73432,0.816547)
acosh(z2): (1.31696,0)
acosh(z3): (1.44364,1.5708)

❮ C++ <complex> Library