Debian Codegraph @

debian/external_deps/fetk/punc/src/vf2c/r_mod.c

raw
1 #include "f2c.h"
2
3 #ifdef KR_headers
4 #ifdef IEEE_drem
5 double drem();
6 #else
7 double floor();
8 #endif
9 double r_mod(x,y) real *x, *y;
10 #else
11 #ifdef IEEE_drem
12 double drem(double, double);
13 #else
14 #undef abs
15 #include "math.h"
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 #endif
20 double r_mod(real *x, real *y)
21 #endif
22 {
23 #ifdef IEEE_drem
24 double xa, ya, z;
25 if ((ya = *y) < 0.)
26 ya = -ya;
27 z = drem(xa = *x, ya);
28 if (xa > 0) {
29 if (z < 0)
30 z += ya;
31 }
32 else if (z > 0)
33 z -= ya;
34 return z;
35 #else
36 double quotient;
37 if( (quotient = (double)*x / *y) >= 0)
38 quotient = floor(quotient);
39 else
40 quotient = -floor(-quotient);
41 return(*x - (*y) * quotient );
42 #endif
43 }
44 #ifdef __cplusplus
45 }
46 #endif