Home >>C Math Functions >C math cosh() function

C math cosh() function

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)

Parameters:

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;
}

Output:
Hyperbolic cosine of 0.500000 (in radians) = 1.127626
Hyperbolic cosine of -0.500000 (in radians) = 1.127626
Example-2

#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;
}

Output:
Hyperbolic cosine of 0.000000 (in radians) = 1.000000
Hyperbolic cosine of 1.500000 (in radians) = 2.352410