3 #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
4 long double fmodl(long double x, long double y)
8 #elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384
9 long double fmodl(long double x, long double y)
11 union ldshape ux = {x}, uy = {y};
12 int ex = ux.i.se & 0x7fff;
13 int ey = uy.i.se & 0x7fff;
14 int sx = ux.i.se & 0x8000;
16 if (y == 0 || isnan(y) || ex == 0x7fff)
26 /* normalize x and y */
37 #if LDBL_MANT_DIG == 64
41 for (; ex > ey; ex--) {
47 } else if (2*mx < mx) {
59 for (; mx >> 63 == 0; mx *= 2, ex--);
61 #elif LDBL_MANT_DIG == 113
62 uint64_t hi, lo, xhi, xlo, yhi, ylo;
63 xhi = (ux.i2.hi & -1ULL>>16) | 1ULL<<48;
64 yhi = (uy.i2.hi & -1ULL>>16) | 1ULL<<48;
67 for (; ex > ey; ex--) {
75 xhi = 2*hi + (lo>>63);
78 xhi = 2*xhi + (xlo>>63);
92 for (; xhi >> 48 == 0; xhi = 2*xhi + (xlo>>63), xlo = 2*xlo, ex--);
99 ux.i.se = (ex+120)|sx;