mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-24 05:58:56 +08:00
407c72cb29
* libF77/*: Fix formatting. * libI77/*: Likewise. * libU77/*: Likewise. From-SVN: r54145
34 lines
525 B
C
34 lines
525 B
C
#include "f2c.h"
|
|
|
|
#ifdef IEEE_drem
|
|
double drem (double, double);
|
|
#else
|
|
#undef abs
|
|
#include <math.h>
|
|
#endif
|
|
double
|
|
d_mod (doublereal * x, doublereal * y)
|
|
{
|
|
#ifdef IEEE_drem
|
|
double 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 quotient;
|
|
if ((quotient = *x / *y) >= 0)
|
|
quotient = floor (quotient);
|
|
else
|
|
quotient = -floor (-quotient);
|
|
return (*x - (*y) * quotient);
|
|
#endif
|
|
}
|