Asterisk - The Open Source Telephony Project GIT-master-f36a736
f2clib.c
Go to the documentation of this file.
1/*
2
3$Log$
4Revision 1.14 2003/02/12 13:59:15 matteo
5mer feb 12 14:56:57 CET 2003
6
7Revision 1.1.1.1 2003/02/12 13:59:15 matteo
8mer feb 12 14:56:57 CET 2003
9
10Revision 1.2 2000/01/05 08:20:39 markster
11Some 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
28integer pow_ii(ap, bp) integer *ap, *bp;
29#else
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
62double r_sign(a,b) real *a, *b;
63#else
64double r_sign(real *a, real *b)
65#endif
66{
67double x;
68x = (*a >= 0 ? *a : - *a);
69return( *b >= 0 ? x : -x);
70}
71
72
73
74#ifdef KR_headers
75double floor();
76integer i_nint(x) real *x;
77#else
78#undef abs
79#include "math.h"
81#endif
82{
83return( (integer)((*x)>=0 ?
84 floor(*x + .5) : -floor(.5 - *x)) );
85}
double r_sign(real *a, real *b)
Definition: f2clib.c:64
integer pow_ii(integer *ap, integer *bp)
Definition: f2clib.c:30
integer i_nint(real *x)
Definition: f2clib.c:80
float real
Definition: lpc10.h:79
INT32 integer
Definition: lpc10.h:80
static struct test_val b
static struct test_val a