BSD 4_3 release
[unix-history] / usr / src / usr.lib / libF77 / pow_ri.c
CommitLineData
683456d4 1/*
a7868ad7
RE
2 * Copyright (c) 1980 Regents of the University of California.
3 * All rights reserved. The Berkeley software License Agreement
4 * specifies the terms and conditions for redistribution.
5 *
95f51977 6 * @(#)pow_ri.c 5.2 7/9/85
683456d4
DW
7 */
8
95f51977
C
9float flt_retval;
10
683456d4
DW
11float pow_ri(ap, bp)
12float *ap;
13long int *bp;
14{
15double pow, x;
16long int n;
17
18pow = 1;
19x = *ap;
20n = *bp;
21
22if(n != 0)
23 {
24 if(n < 0)
25 {
26 if(x == 0)
27 {
95f51977
C
28 flt_retval = pow;
29 return(flt_retval);
683456d4
DW
30 }
31 n = -n;
32 x = 1/x;
33 }
34 for( ; ; )
35 {
36 if(n & 01)
37 pow *= x;
38 if(n >>= 1)
39 x *= x;
40 else
41 break;
42 }
43 }
95f51977
C
44flt_retval = pow;
45return(flt_retval);
683456d4 46}