C cosh()

cosh() Function Prototype

double cosh(double x)

The cosh() function takes a single argument (angle in radians) and returns the hyperbolic cosine of that angle as type double.


The cosh() function is defined in math.h header file.

In order to find the cosh() of long double or float numbers, you can use the following prototype.

long double coshl( long double arg);
float coshf( float arg);

Example: C cosh()

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

    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.500000 (in radians) = 1.127626
Hyperbolic cosine of -0.500000 (in radians) = 1.127626
Hyperbolic cosine of 0.000000 (in radians) = 1.000000
Hyperbolic cosine of 1.500000 (in radians) = 2.352410
Did you find this article helpful?

Our premium learning platform, created with over a decade of experience and thousands of feedbacks.

Learn and improve your coding skills like never before.

Try Programiz PRO
  • Interactive Courses
  • Certificates
  • AI Help
  • 2000+ Challenges