Category : C Source Code
Archive   : F2CSRC.ZIP
Filename : R_MOD.C

 
Output of file : R_MOD.C contained in archive : F2CSRC.ZIP

#include "f2c.h"

double r_mod(x,y)
real *x, *y;
{
#ifdef IEEE_drem
double drem(), xa, ya, z;
if ((ya = *y) < 0.)
ya = -ya;
z = drem(xa = *x, ya);
if (xa > 0) {
if (z < 0)
z += ya;
}
else if (z > 0)
z -= ya;
return z;
#else
double floor(), quotient;
if( (quotient = (double)*x / *y) >= 0)
quotient = floor(quotient);
else
quotient = -floor(-quotient);
return(*x - (*y) * quotient );
#endif
}