?
This document uses PHP Chinese website manual Release
在頭文件<math.h>中定義 | ||
---|---|---|
float complex cpowf( float complex x, float complex y ); | (1) | (since C99) |
double complex cpow( double complex x, double complex y ); | (2) | (since C99) |
long double complex cpowl( long double complex x, long double complex y ); | (3) | (since C99) |
Defined in header <tgmath.h> | ||
#define pow( x, y ) | (4) | (since C99) |
1-3)計(jì)算復(fù)數(shù)冪函數(shù)xy
,沿負(fù)實(shí)軸的第一個(gè)參數(shù)分支切割。
4)類型 - 通用宏:如果任何參數(shù)具有類型long
double
complex
,cpowl
則被調(diào)用。如果任何參數(shù)具有類型double
complex
,cpow
則被調(diào)用,如果任何參數(shù)具有類型float
complex
,cpowf
則調(diào)用它。如果參數(shù)是實(shí)數(shù)或整數(shù),則宏調(diào)用相應(yīng)的實(shí)函數(shù)(powf
,pow
,powl
)。如果有任何參數(shù)是虛構(gòu)的,則調(diào)用相應(yīng)的復(fù)數(shù)版本。
x,y | - | 復(fù)雜的論點(diǎn) |
---|
如果沒(méi)有錯(cuò)誤發(fā)生,復(fù)雜的權(quán)力xy
,返回。
錯(cuò)誤和特殊情況的處理就像是通過(guò)執(zhí)行操作一樣cexp(y*clog(x))
,除了允許實(shí)現(xiàn)更仔細(xì)地處理特殊情況。
#include <stdio.h>#include <complex.h> int main(void){ double complex z = cpow(1.0+2.0*I, 2); printf("(1+2i)^2 = %.1f%+.1fi\n", creal(z), cimag(z)); double complex z2 = cpow(-1, 0.5); printf("(-1+0i)^0.5 = %.1f%+.1fi\n", creal(z2), cimag(z2)); double complex z3 = cpow(conj(-1), 0.5); // other side of the cut printf("(-1-0i)^0.5 = %.1f%+.1fi\n", creal(z3), cimag(z3)); double complex z4 = cpow(I, I); // i^i = exp(-pi/2) printf("i^i = %f%+fi\n", creal(z4), cimag(z4));}
輸出:
(1+2i)^2 = -3.0+4.0i(-1+0i)^0.5 = 0.0+1.0i(-1-0i)^0.5 = 0.0-1.0i i^i = 0.207880+0.000000i
C11標(biāo)準(zhǔn)(ISO / IEC 9899:2011):
7.3.8.2 cpow函數(shù)(p:195-196)
7.25類型通用數(shù)學(xué)<tgmath.h>(p:373-375)
G.6.4.1 cpow功能(p:544)
G.7類型 - 通用數(shù)學(xué)<tgmath.h>(p:545)
C99標(biāo)準(zhǔn)(ISO / IEC 9899:1999):
7.3.8.2 cpow函數(shù)(p:177)
7.22類型通用數(shù)學(xué)<tgmath.h>(p:335-337)
G.6.4.1 cpow功能(p:479)
G.7類型 - 通用數(shù)學(xué)<tgmath.h>(p:480)