Doxygen Source Code Documentation
Main Page Alphabetical List Data Structures File List Data Fields Globals Search
pow_di.c
Go to the documentation of this file.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 unsigned long u;
00012
00013 pow = 1;
00014 x = *ap;
00015 n = *bp;
00016
00017 if(n != 0)
00018 {
00019 if(n < 0)
00020 {
00021 n = -n;
00022 x = 1/x;
00023 }
00024 for(u = n; ; )
00025 {
00026 if(u & 01)
00027 pow *= x;
00028 if(u >>= 1)
00029 x *= x;
00030 else
00031 break;
00032 }
00033 }
00034 return(pow);
00035 }