Related Tags

functions
c++
communitycreator

# What is the atanh() function in C++?

Onyejiaku Theophilus Chidalu

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

### Overview

In C++, the atanh() function is used to return the arc hyperbolic tangent in radians of a number argument that is passed to it.

Note: The arc hyperbolic tangent is also referred to as the inverse hyperbolic tangent.

### Formula

$atanh(x)=tanh^{-1}x$

### Syntax

double atanh(double x);
float atanh(float x);
long double atanh(long double x);

### Parameter(s)

• x: The atanh() function takes a single argument, x, as the only and mandatory parameter value.

### Return value

The atanh() function returns the arc hyperbolic tangent of the argument x that is passed to it.

Argument(x) Return value
x = 1 infinite value (∞)
x = -1 negative infinite value (-∞)
x < -1 or x > 1 NaN value
-1 < x < 1 finite value

### Code example

#include <iostream>
#include <cmath>
using namespace std;
int main()
{
// creating variables
int x =1 ;
double result;
// immplementing the atanh() function
result = atanh(x);
cout << "atanh(10) = " << result << " radian" << endl;
return 0;
}
Implementing the "atanh()" function.

### Code explanation

• Line 10: We create the variables x and result.
• Line 14: We implement the atanh() function on the value of the x variable and assign the output to the result variable.
• Line 15: We print the result variable.

RELATED TAGS

functions
c++
communitycreator

CONTRIBUTOR

Onyejiaku Theophilus Chidalu