cosh() — Calculate Hyperbolic Cosine

Format

#include <math.h>
double cosh(double x);

Language Level

ANSI

Threadsafe

Yes

Description

The cosh() function calculates the hyperbolic cosine of x. The value x is expressed in radians.

Return Value

The cosh() function returns the hyperbolic cosine of x. If the result is too large, cosh() returns the value HUGE_VAL and sets errno to ERANGE.

Example

This example calculates y to be the hyperbolic cosine of x.
#include <math.h>
#include <stdio.h>
 
int main(void)
{
   double x,y;
 
   x = 7.2;
   y = cosh(x);
 
   printf("cosh( %lf ) = %lf\n", x, y);
}
 
/*********************  Output should be similar to:  *******************
 
cosh( 7.200000 ) = 669.715755
*/

Related Information