Debian Codegraph @

codecs/lpc10/f2clib.c

raw symbols SCIP
1 /*
2
3 $Log$
4 Revision 1.14 2003/02/12 13:59:15 matteo
5 mer feb 12 14:56:57 CET 2003
6
7 Revision 1.1.1.1 2003/02/12 13:59:15 matteo
8 mer feb 12 14:56:57 CET 2003
9
10 Revision 1.2 2000/01/05 08:20:39 markster
11 Some OSS fixes and a few lpc changes to make it actually work
12
13 * Revision 1.1 1996/08/19 22:32:10 jaf
14 * Initial revision
15 *
16
17 */
18
19 /*
20 * f2clib.c
21 *
22 * SCCS ID: @(#)f2clib.c 1.2 96/05/19
23 */
24
25 #include "f2c.h"
26
27 #ifdef KR_headers
28 integer pow_ii(ap, bp) integer *ap, *bp;
29 #else
30 integer pow_ii(integer *ap, integer *bp)
31 #endif
32 {
33 integer pow, x, n;
34 unsigned long u;
35
36 x = *ap;
37 n = *bp;
38
39 if (n <= 0) {
40 if (n == 0 || x == 1)
41 return 1;
42 if (x != -1)
43 return x == 0 ? 0 : 1/x;
44 n = -n;
45 }
46 u = n;
47 for(pow = 1; ; )
48 {
49 if(u & 01)
50 pow *= x;
51 if(u >>= 1)
52 x *= x;
53 else
54 break;
55 }
56 return(pow);
57 }
58
59
60
61 #ifdef KR_headers
62 double r_sign(a,b) real *a, *b;
63 #else
64 double r_sign(real *a, real *b)
65 #endif
66 {
67 double x;
68 x = (*a >= 0 ? *a : - *a);
69 return( *b >= 0 ? x : -x);
70 }
71
72
73
74 #ifdef KR_headers
75 double floor();
76 integer i_nint(x) real *x;
77 #else
78 #undef abs
79 #include "math.h"
80 integer i_nint(real *x)
81 #endif
82 {
83 return( (integer)((*x)>=0 ?
84 floor(*x + .5) : -floor(.5 - *x)) );
85 }