pow_hh.c
Go to the documentation of this file.
00001 #include "f2c.h"
00002 #ifdef __cplusplus
00003 extern "C" {
00004 #endif
00005 
00006 #ifdef KR_headers
00007 shortint pow_hh(ap, bp) shortint *ap, *bp;
00008 #else
00009 shortint pow_hh(shortint *ap, shortint *bp)
00010 #endif
00011 {
00012         shortint pow, x, n;
00013         unsigned u;
00014 
00015         x = *ap;
00016         n = *bp;
00017 
00018         if (n <= 0) {
00019                 if (n == 0 || x == 1)
00020                         return 1;
00021                 if (x != -1)
00022                         return x == 0 ? 1/x : 0;
00023                 n = -n;
00024                 }
00025         u = n;
00026         for(pow = 1; ; )
00027                 {
00028                 if(u & 01)
00029                         pow *= x;
00030                 if(u >>= 1)
00031                         x *= x;
00032                 else
00033                         break;
00034                 }
00035         return(pow);
00036         }
00037 #ifdef __cplusplus
00038 }
00039 #endif


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:56