Easy Tutorial
❮ C Function Isxdigit C Examples Multiplication Table ❯

C Library Function - cosh()

C Standard Library - <math.h>

Description

The C library function double cosh(double x) returns the hyperbolic cosine of x.

Declaration

Here is the declaration for the cosh() function.

double cosh(double x)

Parameters

Return Value

This function returns the hyperbolic cosine of x.

Example

The following example demonstrates the use of the cosh() function.

#include <stdio.h>
#include <math.h>

int main ()
{
   double x;

   x = 0.5;
   printf("The hyperbolic cosine of %lf is %lf\n", x, cosh(x));

   x = 1.0;
   printf("The hyperbolic cosine of %lf is %lf\n", x, cosh(x));

   x = 1.5;
   printf("The hyperbolic cosine of %lf is %lf\n", x, cosh(x));

   return(0);
}

Let's compile and run the above program, which will produce the following result:

The hyperbolic cosine of 0.500000 is 1.127626
The hyperbolic cosine of 1.000000 is 1.543081
The hyperbolic cosine of 1.500000 is 2.352410

C Standard Library - <math.h>

❮ C Function Isxdigit C Examples Multiplication Table ❯