sinh, sinhf, sinhl
来自 cppreference.cn
定义于头文件 <math.h> |
||
float sinhf( float arg ); |
(1) | (自 C99 起) |
double sinh( double arg ); |
(2) | |
long double sinhl( long double arg ); |
(3) | (自 C99 起) |
定义于头文件 <tgmath.h> |
||
#define sinh( arg ) |
(4) | (自 C99 起) |
1-3) 计算 arg 的双曲正弦值。
4) 类型泛型宏:如果参数类型为 long double,则调用
sinhl
。否则,如果参数具有整数类型或类型 double,则调用 sinh
。否则,调用 sinhf
。如果参数是复数,则宏调用相应的复数函数 (csinhf、csinh、csinhl)。目录 |
[编辑] 参数
arg | - | 表示双曲角的浮点值 |
[编辑] 返回值
如果没有错误发生,则返回 arg 的双曲正弦值 (sinh(arg),或earg -e-arg |
2 |
如果由于溢出而发生范围错误,则返回 ±HUGE_VAL、±HUGE_VALF
或 ±HUGE_VALL
。
如果由于下溢而发生范围错误,则返回正确的结果(舍入后)。
[编辑] 错误处理
错误报告方式在 math_errhandling
中指定。
如果实现支持 IEEE 浮点算术 (IEC 60559),
- 如果参数是 ±0 或 ±∞,则不修改地返回,
- 如果参数是 NaN,则返回 NaN。
[编辑] 注释
POSIX 规定,在发生下溢的情况下,arg 将不修改地返回;如果不支持此操作,则返回不大于 DBL_MIN、FLT_MIN 和 LDBL_MIN 的实现定义值。
[编辑] 示例
运行此代码
#include <errno.h> #include <fenv.h> #include <math.h> #include <stdio.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
[编辑] 参考文献
- C23 标准 (ISO/IEC 9899:2024)
- 7.12.5.5 sinh 函数 (p: 待定)
- 7.25 类型泛型数学 <tgmath.h> (p: 待定)
- F.10.2.5 sinh 函数 (p: 待定)
- C17 标准 (ISO/IEC 9899:2018)
- 7.12.5.5 sinh 函数 (p: 176)
- 7.25 类型泛型数学 <tgmath.h> (p: 272-273)
- F.10.2.5 sinh 函数 (p: 379)
- C11 标准 (ISO/IEC 9899:2011)
- 7.12.5.5 sinh 函数 (p: 241-242)
- 7.25 类型泛型数学 <tgmath.h> (p: 373-375)
- F.10.2.5 sinh 函数 (p: 520)
- C99 标准 (ISO/IEC 9899:1999)
- 7.12.5.5 sinh 函数 (p: 222)
- 7.22 类型泛型数学 <tgmath.h> (p: 335-337)
- F.9.2.5 sinh 函数 (p: 457)
- C89/C90 标准 (ISO/IEC 9899:1990)
- 4.5.3.2 sinh 函数
[编辑] 参见
(C99)(C99) |
计算双曲余弦 (cosh(x)) (函数) |
(C99)(C99) |
计算双曲正切 (tanh(x)) (函数) |
(C99)(C99)(C99) |
计算反双曲正弦 (arsinh(x)) (函数) |
(C99)(C99)(C99) |
计算复双曲正弦 (函数) |
C++ 文档 关于 sinh
|