mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-21 14:09:44 +08:00
27dcc451f4
2002-11-19 Toon Moene <toon@moene.indiv.nluug.nl> PR fortran/8587 * libF77/pow_zz.c: Handle (0.0, 0.0) ** power. 2002-11-19 Toon Moene <toon@moene.indiv.nluug.nl> PR fortran/8587 * news.texi: Show PR fortran/8587 fixed. From-SVN: r59280
26 lines
500 B
C
26 lines
500 B
C
#include "f2c.h"
|
|
|
|
#undef abs
|
|
#include <math.h>
|
|
extern double f__cabs (double, double);
|
|
void
|
|
pow_zz (doublecomplex * r, doublecomplex * a, doublecomplex * b)
|
|
{
|
|
double logr, logi, x, y;
|
|
|
|
if (a->r == 0.0 && a->i == 0.0)
|
|
{
|
|
/* Algorithm below doesn't cope. */
|
|
r->r = r->i = 0.0;
|
|
return;
|
|
}
|
|
logr = log (f__cabs (a->r, a->i));
|
|
logi = atan2 (a->i, a->r);
|
|
|
|
x = exp (logr * b->r - logi * b->i);
|
|
y = logr * b->i + logi * b->r;
|
|
|
|
r->r = x * cos (y);
|
|
r->i = x * sin (y);
|
|
}
|