©
Dieses Dokument verwendetPHP-Handbuch für chinesische WebsitesFreigeben
在头文件 |
|
|
---|---|---|
float complex conjf( float complex z ); |
(1) |
(since C99) |
double complex conj( double complex z ); |
(2) |
(since C99) |
long double complex conjl( long double complex z ); |
(3) |
(since C99) |
Defined in header |
|
|
#define conj( z ) |
(4) |
(since C99) |
1-3)计算复共轭的z
通过反转虚部的符号。
4)式泛型宏:如果z
具有类型long
double
complex
,long
double
imaginary
或long double
,conjl
被调用。如果z
有类型float
complex
,float
imaginary
或者float
,conjf
被调用。如果z
有类型double
complex
,double
imaginary
,double
,或任何整数类型,conj
被调用。
z |
- |
复杂的论点 |
---|
复共轭的z
。
在不实施C99实现I
作为_Imaginary_I
,conj
可以使用具有负零虚数部分,以获得复数。在C11中,宏CMPLX
被用于该目的。
#include#include int main(void){ double complex z = 1.0 + 2.0*I; double complex z2 = conj(z); printf("The conjugate of %.1f%+.1fi is %.1f%+.1fi\n", creal(z), cimag(z), creal(z2), cimag(z2)); printf("Their product is %.1f%+.1fi\n", creal(z*z2), cimag(z*z2));}
输出:
The conjugate of 1.0+2.0i is 1.0-2.0i Their product is 5.0+0.0i
C11 standard (ISO/IEC 9899:2011):
7.3.9.4 The conj functions (p: 198)
7.25 Type-generic math
G.7 Type-generic math
C99 standard (ISO/IEC 9899:1999):
7.3.9.3 The conj functions (p: 179)
7.22 Type-generic math
G.7 Type-generic math