共用方式為


cimag、 、 cimagfcimagl

擷取複數的虛數部分。

語法

double cimag( _Dcomplex z );
float cimagf( _Fcomplex z );
long double cimagl( _Lcomplex z );
#define cimag(X) // Requires C11 or higher

float cimag( _Fcomplex z );  // C++ only
long double cimag( _Lcomplex z );  // C++ only

參數

z
複數。

傳回值

z 的虛數部分。

備註

因為 C++ 允許多載,所以您可以呼叫採用 _Fcomplex_Lcomplex 值並傳回 floatlong double 值之 cimag 的多載。 在 C 程式中,除非您使用 <tgmath.h> 巨集來呼叫此函式, cimag 否則一律會接受 _Dcomplex 值並傳 double 回值。

如果您使用 <tgmath.h>cimag() 巨集,則引數的型別會決定選取哪一個函式版本。 如需詳細資料,請參閱型別泛型數學

需求

常式 C 標頭 C++ 標頭
cimag、 、 cimagfcimagl <complex.h> <ccomplex>
cimag 巨集 <tgmath.h>

如需相容性詳細資訊,請參閱相容性

另請參閱

依字母順序排列的函式參考
norm、 、 normfnorml
creal、 、 crealfcreall
cproj、 、 cprojfcprojl
conj、 、 conjfconjl
carg、 、 cargfcargl
cabs、 、 cabsfcabsl