sinh, sinhf, sinhl
來自 cppreference.com
定義於標頭檔案 <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: TBD)
- 7.25 型別通用數學 <tgmath.h> (p: TBD)
- F.10.2.5 sinh 函式 (p: TBD)
- 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
|