Asterisk - The Open Source Telephony Project  18.5.0
Functions
f2clib.c File Reference
#include "f2c.h"
#include "math.h"
Include dependency graph for f2clib.c:

Go to the source code of this file.

Functions

integer i_nint (real *x)
 
integer pow_ii (integer *ap, integer *bp)
 
double r_sign (real *a, real *b)
 

Function Documentation

◆ i_nint()

integer i_nint ( real x)

Definition at line 80 of file f2clib.c.

Referenced by placea_(), r_sign(), voicin_(), and vparms_().

82 {
83 return( (integer)((*x)>=0 ?
84  floor(*x + .5) : -floor(.5 - *x)) );
85 }
INT32 integer
Definition: lpc10.h:80

◆ pow_ii()

integer pow_ii ( integer ap,
integer bp 
)

Definition at line 30 of file f2clib.c.

References a, b, and r_sign().

Referenced by decode_(), and encode_().

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  }
INT32 integer
Definition: lpc10.h:80

◆ r_sign()

double r_sign ( real a,
real b 
)

Definition at line 64 of file f2clib.c.

References a, and i_nint().

Referenced by onset_(), pow_ii(), and vparms_().

66 {
67 double x;
68 x = (*a >= 0 ? *a : - *a);
69 return( *b >= 0 ? x : -x);
70 }
static struct test_val b
static struct test_val a