RAD Studio |  |

cosh, coshl

Header File

math.h

Category

Math Routines

Prototype

double cosh(double x);

long double coshl(long double x);

Description

Calculates the hyperbolic cosine of a value.

cosh computes the hyperbolic cosine:

coshl is the long double version; it takes a long double argument and returns a long double result.

Return Value

cosh returns the hyperbolic cosine of the argument.

When the correct value would create an overflow, these functions return the value HUGE_VAL (cosh) or _LHUGE_VAL (coshl) with the appropriate sign, and the global variable errno is set to ERANGE. Error handling for these functions can be modified through the functions _matherr and _matherrl.

Example

Copy Code

    #include <stdio.h>
    #include <math.h>
    int main(void)
    {
       double result;
       double x = 0.5;
       result = cosh(x);
       printf("The hyperbolic cosine of %lf is %lf\n", x, result);
       return 0;
    }

Portability

| POSIX | Win32 | ANSI C | ANSI C++
cosh | + | + | + | +
coshl |  | + | + | +

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!