# C++ cmath sinh function

The C++ <cmath> sinh,sinhf and sinhl function compute the hyperbolic sine of the given value.The declaration of the functions are given below.

1 float sinh(float x);
2 double sinh(double x);
3 long double sinh(long double x);
4 float sinhf(float x);
5 long double sinhl(long double x);

Parameters:
x – A floating point value.

Return type
floating point -Hyperbolic sine of x.

Some points to note:

i) If the argument is very large Range error occur.In MINGW 6.1 and VS 2015 when x>710 ,Range error seems to occur.

ii)If NAN is passed ‘nan’ is returned.

iii)If INFINITY is passed ‘inf’ is returned.

Code example

/*passing 710 */
cout<< “sinh(710)=” << sinh(710) << endl

/*passing 711 */
cout<< “sinh(711)=” << sinh(711) << endl

/*passing NAN */
cout<< “sinh(NAN)=” << sinh(NAN) << endl

/*passing INFINITY */
cout<< “sinh(INFINITY)=” << sinh(INFINITY) << endl

Output

sinh(710) = 1.117e+308
sinh(711) = inf
sinh(NAN) = nan
sinh(INFINITY) = inf

#### sinhf and sinhl

*Note

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

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

Code example

#include <typeinfo>

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

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

Output

*sinhf
f
f
*sinhl
e (means ‘long double’)
e (means ‘long double’)