diff options
| author | svn2git <svn2git@FreeBSD.org> | 1994-05-01 08:00:00 +0000 |
|---|---|---|
| committer | svn2git <svn2git@FreeBSD.org> | 1994-05-01 08:00:00 +0000 |
| commit | a16f65c7d117419bd266c28a1901ef129a337569 (patch) | |
| tree | 2626602f66dc3551e7a7c7bc9ad763c3bc7ab40a /lib/libF77/pow_zi.c | |
| parent | 8503f4f13f77abf7adc8f7e329c6f9c1d52b6a20 (diff) | |
Release FreeBSD 1.1upstream/1.1.0_cvsrelease/1.1.0_cvs
This commit was manufactured to restore the state of the 1.1-RELEASE image.
Releases prior to 5.3-RELEASE are omitting the secure/ and crypto/ subdirs.
Diffstat (limited to 'lib/libF77/pow_zi.c')
| -rw-r--r-- | lib/libF77/pow_zi.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/lib/libF77/pow_zi.c b/lib/libF77/pow_zi.c new file mode 100644 index 000000000000..8dd60069bfe0 --- /dev/null +++ b/lib/libF77/pow_zi.c @@ -0,0 +1,50 @@ +#include "f2c.h" + +#ifdef KR_headers +VOID pow_zi(p, a, b) /* p = a**b */ + doublecomplex *p, *a; integer *b; +#else +extern void z_div(doublecomplex*, doublecomplex*, doublecomplex*); +void pow_zi(doublecomplex *p, doublecomplex *a, integer *b) /* p = a**b */ +#endif +{ +integer n; +double t; +doublecomplex x; +static doublecomplex one = {1.0, 0.0}; + +n = *b; +p->r = 1; +p->i = 0; + +if(n == 0) + return; +if(n < 0) + { + n = -n; + z_div(&x, &one, a); + } +else + { + x.r = a->r; + x.i = a->i; + } + +for( ; ; ) + { + if(n & 01) + { + t = p->r * x.r - p->i * x.i; + p->i = p->r * x.i + p->i * x.r; + p->r = t; + } + if(n >>= 1) + { + t = x.r * x.r - x.i * x.i; + x.i = 2 * x.r * x.i; + x.r = t; + } + else + break; + } +} |
