atanh() function

atanh(): This function is available in the file math.h

The atanh() function takes a single argument and returns the arc hyperbolic tangent of that value in radians.

The atanh() function takes a single mandatory argument in the range [-1, 1].

Note: If the value is greater than 1 or less than -1, a domain error occurs.

Parameters: One parameter is required for this function.

__X: The value whose inverse hyperbolic tangent value is to be determined.

Syntax:

atanh(__X)

Example 1: In radians

Input:  x = 0.45
Output: 0.4847

Example 2: In degrees

Input:  x = 0.45
Output: 27.7854

Approach 1: In radians

C++

#include <bits/stdc++.h>
using namespace std;

int main()
{
    double x = 0.45;

    cout << atanh(x);

    return 0;
}

Approach 2: In degrees

C++

#include <bits/stdc++.h>
using namespace std;

int main()
{
    double x = 0.45;

    double radian = atanh(x);
    double degrees = radian * 180 / 3.14;

    cout << degrees << "\n";

    return 0;
}


No comments:

Post a Comment