# std::tanh(std::complex) (3) - Linux Manuals

## std::tanh(std::complex): std::tanh(std::complex)

## NAME

std::tanh(std::complex) - std::tanh(std::complex)

## Synopsis

Defined in header <complex>

template< class T > *(since C++11)*

complex<T> tanh( const complex<T>& z );

Computes complex hyperbolic tangent of a complex value z.

## Parameters

z - complex value

## Return value

If no errors occur, complex hyperbolic tangent of z is returned

Error handling and special values

Errors are reported consistent with math_errhandling

If the implementation supports IEEE floating-point arithmetic,

* std::tanh(std::conj(z)) == std::conj(std::tanh(z))

* std::tanh(-z) == -std::tanh(z)

* If z is (+0,+0), the result is (+0,+0)

* If z is (x,+∞) (for any[1] finite x), the result is (NaN,NaN) and FE_INVALID is raised

* If z is (x,NaN) (for any[2] finite x), the result is (NaN,NaN) and FE_INVALID may be raised

* If z is (+∞,y) (for any finite positive y), the result is (1,+0)

* If z is (+∞,+∞), the result is (1,±0) (the sign of the imaginary part is unspecified)

* If z is (+∞,NaN), the result is (1,±0) (the sign of the imaginary part is unspecified)

* If z is (NaN,+0), the result is (NaN,+0)

* If z is (NaN,y) (for any non-zero y), the result is (NaN,NaN) and FE_INVALID may be raised

* If z is (NaN,NaN), the result is (NaN,NaN)

## Notes

Mathematical definition of hyperbolic tangent is tanh z =

ez

-e-z

ez

+e-z

Hyperbolic tangent is an analytical function on the complex plain and has no branch cuts. It is periodic with respect to the imaginary component, with period πi, and has poles of the first order along the imaginary line, at coordinates (0, π(1/2 + n)). However no common floating-point representation is able to represent π/2 exactly, thus there is no value of the argument for which a pole error occurs.

## Example

// Run this code

## Output:

**(1)** = 0.761594)

**(1)** = 1.557408)

## See also

sinh(std::complex) *(function template)*

cosh(std::complex) *(function template)*

atanh(std::complex) computes area hyperbolic tangent of a complex number

*(function template)*
*(C++11)*

tanh

tanhf

tanhl hyperbolic tangent

*(function)*

*(C++11)*
*(C++11)*

tanh(std::valarray) *(function template)*