cimagf
cimagf, cimag, cimagl
在头文件 | | |
---|---|---|
float cimagf( float complex z | (1) | (since C99) |
double cimag( double complex z | (2) | (since C99) |
long double cimagl( long double complex z | (3) | (since C99) |
Defined in header <tgmath.h> | | |
#define cimag( z ) | (4) | (since C99) |
1-3)返回的虚部z
。
4)式泛型宏:如果z
具有类型long double
complex
,long double
imaginary
或long double
,cimagl
被调用。如果z
有类型float
complex
,float
imaginary
或者float
,cimagf
被调用。如果z
有类型double
complex
,double
imaginary
,double
,或任何整数类型,cimag
被调用。
参数
z | - | 复杂的论点 |
---|
返回值
虚构的部分z
。
This function is fully specified for all possible inputs and is not subject to any errors described in math_errhandling.
笔记
对于任何复杂的变量z
,z ==
creal(z)
+ I*cimag(z)
。
例
#include <stdio.h>
#include <complex.h>
int main(void)
{
double complex z = 1.0 + 2.0*I;
printf("%f%+fi\n", creal(z), cimag(z)
}
输出:
1.000000+2.000000i
参考
- C11标准(ISO / IEC 9899:2011):