#include "libm.h"
-#if LD64
+#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double nextafterl(long double x, long double y)
{
return nextafter(x, y);
}
-#elif LD80 || LD128
+#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384
long double nextafterl(long double x, long double y)
{
volatile long double t;
if(x > 0.0 ^ x < y) { /* x -= ulp */
if (ux.bits.manl == 0) {
if ((ux.bits.manh&~LDBL_NBIT) == 0)
- ux.bits.exp -= 1;
+ ux.bits.exp--;
ux.bits.manh = (ux.bits.manh - 1) | (ux.bits.manh & LDBL_NBIT);
}
- ux.bits.manl -= 1;
+ ux.bits.manl--;
} else { /* x += ulp */
- ux.bits.manl += 1;
+ ux.bits.manl++;
if (ux.bits.manl == 0) {
ux.bits.manh = (ux.bits.manh + 1) | (ux.bits.manh & LDBL_NBIT);
if ((ux.bits.manh&~LDBL_NBIT)==0)
- ux.bits.exp += 1;
+ ux.bits.exp++;
}
}
if (ux.bits.exp == 0x7fff) /* overflow */