Doxygen Source Code Documentation
pow_qq.c File Reference
#include "f2c.h"Go to the source code of this file.
Functions | |
| longint | pow_qq (longint *ap, longint *bp) |
Function Documentation
|
||||||||||||
|
Definition at line 6 of file pow_qq.c.
00008 {
00009 longint pow, x, n;
00010 unsigned long long u; /* system-dependent */
00011
00012 x = *ap;
00013 n = *bp;
00014
00015 if (n <= 0) {
00016 if (n == 0 || x == 1)
00017 return 1;
00018 if (x != -1)
00019 return x == 0 ? 1/x : 0;
00020 n = -n;
00021 }
00022 u = n;
00023 for(pow = 1; ; )
00024 {
00025 if(u & 01)
00026 pow *= x;
00027 if(u >>= 1)
00028 x *= x;
00029 else
00030 break;
00031 }
00032 return(pow);
00033 }
|