if (j0 < 0) {
/* raise inexact if x != 0 */
if (huge+x > 0.0) {
- /* return 0*sign(x) if |x|<1 */
if (i0 < 0) {
i0 = 0x80000000;
i1=0;
}
}
} else {
- i = (0x000fffff)>>j0;
+ i = 0x000fffff>>j0;
if (((i0&i)|i1) == 0) /* x is integral */
return x;
/* raise inexact flag */
if (j0 < 0) {
/* raise inexact if x != 0 */
if (huge+x > 0.0f) {
- /* return 0*sign(x) if |x|<1 */
if (i0 < 0)
i0 = 0x80000000;
else if(i0 != 0)
static const long double huge = 1.0e300;
-long double
-ceill(long double x)
+long double ceill(long double x)
{
union IEEEl2bits u = { .e = x };
int e = u.bits.exp - LDBL_MAX_EXP + 1;
if (i0 < 0)
i0 += 0x00100000>>j0;
i0 &= ~i;
- i1=0;
+ i1 = 0;
}
}
} else if (j0 > 51) {
else
return x; /* x is integral */
} else {
- i = ((uint32_t)(0xffffffff))>>(j0-20);
+ i = (uint32_t)0xffffffff>>(j0-20);
if ((i1&i) == 0)
return x; /* x is integral */
/* raise inexact flag */
if (huge+x > 0.0) {
if (i0 < 0) {
if (j0 == 20)
- i0+=1;
+ i0++;
else {
j = i1+(1<<(52-j0));
if (j < i1)
- i0 += 1; /* got a carry */
+ i0++; /* got a carry */
i1 = j;
}
}
if (huge + x > 0.0)
u.bits.manl &= ~m;
}
- return (u.e);
+ return u.e;
}
#endif