|
|
1.1 root 1: /*
2: * Copyright (c) 1980 Regents of the University of California.
3: * All rights reserved. The Berkeley software License Agreement
4: * specifies the terms and conditions for redistribution.
5: *
6: * @(#)pow_zz.c 5.2 11/3/86
7: */
8:
9: #include "complex"
10: #ifdef tahoe
11: #define cabs zabs
12: #endif tahoe
13:
14: pow_zz(r,a,b)
15: dcomplex *r, *a, *b;
16: {
17: double logr, logi, x, y;
18: double log(), exp(), cos(), sin(), atan2(), cabs();
19:
20: logr = log( cabs(a->dreal, a->dimag) );
21: logi = atan2(a->dimag, a->dreal);
22:
23: x = exp( logr * b->dreal - logi * b->dimag );
24: y = logr * b->dimag + logi * b->dreal;
25:
26: r->dreal = x * cos(y);
27: r->dimag = x * sin(y);
28: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.