C
数值 | Numerics

sinh

sinh, sinhf, sinhl

在头文件中定义
float sinhf(float arg);(1)(自C99以来)
double sinh(double arg);(2)
long double sinhl(long double arg);(3)(自C99以来)
在头文件<tgmath.h>中定义
#define sinh(生气)(4)(自C99以来)

1-3)计算双曲正弦arg

4)类型 - 通用宏:如果参数具有类型long doublesinhl则被调用。否则,如果参数具有整数类型或类型doublesinh则调用该参数。否则,sinhf被调用。如果参数是复杂的,则宏调用相应的复变函数(csinhfcsinhcsinhl)。

参数

arg-浮点值代表双曲线角度

返回值

如果没有错误发生,arg(sinh(arg)或者双曲正弦

| earg-e-arg |

|:----|

| 2 |

)返回。

如果范围误差由于发生溢出,±HUGE_VAL±HUGE_VALF,或±HUGE_VALL返回。

如果由于下溢而发生范围错误,则返回正确的结果(舍入后)。

错误处理

按照math_errhandling中的指定报告错误。

如果实现支持IEEE浮点运算(IEC 60559),

  • 如果参数为±0或±∞,则不加修改地返回

注意

POSIX指定在发生下溢时,arg未经修改就返回,如果不支持,则返回不大于DBL_MIN,FLT_MIN和LDBL_MIN的实现定义值。

#include <stdio.h> #include <math.h> #include <errno.h> #include <fenv.h> #pragma STDC FENV_ACCESS ON int main(void) { printf("sinh(1) = %f\nsinh(-1)=%f\n", sinh(1), sinh(-1) printf("log(sinh(1) + cosh(1))=%f\n", log(sinh(1)+cosh(1)) // special values printf("sinh(+0) = %f\nsinh(-0)=%f\n", sinh(0.0), sinh(-0.0) // error handling errno=0; feclearexcept(FE_ALL_EXCEPT printf("sinh(710.5) = %f\n", sinh(710.5) if(errno == ERANGE) perror(" errno == ERANGE" if(fetestexcept(FE_OVERFLOW)) puts(" FE_OVERFLOW raised" }

可能的输出:

sinh(1) = 1.175201 sinh(-1)=-1.175201 log(sinh(1) + cosh(1))=1.000000 sinh(+0) = 0.000000 sinh(-0)=-0.000000 sinh(710.5) = inf errno == ERANGE: Numerical result out of range FE_OVERFLOW raised

参考

  • C11标准(ISO/IEC 9899:2011):

另请参阅

coshcoshfcoshl(C99)(C99)计算双曲余弦(ch(x))(函数)
tanhtanhftanhl(C99)(C99)计算双曲正切(函数)
asinhasinhfasinhl(C99)(C99)(C99)计算反双曲正弦(arsinh(x))(函数)
csinhcsinhfcsinhl(C99)(C99)(C99)计算复数双曲正弦函数(函数)

| C ++文档sinh |