58 double fmod(
double x,
double y)
60 int32_t n, hx, hy, hz, ix, iy, sx, i;
70 if ((hy | ly) == 0 || (hx >= 0x7ff00000) ||
71 ((hy | ((ly | -ly) >> 31)) > 0x7ff00000))
72 return (x * y) / (x * y);
75 if ((hx < hy) || (lx < ly))
78 return Zero[(uint32_t)sx >> 31];
86 for (ix = -1043, i = lx; i > 0; i <<= 1)
91 for (ix = -1022, i = (hx << 11); i > 0; i <<= 1)
96 ix = (hx >> 20) - 1023;
103 for (iy = -1043, i = ly; i > 0; i <<= 1)
108 for (iy = -1022, i = (hy << 11); i > 0; i <<= 1)
113 iy = (hy >> 20) - 1023;
117 hx = 0x00100000 | (0x000fffff & hx);
123 hx = (hx << n) | (lx >> (32 - n));
133 hy = 0x00100000 | (0x000fffff & hy);
139 hy = (hy << n) | (ly >> (32 - n));
159 hx = hx + hx + (lx >> 31);
165 return Zero[(uint32_t)sx >> 31];
166 hx = hz + hz + (lz >> 31);
182 return Zero[(
unsigned)sx >> 31];
183 while (hx < 0x00100000)
185 hx = hx + hx + (lx >> 31);
191 hx = ((hx - 0x00100000) | ((iy + 1023) << 20));
199 lx = (lx >> n) | ((uint32_t)hx << (32 - n));
204 lx = (hx << (32 - n)) | (lx >> n);
#define INSERT_WORDS(d, ix0, ix1)
Set a double from two 32 bit ints.
static const double Zero[]
#define EXTRACT_WORDS(ix0, ix1, d)
Get two 32 bit ints from a double.
double fmod(double x, double y)
Return x mod y in exact arithmetic.