Home >>C Math Functions >C math cosh() function
The C math double cosh(double x) function is used to return the hypebolic cosine of any given number x. It takes a single argument as angle in radians and returns the hyperbolic cosine of that angle as type double. This function is defined in math.h header file.
Syntax:double cosh(double x)
x − It is the floating point value.
Here is an example of cosh() function:
#include <stdio.h>
#include <math.h>
int main ()
{
double x, result;
x = 0.5;
result = cosh(x);
printf("Hyperbolic cosine of %lf (in radians) = %lf\n", x, result);
x = -0.5;
result = cosh(x);
printf("Hyperbolic cosine of %lf (in radians) = %lf\n", x, result);
return 0;
}
#include <stdio.h>
#include <math.h>
int main ()
{
double x, result;
x = 0;
result = cosh(x);
printf("Hyperbolic cosine of %lf (in radians) = %lf\n", x, result);
x = 1.5;
result = cosh(x);
printf("Hyperbolic cosine of %lf (in radians) = %lf\n", x, result);
return 0;
}