Mercurial > hg > qm-dsp
annotate ext/clapack/src/pow_di.c @ 482:cbe668c7d724
Untabify, indent, tidy
author | Chris Cannam <cannam@all-day-breakfast.com> |
---|---|
date | Fri, 31 May 2019 11:02:28 +0100 |
parents | 905e45637745 |
children |
rev | line source |
---|---|
c@427 | 1 #include "f2c.h" |
c@427 | 2 #ifdef __cplusplus |
c@427 | 3 extern "C" { |
c@427 | 4 #endif |
c@427 | 5 |
c@427 | 6 #ifdef KR_headers |
c@427 | 7 double pow_di(ap, bp) doublereal *ap; integer *bp; |
c@427 | 8 #else |
c@427 | 9 double pow_di(doublereal *ap, integer *bp) |
c@427 | 10 #endif |
c@427 | 11 { |
c@427 | 12 double pow, x; |
c@427 | 13 integer n; |
c@427 | 14 unsigned long u; |
c@427 | 15 |
c@427 | 16 pow = 1; |
c@427 | 17 x = *ap; |
c@427 | 18 n = *bp; |
c@427 | 19 |
c@427 | 20 if(n != 0) |
c@427 | 21 { |
c@427 | 22 if(n < 0) |
c@427 | 23 { |
c@427 | 24 n = -n; |
c@427 | 25 x = 1/x; |
c@427 | 26 } |
c@427 | 27 for(u = n; ; ) |
c@427 | 28 { |
c@427 | 29 if(u & 01) |
c@427 | 30 pow *= x; |
c@427 | 31 if(u >>= 1) |
c@427 | 32 x *= x; |
c@427 | 33 else |
c@427 | 34 break; |
c@427 | 35 } |
c@427 | 36 } |
c@427 | 37 return(pow); |
c@427 | 38 } |
c@427 | 39 #ifdef __cplusplus |
c@427 | 40 } |
c@427 | 41 #endif |