diff options
Diffstat (limited to 'src/math/ceill.c')
-rw-r--r-- | src/math/ceill.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/math/ceill.c b/src/math/ceill.c index a2cb0a7f..60a83020 100644 --- a/src/math/ceill.c +++ b/src/math/ceill.c @@ -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); |