# C programming acosh , acoshf and acoshl function

In C programming the <math.h> acosh , acoshf and acoshl compute the arc hyperbolic cosine of the argument.The declaration of the functions are given below.

1 float acosh(float x);
2 double acosh(double x);
3 long double acosh(long double x);
4 float acoshf(float x);
5 long double acoshl(long double x);

Parameters:
x -The value whose arc hyperbolic cosine is to be computed.

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

All the functions are the same,they compute the arc hyperbolic cosine of ‘x’.The 1st,2nd and the 3rd function have the same name i.e. ‘acosh’.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) acosh(x) is same as cosh-1(x).

ii)The returned value is always +ve.

iii)If the argument is less than 1 a domain error occurs-a ‘NaN’ is returned.

iv)If the arguments is integer or character literal the double version is called.

Code example

double d=12 , x1=0 ;

float f=12 ;

long double ld=12 ;

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

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

Output in Visual Studio,

3.176313
3.176313
3.176313
nan
inf

Passing ‘0’-the 4th ouput- returns ‘nan’ and passing ‘INFINITY’ returns ‘inf’ which stands for ‘infinity’.

#### acoshf

The ‘acoshf‘ 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 ‘acoshf‘ stands for float and it signify the parameter and return type of the function.

Code example

float x= 1000 ;

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

Output,

7.600902
7.600902

#### acoshl

The ‘acoshl‘ 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 ‘acoshl‘ stands for long double and it signify the parameter and return type of the function.

Code example

long double x= 1000 ;

printf(“%Lf”, acosh( x ) ); //Calls the 3rd version
printf(“\n%Lf”, acoshl( 100 ) ); //Calls the 5th version

Output,

7.600902
7.600902