C++ complex atanh

The C++ complex ‘atanh’ function compute the arc hyperbolic tangent of the complex number.The declaration of the function is given below.

template<class T> complex<T> atanh(const complex<T>& x);

x – A complex number whose arc hyperbolic tangent is to be computed.

Return type
complex<T> -The complex arc hyperbolic tangent of ‘x’.

Some points to note:

i)The arc hyperbolic tangent is computed using the formula.

C++ complex atanh

ii)The atanh function compute the complex arc hyperbolic tangent of x,with branch cuts outside the interval [−1,+1] along the real axis.

iii)The ‘atanh’ returns a complex whose value is in the range of a strip mathematically unbounded along the real axis and in the interval [−iπ/2 , + iπ/2] along the imaginary axis.

Code example

complex< double > c1(90.40 , 41.90);

cout<< atanh( c1 ) ;




To find the atanh(90.40 , 41.90) we use the equation given below ,

(1/2) *[ log ( 1+ (90.40 + i41.90) )/( 1- (90.40 + i41.90) ) ]

Reducing the equation to complex number form we get the resultant complex value as “113.9+i49.023”.

Link :C++ cmath log function

*Side Note

Some cases of atanh function,

  ➥atanh( conj(z) )=conj( atanh(z) ).

  ➥atanh(+0 + i0) returns +0+i0.

  ➥atanh(+0 + iNaN) returns +0+iNaN.

  ➥atanh(+1 + i0) returns +∞+i0 and raises the “divide-by-zero” floating-point exception.

  ➥atanh(x + i∞) returns +0+iπ/2, for finite positive-signed ‘x’.

  ➥atanh(x + iNaN) returns NaN+iNaN and optionally raises the “invalid” floating-point exception, for nonzero finite x.

  ➥atanh(+∞ +iy) returns +0+iπ/2, for finite positive-signed y.

  ➥atanh(+∞ + i∞) returns +0 + π/2

  ➥atanh(+∞ + iNaN) returns +0+iNaN.

  ➥atanh(NaN + iy) returns NaN+iNaN and optionally raises the “invalid” floating-point exception, for finite y.

  ➥atanh(NaN + i∞) returns ±0+iπ/2 (where the sign of the real part of the result is unspecified).

  ➥atanh(NaN + iNaN) returns NaN+iNaN.

Link :C++ complex conj