home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / sharew / f_2_c / libf77 / pow_ii.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-06-10  |  267 b   |  26 lines

  1. #include "f2c.h"
  2.  
  3. integer pow_ii(ap, bp)
  4. integer *ap, *bp;
  5. {
  6. integer pow, x, n;
  7.  
  8. pow = 1;
  9. x = *ap;
  10. n = *bp;
  11.  
  12. if(n < 0)
  13.     { }
  14. else if(n > 0)
  15.     for( ; ; )
  16.         {
  17.         if(n & 01)
  18.             pow *= x;
  19.         if(n >>= 1)
  20.             x *= x;
  21.         else
  22.             break;
  23.         }
  24. return(pow);
  25. }
  26.