diff options
Diffstat (limited to 'lib/libF77/pow_ri.c')
| -rw-r--r-- | lib/libF77/pow_ri.c | 34 | 
1 files changed, 34 insertions, 0 deletions
| diff --git a/lib/libF77/pow_ri.c b/lib/libF77/pow_ri.c new file mode 100644 index 000000000000..3a3c4cf1ca4e --- /dev/null +++ b/lib/libF77/pow_ri.c @@ -0,0 +1,34 @@ +#include "f2c.h" + +#ifdef KR_headers +double pow_ri(ap, bp) real *ap; integer *bp; +#else +double pow_ri(real *ap, integer *bp) +#endif +{ +double pow, x; +integer n; + +pow = 1; +x = *ap; +n = *bp; + +if(n != 0) +	{ +	if(n < 0) +		{ +		n = -n; +		x = 1/x; +		} +	for( ; ; ) +		{ +		if(n & 01) +			pow *= x; +		if(n >>= 1) +			x *= x; +		else +			break; +		} +	} +return(pow); +} | 
