3 #if FLT_EVAL_METHOD==0 || FLT_EVAL_METHOD==1
4 #define EPS DBL_EPSILON
5 #elif FLT_EVAL_METHOD==2
6 #define EPS LDBL_EPSILON
8 static const double_t toint = 1/EPS;
12 union {double f; uint64_t i;} u = {x};
13 int e = u.i >> 52 & 0x7ff;
16 if (e >= 0x3ff+52 || x == 0)
18 /* y = int(x) - x, where int(x) is an integer neighbor of x */
20 y = x - toint + toint - x;
22 y = x + toint - toint - x;
23 /* special case because of non-nearest rounding modes */
26 return u.i >> 63 ? -0.0 : 1;