Mercurial > hg > qm-dsp
annotate ext/clapack/src/pow_di.c @ 207:f11ec82227d5
Change that seemed to be needed for emscripten double-precision build to work
author | Chris Cannam |
---|---|
date | Tue, 14 Mar 2017 13:40:50 +0000 |
parents | 45330e0d2819 |
children |
rev | line source |
---|---|
Chris@202 | 1 #include "f2c.h" |
Chris@202 | 2 #ifdef __cplusplus |
Chris@202 | 3 extern "C" { |
Chris@202 | 4 #endif |
Chris@202 | 5 |
Chris@202 | 6 #ifdef KR_headers |
Chris@202 | 7 double pow_di(ap, bp) doublereal *ap; integer *bp; |
Chris@202 | 8 #else |
Chris@202 | 9 double pow_di(doublereal *ap, integer *bp) |
Chris@202 | 10 #endif |
Chris@202 | 11 { |
Chris@202 | 12 double pow, x; |
Chris@202 | 13 integer n; |
Chris@202 | 14 unsigned long u; |
Chris@202 | 15 |
Chris@202 | 16 pow = 1; |
Chris@202 | 17 x = *ap; |
Chris@202 | 18 n = *bp; |
Chris@202 | 19 |
Chris@202 | 20 if(n != 0) |
Chris@202 | 21 { |
Chris@202 | 22 if(n < 0) |
Chris@202 | 23 { |
Chris@202 | 24 n = -n; |
Chris@202 | 25 x = 1/x; |
Chris@202 | 26 } |
Chris@202 | 27 for(u = n; ; ) |
Chris@202 | 28 { |
Chris@202 | 29 if(u & 01) |
Chris@202 | 30 pow *= x; |
Chris@202 | 31 if(u >>= 1) |
Chris@202 | 32 x *= x; |
Chris@202 | 33 else |
Chris@202 | 34 break; |
Chris@202 | 35 } |
Chris@202 | 36 } |
Chris@202 | 37 return(pow); |
Chris@202 | 38 } |
Chris@202 | 39 #ifdef __cplusplus |
Chris@202 | 40 } |
Chris@202 | 41 #endif |