名稱空間
變體
操作

csinf、csin、csinl

來自 cppreference.com
< c‎ | 數值‎ | 複數
定義在標頭檔案 <complex.h>
float complex       csinf( float complex z );
(1) (C99 起)
double complex      csin( double complex z );
(2) (C99 起)
long double complex csinl( long double complex z );
(3) (C99 起)
定義於標頭檔案 <tgmath.h>
#define sin( z )
(4) (C99 起)
1-3) 計算 z 的復正弦。
4) 型別泛型宏:若 z 的型別為 long double complex,則呼叫 csinl。若 z 的型別為 double complex,則呼叫 csin,若 z 的型別為 float complex,則呼叫 csinf。若 z 為實數或整數,則宏呼叫對應的實函式(sinfsinsinl)。若 z 為虛數,則宏呼叫 sinh 函式對應的實數版本,實現公式 sin(iy) = i ∙ sinh(y),且宏的返回型別為虛數。

目錄

[編輯] 引數

z - 複數引數

[編輯] 返回值

若無錯誤發生,則返回 z 的復正弦。

錯誤和特殊情況的處理方式如同操作由 -I * csinh(I*z) 實現。

[編輯] 注意

正弦是複平面上的整函式,沒有分支切割。

正弦的數學定義是 sin z =
eiz
-e-iz
2i

[編輯] 示例

#include <stdio.h>
#include <math.h>
#include <complex.h>
 
int main(void)
{
    double complex z = csin(1);  // behaves like real sine along the real line
    printf("sin(1+0i) = %f%+fi ( sin(1)=%f)\n", creal(z), cimag(z), sin(1));
 
    double complex z2 = csin(I); // behaves like sinh along the imaginary line 
    printf("sin(0+1i) = %f%+fi (sinh(1)=%f)\n", creal(z2), cimag(z2), sinh(1));
}

輸出

sin(1+0i) = 0.841471+0.000000i ( sin(1)=0.841471)
sin(0+1i) = 0.000000+1.175201i (sinh(1)=1.175201)

[編輯] 參考

  • C17 標準 (ISO/IEC 9899:2018)
  • 7.3.5.5 csin 函式 (p: 138-139)
  • 7.25 型別通用數學 <tgmath.h> (p: 272-273)
  • G.7 型別泛型數學 <tgmath.h> (p: 397)
  • C11 標準 (ISO/IEC 9899:2011)
  • 7.3.5.5 csin 函式 (p: 191-192)
  • 7.25 型別通用數學 <tgmath.h> (p: 373-375)
  • G.7 型別通用數學 <tgmath.h> (p: 545)
  • C99 標準 (ISO/IEC 9899:1999)
  • 7.3.5.5 csin 函式 (p: 173)
  • 7.22 型別通用數學 <tgmath.h> (p: 335-337)
  • G.7 型別通用數學 <tgmath.h> (p: 480)

[編輯] 另請參閱

(C99)(C99)(C99)
計算復餘弦
(函式) [編輯]
(C99)(C99)(C99)
計算復正切
(函式) [編輯]
(C99)(C99)(C99)
計算復反正弦
(函式) [編輯]
(C99)(C99)
計算正弦 (sin(x))
(函式) [編輯]
C++ 文件 for sin