...one of the most highly
regarded and expertly designed C++ library projects in the
world.

— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards

#include <boost/math/special_functions/atanh.hpp>

template<class T>calculated-result-typeatanh(const T x); template<class T, class Policy>calculated-result-typeatanh(const T x, const Policy&);

Computes the reciprocal of the hyperbolic tangent function, at x. Taylor series are used at the origin to ensure accuracy.

The final Policy argument is optional and can be used to control the behaviour of the function: how it handles errors, what level of precision to use etc. Refer to the policy documentation for more details.

If x is in the range `]-∞;-1[`

or in the range `]+1;+∞[`

then returns the result of domain_error.

If x is in the range `[-1;-1+ε[`

, then the result of -overflow_error is returned, with ε
denoting
numeric_limits<T>::epsilon().

If x is in the range `]+1-ε;+1]`

, then the result of overflow_error is returned, with ε
denoting
numeric_limits<T>::epsilon().

The return type of this function is computed using the *result
type calculation rules*: the return type is `double`

when T is an integer type, and T
otherwise.