1: /* 2: * "@(#)pow_zz.c 1.1" 3: */ 4: 5: #include "complex" 6: 7: pow_zz(r,a,b) 8: dcomplex *r, *a, *b; 9: { 10: double logr, logi, x, y; 11: double log(), exp(), cos(), sin(), atan2(), cabs(); 12: 13: logr = log( cabs(a->dreal, a->dimag) ); 14: logi = atan2(a->dimag, a->dreal); 15: 16: x = exp( logr * b->dreal - logi * b->dimag ); 17: y = logr * b->dimag + logi * b->dreal; 18: 19: r->dreal = x * cos(y); 20: r->dimag = x * sin(y); 21: }