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