English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

C Language Basic Tutorial

C Language Flow Control

C Language Functions

C Language Arrays

C Language Pointers

C Language Strings

C Language Structure

C Language File

C Others

C Language Reference Manual

C library function cosh() usage and example

C Standard Library <math.h>

The cosh() function calculates the hyperbolic cosine value of a number.

Cosh() function prototype

double cosh(double x)

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

The cosh() function inmath.hDefined in the header file.

To find cosh() for long double or float, you can also use the following prototypes.

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

Example: C cosh() function usage

#include <stdio.h>
#include <math.h>
int main()
{
    double x, result;
    x = 0.8;
    result = cosh(x);
    printf("%lf hyperbolic cosine (in radians) = %lf\n", x, result);
    x = -0.8;
    result = cosh(x);
    printf("%lf hyperbolic cosine (in radians) = %lf\n", x, result);
    x = 0;
    result = cosh(x);
    printf("%lf hyperbolic cosine (in radians) = %lf\n", x, result);
    x = 1.5;
    result = cosh(x);
    printf("%lf hyperbolic cosine (in radians) = %lf\n", x, result);
    return 0;
}

Output Result

0.8Hyperbolic cosine (in radians) of 00000 = 1.337435
-0.8Hyperbolic cosine (in radians) of 00000 = 1.337435
Hyperbolic cosine (in radians) of 0.000000 = 1.000000
1.5Hyperbolic cosine (in radians) of 00000 = 2.352410

C Standard Library <math.h>