C programming asinh , asinhf and asinhl function


In C programming the <math.h> asinh,asinhf and asinhl compute the arc hyperbolic sine of the argument.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 -The value whose arc hyperbolic sine is to be computed.

Return type
floating point value -The arc hyperbolic sine of ‘x’.

All the functions are the same,they compute the arc hyperbolic sine of ‘x’.The 1st,2nd and the 3rd function have the same name i.e.’asinh’.The 4th and 5th function have different names.What does having a different names mean is explained in detail below.

Some points to note:
i) asinh(x) is same as sinh-1(x).

ii)If NAN is passed ‘nan'(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.

Link: C nan:myths and conception

Code example

double d=1200 , x1=0 ;

float f=1200 ;

long double ld=1200 ;

printf(“%lf”, asinh( d ) ) ; //calls the 2nd version
printf(“\n%f”, asinh( f ) ) ; //calls the 1st version
printf(“\n%Lf”, asinh( ld ) ) ;//calls the 3rd version

printf(“\n%lf”, asinh( x1 ) ) ;
printf(“\n%lf”, asinh(INFINITY) ) ;

Output in Visual Studio,

7.783224
7.783224
7.783224
0.000000
inf

The 5th output is ‘inf’ and it stands for infinity.






asinhf

The ‘asinhf‘ function is same as the 1st function.This means the parameter and return type of the function is float type.The ‘f‘ character appended to ‘asinhf‘ stands for float and it signify the parameter and return type of the function.

Code example

float x= 1000 ;

printf(“%f”, asinh( x ) ); //Calls the 1st version
printf(“\n%f”, asinhf( 1000 ) ); Calls the 4th version

Output,

7.600903
7.600903


asinhl

The ‘asinhl‘ function is same as the 3rd function.This means the parameter and return type of the function is long double type.The ‘l‘ character appended to ‘asinhl‘ stands for long double and it signify the parameter and return type of the function.

Code example

long double x= 991 ;

printf(“%Lf”, asinh( x ) ); //Calls the 3rd version
printf(“\n%Lf”, asinhl( 991 ) ); //Calls the 5th version

Output,

7.591862
7.591862