Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

atanh

#include <boost/math/special_functions/atanh.hpp>
template<class T>
calculated-result-type atanh(const T x);

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

Computes the reciprocal of the hyperbolic tangent function, at x.

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 std::numeric_limits<T>::epsilon().

If x is in the range ]+1-ε;+1], then the result of overflow_error is returned, with ε denoting std::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.

Accuracy

Generally accuracy is to within 1 or 2 machine epsilon across all supported platforms.

Testing

This function is tested using a combination of random test values designed to give full function coverage computed at high precision using the "naive" formula:

along with a selection of sanity check values computed using functions.wolfram.com to at least 50 decimal digits.

Implementation

For sufficiently small x we can use the approximation:

Otherwise the primary definition:

or its equivalent form:

is used.


PrevUpHomeNext