X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fmath%2Frintl.c;h=374327db2282d450ceb79e12286db767eb452148;hb=0ce946cf808274c2d6e5419b139e130c8ad4bd30;hp=267250737f0a8e3b3924ee7bb662bbce2bbf6a9e;hpb=d1a2ead878c27ac4ec600740320f8b76e1f961e9;p=musl diff --git a/src/math/rintl.c b/src/math/rintl.c index 26725073..374327db 100644 --- a/src/math/rintl.c +++ b/src/math/rintl.c @@ -6,11 +6,9 @@ long double rintl(long double x) return rint(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 rintl(long double x) { union ldshape u = {x}; @@ -21,9 +19,9 @@ long double rintl(long double x) if (e >= 0x3fff+LDBL_MANT_DIG-1) return x; if (s) - y = x - TOINT + TOINT; + y = x - toint + toint; else - y = x + TOINT - TOINT; + y = x + toint - toint; if (y == 0) return 0*x; return y;