C 语言 cosh() 函数用于计算一个数的双曲余弦值:cosh(x) = (e^x + e^-x) / 2。
原型
double cosh(double x);参数
x- 要求双曲余弦的值(double)。
示例
#include <stdio.h>
#include <math.h>
int main() {
printf("cosh(1) = %.4f\n", cosh(1));
return 0;
}输出:
cosh(1) = 1.5431注意事项
使用 math.h 的函数时,多数编译器需要链接数学库(编译选项 -lm)。