?
Ce document utilise Manuel du site Web PHP chinois Libérer
在頭文件<math.h>中定義 | ||
---|---|---|
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 <tgmath.h> | ||
#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
,或任何整數(shù)類型,conj
被調用。
z | - | 復雜的論點 |
---|
復共軛的z
。
在不實施C99實現(xiàn)I
作為_Imaginary_I
,conj
可以使用具有負零虛數(shù)部分,以獲得復數(shù)。在C11中,宏CMPLX
被用于該目的。
#include <stdio.h>#include <complex.h> 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 <tgmath.h> (p: 373-375)
G.7 Type-generic math <tgmath.h> (p: 545)
C99 standard (ISO/IEC 9899:1999):
7.3.9.3 The conj functions (p: 179)
7.22 Type-generic math <tgmath.h> (p: 335-337)
G.7 Type-generic math <tgmath.h> (p: 480)