# C++ cmath atanh , atanhf , atanhl function

The C++ cmath atanh,atanhf and atanhl function compute the arc hyperbolic tangent of the given value.The declaration of the functions are given below.

1 float atanh(float x);
2 double atanh(double x)
3 long double atanh(long double x);
4 float atanhf(float x);
5 long double atanhl(long double x);

Parameters:
x -A floating point value.

Return type
floating point type -Returns the arc hyperbolic tangent of the given value.

Some points to note:
i) atanh(x) is same as tanh-1(x).

ii)If the argument is not in the interval [-1,+1] domain error occurs-a ‘nan‘ is returned.

iii)If the argument equals +1 or -1 range error may occur-an ‘±inf‘ is returned.

Code example

/*Passing floating point value in the interval {-1,1}*/
cout<< “atanh(0.87)=” << atanh( 0.87 ) << endl ;

/*Passing arguments not in the interval [-1,+1]*/
cout<< “atanh(2)=” << atanh( 2 ) << endl ; //domain error occurs

/*Passing -1 or +1*/
cout<< “atanh(-1)=” << atanh( -1 ) << endl ; //a range error may occur

Output

atanh(0.87) = 1.33308
atanh(2) = nan
atanh(-1) = -inf

#### atanhf and atanhl

*Note

i)The 4th version atanhf is same as the 1st version float atanh(float).The ‘f‘ character stands for ‘float’ which signify the argument and return type of the function.

ii)The 5th version atanhl is same as the 3rd version long double atanh(long double).The ‘l‘ character stands for ‘long double’ which signify the argument and return type of the function.

Code example

#include <typeinfo>

/*atanhf */
cout<< “*atanhf\n”;
float f=2;
cout<< typeid( atanhf(2) ).name() << endl /*identify type of atanhf retunred value */
<< typeid( atanh(f) ).name() << endl; /*identify type of atanh(float) returned value */

/*atanhl*/
cout<< “*atanhl\n”;
long double ld=2;
cout<< typeid( atanhl(2) ).name() << endl /*indentify type of atanhl returned value */
<< typeid( atanh(ld) ).name() << endl; /*identify type of atanh(long double) returned value*/

Output

*atanhf
f
f
*atanhl
e (means ‘long double’)
e (means ‘long double’)