comparison ext/clapack/src/pow_di.c @ 430:335af74a25b6

Merge from branch clapack-included
author Chris Cannam <c.cannam@qmul.ac.uk>
date Fri, 30 Sep 2016 16:24:24 +0100
parents 905e45637745
children
comparison
equal deleted inserted replaced
426:a23b9f8b4a59 430:335af74a25b6
1 #include "f2c.h"
2 #ifdef __cplusplus
3 extern "C" {
4 #endif
5
6 #ifdef KR_headers
7 double pow_di(ap, bp) doublereal *ap; integer *bp;
8 #else
9 double pow_di(doublereal *ap, integer *bp)
10 #endif
11 {
12 double pow, x;
13 integer n;
14 unsigned long u;
15
16 pow = 1;
17 x = *ap;
18 n = *bp;
19
20 if(n != 0)
21 {
22 if(n < 0)
23 {
24 n = -n;
25 x = 1/x;
26 }
27 for(u = n; ; )
28 {
29 if(u & 01)
30 pow *= x;
31 if(u >>= 1)
32 x *= x;
33 else
34 break;
35 }
36 }
37 return(pow);
38 }
39 #ifdef __cplusplus
40 }
41 #endif