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