Go to the documentation of this file.00001 #include "f2c.h"
00002
00003 #ifdef KR_headers
00004 #ifdef IEEE_drem
00005 double drem();
00006 #else
00007 double floor();
00008 #endif
00009 double r_mod(x,y) real *x, *y;
00010 #else
00011 #ifdef IEEE_drem
00012 double drem(double, double);
00013 #else
00014 #undef abs
00015 #include "math.h"
00016 #ifdef __cplusplus
00017 extern "C" {
00018 #endif
00019 #endif
00020 double r_mod(real *x, real *y)
00021 #endif
00022 {
00023 #ifdef IEEE_drem
00024 double xa, ya, z;
00025 if ((ya = *y) < 0.)
00026 ya = -ya;
00027 z = drem(xa = *x, ya);
00028 if (xa > 0) {
00029 if (z < 0)
00030 z += ya;
00031 }
00032 else if (z > 0)
00033 z -= ya;
00034 return z;
00035 #else
00036 double quotient;
00037 if( (quotient = (double)*x / *y) >= 0)
00038 quotient = floor(quotient);
00039 else
00040 quotient = -floor(-quotient);
00041 return(*x - (*y) * quotient );
00042 #endif
00043 }
00044 #ifdef __cplusplus
00045 }
00046 #endif