source: trunk/gcc/libf2c/libF77/pow_zz.c

Last change on this file was 1392, checked in by bird, 21 years ago

This commit was generated by cvs2svn to compensate for changes in r1391,
which included commits to RCS files with non-trunk default branches.

  • Property cvs2svn:cvs-rev set to 1.1.1.2
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 500 bytes
Line 
1#include "f2c.h"
2
3#undef abs
4#include <math.h>
5extern double f__cabs (double, double);
6void
7pow_zz (doublecomplex * r, doublecomplex * a, doublecomplex * b)
8{
9 double logr, logi, x, y;
10
11 if (a->r == 0.0 && a->i == 0.0)
12 {
13 /* Algorithm below doesn't cope. */
14 r->r = r->i = 0.0;
15 return;
16 }
17 logr = log (f__cabs (a->r, a->i));
18 logi = atan2 (a->i, a->r);
19
20 x = exp (logr * b->r - logi * b->i);
21 y = logr * b->i + logi * b->r;
22
23 r->r = x * cos (y);
24 r->i = x * sin (y);
25}
Note: See TracBrowser for help on using the repository browser.