long double math fixes for LD64
[libm] / src / math / scalbnl.c
index ff5db51..0ed5b7f 100644 (file)
 
 #include "libm.h"
 
-#if LD64
+#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
 long double scalbnl(long double x, int n)
 {
        return scalbn(x, n);
 }
-#elif LD80 || LD128
+#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384
 static const long double
 huge = 0x1p16000L,
 tiny = 0x1p-16000L;
@@ -38,11 +38,11 @@ long double scalbnl(long double x, int n)
        if (k == 0) {                      /* 0 or subnormal x */
                if ((u.bits.manh|u.bits.manl) == 0)  /* +-0 */
                        return x;
-               u.e *= 0x1p+128;
+               u.e *= 0x1p128;
                k = u.bits.exp - 128;
                if (n < -50000)
                        return tiny*x;  /*underflow*/
-               }
+       }
        if (k == 0x7fff)                   /* NaN or Inf */
                return x + x;
        k = k + n;