debian/external_deps/fetk/punc/src/vf2c/pow_di.c
raw| 1 | #include "f2c.h" |
| 2 | #ifdef __cplusplus |
| 3 | extern "C" { |
| 4 | #endif |
| 5 | |
| 6 | #ifdef KR_headers |
| 7 | double pow_di(ap, bp) doublereal *ap; integer *bp; |
| 8 | #else |
| 9 | double pow_di(doublereal *ap, integer *bp) |
| 10 | #endif |
| 11 | { |
| 12 | double pow, x; |
| 13 | integer n; |
| 14 | unsigned long u; |
| 15 | |
| 16 | pow = 1; |
| 17 | x = *ap; |
| 18 | n = *bp; |
| 19 | |
| 20 | if(n != 0) |
| 21 | { |
| 22 | if(n < 0) |
| 23 | { |
| 24 | n = -n; |
| 25 | x = 1/x; |
| 26 | } |
| 27 | for(u = n; ; ) |
| 28 | { |
| 29 | if(u & 01) |
| 30 | pow *= x; |
| 31 | if(u >>= 1) |
| 32 | x *= x; |
| 33 | else |
| 34 | break; |
| 35 | } |
| 36 | } |
| 37 | return(pow); |
| 38 | } |
| 39 | #ifdef __cplusplus |
| 40 | } |
| 41 | #endif |