X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fmath%2Ftruncl.c;h=f07b1934097bcbb932e37a8b0710c99738993e39;hb=f6ecd0c296181bf6a2a7f54e3406c846500e8e63;hp=3eedb0839713144cf1fbb2f2e05cd7ba6f04aebc;hpb=d1a2ead878c27ac4ec600740320f8b76e1f961e9;p=musl diff --git a/src/math/truncl.c b/src/math/truncl.c index 3eedb083..f07b1934 100644 --- a/src/math/truncl.c +++ b/src/math/truncl.c @@ -6,11 +6,9 @@ long double truncl(long double x) return trunc(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 truncl(long double x) { union ldshape u = {x}; @@ -27,7 +25,7 @@ long double truncl(long double x) /* y = int(|x|) - |x|, where int(|x|) is an integer neighbor of |x| */ if (s) x = -x; - y = x + TOINT - TOINT - x; + y = x + toint - toint - x; if (y > 0) y -= 1; x += y;