Latest web development tutorials

C 庫函數– cosh()

C 標準庫 - <math.h> C標準庫- <math.h>

描述

C庫函數double cosh(double x)返回x的雙曲餘弦。

聲明

下面是cosh() 函數的聲明。

double cosh(double x)

參數

  • x --浮點值。

返回值

該函數返回x 的雙曲餘弦。

實例

下面的實例演示了cosh() 函數的用法。

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

int main ()
{
   double x;

   x = 0.5;
   printf("%lf 的双曲余弦是 %lf\n", x, cosh(x));

   x = 1.0;
   printf("%lf 的双曲余弦是 %lf\n", x, cosh(x));

   x = 1.5;
   printf("%lf 的双曲余弦是 %lf\n", x, cosh(x));

   return(0);
}

讓我們編譯並運行上面的程序,這將產生以下結果:

0.500000 的双曲余弦是 1.127626
1.000000 的双曲余弦是 1.543081
1.500000 的双曲余弦是 2.352410

C 標準庫 - <math.h> C標準庫- <math.h>