(ap, bp)
| 256 | |
| 257 | #ifdef KR_headers |
| 258 | double pow_di(ap, bp) doublereal *ap; integer *bp; |
| 259 | #else |
| 260 | double pow_di(doublereal *ap, integer *bp) |
| 261 | #endif |
| 262 | { |
| 263 | double pow, x; |
| 264 | integer n; |
| 265 | unsigned long u; |
| 266 | |
| 267 | pow = 1; |
| 268 | x = *ap; |
| 269 | n = *bp; |
| 270 | |
| 271 | if(n != 0) |
| 272 | { |
| 273 | if(n < 0) |
| 274 | { |
| 275 | n = -n; |
| 276 | x = 1/x; |
| 277 | } |
| 278 | for(u = n; ; ) |
| 279 | { |
| 280 | if(u & 01) |
| 281 | pow *= x; |
| 282 | if(u >>= 1) |
| 283 | x *= x; |
| 284 | else |
| 285 | break; |
| 286 | } |
| 287 | } |
| 288 | return(pow); |
| 289 | } |
| 290 |