fix double-processing of DT_RELR relocations in ldso relocating itself
[musl] / src / math / ceill.c
index a2cb0a7..60a8302 100644 (file)
@@ -6,11 +6,9 @@ long double ceill(long double x)
        return ceil(x);
 }
 #elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384
-#if LDBL_MANT_DIG == 64
-#define TOINT 0x1p63
-#elif LDBL_MANT_DIG == 113
-#define TOINT 0x1p112
-#endif
+
+static const long double toint = 1/LDBL_EPSILON;
+
 long double ceill(long double x)
 {
        union ldshape u = {x};
@@ -21,9 +19,9 @@ long double ceill(long double x)
                return x;
        /* y = int(x) - x, where int(x) is an integer neighbor of x */
        if (u.i.se >> 15)
-               y = x - TOINT + TOINT - x;
+               y = x - toint + toint - x;
        else
-               y = x + TOINT - TOINT - x;
+               y = x + toint - toint - x;
        /* special case because of non-nearest rounding modes */
        if (e <= 0x3fff-1) {
                FORCE_EVAL(y);