00001 #include "f2c.h" 00002 00003 #ifdef KR_headers 00004 double pow_di(ap, bp) doublereal *ap; integer *bp; 00005 #else 00006 double pow_di(doublereal *ap, integer *bp) 00007 #endif 00008 { 00009 double pow, x; 00010 integer n; 00011 00012 pow = 1; 00013 x = *ap; 00014 n = *bp; 00015 00016 if(n != 0) 00017 { 00018 if(n < 0) 00019 { 00020 n = -n; 00021 x = 1/x; 00022 } 00023 for( ; ; ) 00024 { 00025 if(n & 01) 00026 pow *= x; 00027 if(n >>= 1) 00028 x *= x; 00029 else 00030 break; 00031 } 00032 } 00033 return(pow); 00034 }