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:
341 bytes
|
Line | |
---|
1 | #include "f2c.h"
|
---|
2 |
|
---|
3 | double
|
---|
4 | pow_ri (real * ap, integer * bp)
|
---|
5 | {
|
---|
6 | double pow, x;
|
---|
7 | integer n;
|
---|
8 | unsigned long u;
|
---|
9 |
|
---|
10 | pow = 1;
|
---|
11 | x = *ap;
|
---|
12 | n = *bp;
|
---|
13 |
|
---|
14 | if (n != 0)
|
---|
15 | {
|
---|
16 | if (n < 0)
|
---|
17 | {
|
---|
18 | n = -n;
|
---|
19 | x = 1 / x;
|
---|
20 | }
|
---|
21 | for (u = n;;)
|
---|
22 | {
|
---|
23 | if (u & 01)
|
---|
24 | pow *= x;
|
---|
25 | if (u >>= 1)
|
---|
26 | x *= x;
|
---|
27 | else
|
---|
28 | break;
|
---|
29 | }
|
---|
30 | }
|
---|
31 | return (pow);
|
---|
32 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.