27 lines
417 B
C
27 lines
417 B
C
#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
|
|
}
|