当前位置: C语言 -- 标准库 -- <math.h> -- cosh

cosh函数


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

描述:

该函数计算参数x的双曲余弦值。

如果参数x的值太大,将发生范围错误(range error)

双曲余弦函数的数学定义如下所示:

cosh( x ) = e x + e - x 2


参数:
double x

参数为一个double类型的浮点数。


返回值:

函数返回参数x的双曲余弦值。


范例:
1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
/*函数cosh范例*/

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

int main(void)
{
    double x = 2.0;
    double y;

    y = cosh(x);
    printf("The hyperbolic cosine of %.6f is %.6f.\n", x, y);

    return 0;
}

输出:

The hyperbolic cosine of 2.000000 is 3.762196.


相关内容:
coshf float类型的双曲余弦函数。
coshl long double类型的双曲余弦函数。