Latest web development tutorials

C library functions - cosh ()

C standard library - <math.h> C standard library - <math.h>

description

C library functionsdouble cosh (double x) Returns the hyperbolic cosine of x.

statement

Here is the cosh () function's declaration.

double cosh(double x)

parameter

  • x - floating-point value.

return value

This function returns the hyperbolic cosine of x.

Examples

The following example demonstrates the cosh () function is used.

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

int main ()
{
   double x;

   x = 0.5;
   printf("%lf 的双曲余弦是 %lf\n", x, cosh(x));

   x = 1.0;
   printf("%lf 的双曲余弦是 %lf\n", x, cosh(x));

   x = 1.5;
   printf("%lf 的双曲余弦是 %lf\n", x, cosh(x));

   return(0);
}

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

0.500000 的双曲余弦是 1.127626
1.000000 的双曲余弦是 1.543081
1.500000 的双曲余弦是 2.352410

C standard library - <math.h> C standard library - <math.h>