C++ cmath asinh, asinhf, asinhl function

The C++ cmath asinh, asinhf and asinhl function compute the arc hyperbolic sine of the given value.The declaration of the functions are given below.

1 float asinh(float x);
2 double asinh(double x);
3 long double asinh(long double x);
4 float asinhf(float x);
5 long double asinhl(long double x);

Parameters:
x – A floating point value.

Return type
floating point type -A arc sine hyperbolic of x.

The first function is called if the argument is float type.

The second function is called if the argument is double type.

Third function is called if the argument is long double type.

The 4th and 5th functions are discussed below.

Link : C++ atanh, atanhf and atanhl


Some points to note:

i) asinh(x) is same as sinh-1(x).

ii)If NAN is passed ‘nan’ is returned.And if ±INFINITY is passed ‘±inf'(±INFINITY) is returned.

iii)If integer or character literal is passed the double version i.e. the second funciton is called.

/*Passing floating point value*/
cout<< “asinh(23)=” << asinh( 23 ) <<

/*Passing 0*/
cout<< “asinh(0)=” << asinh( 0 ) << endl; 

/*Passing 1*/
cout<< “asinh(1)=” << asinh( 1 ) << endl;

/*Passing -ve value*/
cout<< “asinh(-12)=” << asinh( -12 ) << endl; 

/*Passing NAN*/
cout<< “asinh(NAN)=” << asinh( NAN ) << endl; 

/*Passing INFINITY*/
cout<< “asinh(-INFINITY)=” << asinh( -INFINITY ) ;

Output,

asinh(23)=3.82911
asinh(0)=-0
asinh(1)=0.881374
asinh(-12)=-3.17979
asinh(NAN)=nan
asinh(-INFINITY)=-inf



C++ asinhf

The 4th function asinhf is same as the 1st funciton ‘float asinh(float)‘. The ‘f‘ character stands for ‘float’ which signify the argument and return type of the function.

If any argument type other than the float type is passed to this function. The argument is converted to float type first and the arc hyperbolic sine is computed. The function will constraint the argument and the returned value type to the float type.

cout<< asinhf( (double)72 )
   << "\n" << typeid( asinhf( (double)72) ).name() ;

cout<< "\nasinhf(-INFINITY)=" << asinhf( -INFINITY ) ;

Output,

4.96986
f
asinhf(-INFINITY)=-inf


C++ asinhl

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

If any argument type other than the long double type is passed to this function. The argument is converted to long double type first and the arc hyperbolic sine is computed. The function will constraint the argument and the returned value type to the long double type.

cout<< asinhl( (double)23 )
   << "\n" << typeid( asinhl( (double)23) ).name() ;

cout<< "\nasinhl(-NAN)=" << asinhl( -NAN ) ;

Output,

3.82911
e
asinhl(-NAN)=nan




Leave a Reply

Your email address will not be published. Required fields are marked *