System V IPC code from Danny Boulet, chewed on a bit by the NetBSD group
[unix-history] / lib / libF77 / pow_di.c
CommitLineData
547779a8
WH
1#include "f2c.h"
2
3#ifdef KR_headers
4double pow_di(ap, bp) doublereal *ap; integer *bp;
5#else
6double pow_di(doublereal *ap, integer *bp)
7#endif
8{
9double pow, x;
10integer n;
11
12pow = 1;
13x = *ap;
14n = *bp;
15
16if(n != 0)
17 {
18 if(n < 0)
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 }
33return(pow);
34}