C++ cmath asinh,asinhf and 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.

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 -the second version- is called.

Code example

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

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

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

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

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

/*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


 


asinhf and asinhl

*Note

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

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

Code example

#include <typeinfo>

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

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

Output

*asinhf
f
f
*asinhl
e (means ‘long double’)
e (means ‘long double’)