?
This document uses PHP Chinese website manual Release
在頭文件<math.h>中定義 | ||
---|---|---|
float coshf( float arg ); | (1) | (since C99) |
double cosh( double arg ); | (2) | |
long double coshl( long double arg ); | (3) | (since C99) |
Defined in header <tgmath.h> | ||
#define cosh( arg ) | (4) | (since C99) |
1-3)計(jì)算雙曲余弦arg
。
4)類型 - 通用宏:如果參數(shù)具有類型long double
,coshl
則被調(diào)用。否則,如果參數(shù)具有整數(shù)類型或類型double
,cosh
則調(diào)用該參數(shù)。否則,coshf
被調(diào)用。如果參數(shù)是復(fù)雜的,則宏調(diào)用相應(yīng)的復(fù)變函數(shù)(ccoshf
,ccosh
,ccoshl
)。
arg | - | 浮點(diǎn)值代表雙曲線角度 |
---|
如果沒(méi)有錯(cuò)誤發(fā)生,則arg
(cosh(arg)或。的雙曲余弦
| earg+e-arg |
|:----|
| 2 |
)返回。
如果范圍誤差由于發(fā)生溢出,+HUGE_VAL
,+HUGE_VALF
,或+HUGE_VALL
返回。
按照math_errhandling中的指定報(bào)告錯(cuò)誤。
如果實(shí)現(xiàn)支持IEEE浮點(diǎn)運(yùn)算(IEC 60559),
如果參數(shù)為±0,則返回1
如果參數(shù)是±∞,則返回+∞
如果參數(shù)是NaN,則返回NaN
對(duì)于IEEE兼容類型double
,如果| arg | > 710.5,然后cosh(arg)
溢出。
#include <stdio.h>#include <math.h>#include <errno.h>#include <fenv.h> #pragma STDC FENV_ACCESS ON int main(void){ printf("cosh(1) = %f\ncosh(-1)= %f\n", cosh(1), cosh(-1)); printf("log(sinh(1) + cosh(1))=%f\n", log(sinh(1)+cosh(1))); // special values printf("cosh(+0) = %f\ncosh(-0) = %f\n", cosh(0.0), cosh(-0.0)); // error handling errno=0; feclearexcept(FE_ALL_EXCEPT); printf("cosh(710.5) = %f\n", cosh(710.5)); if(errno == ERANGE) perror(" errno == ERANGE"); if(fetestexcept(FE_OVERFLOW)) puts(" FE_OVERFLOW raised");}
可能的輸出:
cosh(1) = 1.543081cosh(-1)= 1.543081log(sinh(1) + cosh(1))=1.000000cosh(+0) = 1.000000cosh(-0) = 1.000000cosh(710.5) = inf errno == ERANGE: Numerical result out of range FE_OVERFLOW raised
C11標(biāo)準(zhǔn)(ISO / IEC 9899:2011):
7.12.5.4 cosh函數(shù)(p:241)
7.25類型通用數(shù)學(xué)<tgmath.h>(p:373-375)
F.10.2.4 cosh函數(shù)(p:520)
C99標(biāo)準(zhǔn)(ISO / IEC 9899:1999):
7.12.5.4 cosh函數(shù)(p:222)
7.22類型通用數(shù)學(xué)<tgmath.h>(p:335-337)
F.9.2.4 cosh函數(shù)(p:457)
C89 / C90標(biāo)準(zhǔn)(ISO / IEC 9899:1990):
4.5.3.1 cosh函數(shù)