110517Sdlw /* 2*22941Skre * Copyright (c) 1980 Regents of the University of California. 3*22941Skre * All rights reserved. The Berkeley software License Agreement 4*22941Skre * specifies the terms and conditions for redistribution. 5*22941Skre * 6*22941Skre * @(#)pow_zz.c 5.1 06/07/85 710517Sdlw */ 810517Sdlw 910517Sdlw #include "complex" 1010517Sdlw 1110517Sdlw pow_zz(r,a,b) 1210517Sdlw dcomplex *r, *a, *b; 1310517Sdlw { 1410517Sdlw double logr, logi, x, y; 1510517Sdlw double log(), exp(), cos(), sin(), atan2(), cabs(); 1610517Sdlw 1710517Sdlw logr = log( cabs(a->dreal, a->dimag) ); 1810517Sdlw logi = atan2(a->dimag, a->dreal); 1910517Sdlw 2010517Sdlw x = exp( logr * b->dreal - logi * b->dimag ); 2110517Sdlw y = logr * b->dimag + logi * b->dreal; 2210517Sdlw 2310517Sdlw r->dreal = x * cos(y); 2410517Sdlw r->dimag = x * sin(y); 2510517Sdlw } 26