atanh()
Anonymous contributor
Published Dec 3, 2022
Contribute to Docs
The atanh()
function returns the inverse hyperbolic tangent of a number in radians.
Syntax
atanh(x)
This function requires an x
parameter x
in the range of [-1, 1]. Its data type can be double
, float
, or long double
.
- If the value of
x
is outside of its range, a range error occurs. - If
x
is±1
, a pole error occurs.
For C++ implementations that support floating-point math:
- If
x
is±0
, it is returned unmodified. - If
x
is±1
,±∞
is returned andFE_DIVBYZERO
is raised. - If
|x|
> 1,NaN
is returned andFE_INVALID
is raised. - If
x
isNaN
,NaN
is returned.
Example
The following example uses atanh()
to return the result in radians:
#include <iostream>#include <cmath>#define PI 3.141592654using namespace std;int main() {double x = 0.32, result;result = atanh(x);cout << "atanh(x) = " << result << " radian" << endl;// result in degreescout << "atanh(x) = " << result*180/PI << " degree" << endl;return 0;}
This example produces the following output:
atanh(x) = 0.331647 radianatanh(x) = 19.002 degree
Codebyte Example
The following example is runnable:
All contributors
- Anonymous contributor
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn C++ on Codecademy
- Career path
Computer Science
Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!Includes 6 CoursesWith Professional CertificationBeginner Friendly75 hours - Free course
Learn C++
Learn C++ — a versatile programming language that’s important for developing software, games, databases, and more.Beginner Friendly11 hours