?
Dieses Dokument verwendet PHP-Handbuch für chinesische Websites Freigeben
在頭文件<math.h>中定義 | ||
---|---|---|
float complex ccosf( float complex z ); | (1) | (since C99) |
double complex ccos( double complex z ); | (2) | (since C99) |
long double complex ccosl( long double complex z ); | (3) | (since C99) |
Defined in header <tgmath.h> | ||
#define cos( z ) | (4) | (since C99) |
1-3)計(jì)算復(fù)數(shù)余弦z
。
4)類型 - 通用宏:如果z
有類型long
double
complex
,ccosl
被調(diào)用。如果z
有類型double
complex
,ccos
稱為,如果z
有類型float
complex
,ccosf
稱為。如果z
是真實(shí)的或整數(shù),則宏調(diào)用相應(yīng)的實(shí)函數(shù)(cosf
,cos
,cosl
)。如果z
是虛構(gòu)的,則宏調(diào)用函數(shù)的相應(yīng)實(shí)際版本cosh
,實(shí)現(xiàn)公式cos(iy)= cosh(y),并且返回類型是實(shí)數(shù)。
z | - | 復(fù)雜的論點(diǎn) |
---|
如果沒有發(fā)生錯(cuò)誤,z
則返回復(fù)余弦。
錯(cuò)誤和特殊情況被處理,就像操作被執(zhí)行一樣ccosh(I*z)
。
余弦是復(fù)平面上的整個(gè)函數(shù),并且沒有分支切割。余弦的數(shù)學(xué)定義是cos z =
| eiz+e-iz |
|:----|
| 2 |
#include <stdio.h>#include <math.h>#include <complex.h> int main(void){ double complex z = ccos(1); // behaves like real cosine along the real line printf("cos(1+0i) = %f%+fi ( cos(1)=%f)\n", creal(z), cimag(z), cos(1)); double complex z2 = ccos(I); // behaves like real cosh along the imaginary line printf("cos(0+1i) = %f%+fi (cosh(1)=%f)\n", creal(z2), cimag(z2), cosh(1));}
輸出:
cos(1+0i) = 0.540302-0.000000i ( cos(1)=0.540302)cos(0+1i) = 1.543081-0.000000i (cosh(1)=1.543081)
C11標(biāo)準(zhǔn)(ISO / IEC 9899:2011):
7.3.5.4 ccos功能(p:191)
7.25類型通用數(shù)學(xué)<tgmath.h>(p:373-375)
G.7類型 - 通用數(shù)學(xué)<tgmath.h>(p:545)
C99標(biāo)準(zhǔn)(ISO / IEC 9899:1999):
7.3.5.4 ccos功能(p:173)
7.22類型通用數(shù)學(xué)<tgmath.h>(p:335-337)
G.7類型 - 通用數(shù)學(xué)<tgmath.h>(p:480)