27 lines
415 B
C
27 lines
415 B
C
#include "f2c.h"
|
|
|
|
double d_mod(x,y)
|
|
doublereal *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 = *x / *y) >= 0)
|
|
quotient = floor(quotient);
|
|
else
|
|
quotient = -floor(-quotient);
|
|
return(*x - (*y) * quotient );
|
|
#endif
|
|
}
|