|
|
1.1 ! root 1: /* ! 2: * "@(#)pow_ri.c 1.1" ! 3: */ ! 4: ! 5: float pow_ri(ap, bp) ! 6: float *ap; ! 7: long int *bp; ! 8: { ! 9: double pow, x; ! 10: long int n; ! 11: ! 12: pow = 1; ! 13: x = *ap; ! 14: n = *bp; ! 15: ! 16: if(n != 0) ! 17: { ! 18: if(n < 0) ! 19: { ! 20: if(x == 0) ! 21: { ! 22: return(pow); ! 23: } ! 24: n = -n; ! 25: x = 1/x; ! 26: } ! 27: for( ; ; ) ! 28: { ! 29: if(n & 01) ! 30: pow *= x; ! 31: if(n >>= 1) ! 32: x *= x; ! 33: else ! 34: break; ! 35: } ! 36: } ! 37: return(pow); ! 38: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.