|
|
1.1 ! root 1: #include "f2c.h" ! 2: ! 3: #ifdef KR_headers ! 4: double pow_ri(ap, bp) real *ap; integer *bp; ! 5: #else ! 6: double pow_ri(real *ap, integer *bp) ! 7: #endif ! 8: { ! 9: double pow, x; ! 10: integer n; ! 11: ! 12: pow = 1; ! 13: x = *ap; ! 14: n = *bp; ! 15: ! 16: if(n != 0) ! 17: { ! 18: if(n < 0) ! 19: { ! 20: n = -n; ! 21: x = 1/x; ! 22: } ! 23: for( ; ; ) ! 24: { ! 25: if(n & 01) ! 26: pow *= x; ! 27: if(n >>= 1) ! 28: x *= x; ! 29: else ! 30: break; ! 31: } ! 32: } ! 33: return(pow); ! 34: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.