about summary refs log tree commit diff
path: root/sysdeps/ieee754/ldbl-128/s_fmal.c
diff options
context:
space:
mode:
authorPaul E. Murphy <murphyp@linux.vnet.ibm.com>2016-09-02 11:01:07 -0500
committerPaul E. Murphy <murphyp@linux.vnet.ibm.com>2016-09-13 15:33:59 -0500
commit02bbfb414f367c73196e6f23fa7435a08c92449f (patch)
tree5f70a6d722dbdb1d716f6cf4b34fd7ca50e62c80 /sysdeps/ieee754/ldbl-128/s_fmal.c
parentfd37b5a78ab215ea2599250ec345e25545410bce (diff)
downloadglibc-02bbfb414f367c73196e6f23fa7435a08c92449f.tar.gz
glibc-02bbfb414f367c73196e6f23fa7435a08c92449f.tar.xz
glibc-02bbfb414f367c73196e6f23fa7435a08c92449f.zip
ldbl-128: Use L(x) macro for long double constants
This runs the attached sed script against these files using
a regex which aggressively matches long double literals
when not obviously part of a comment.

Likewise, 5 digit or less integral constants are replaced
with integer constants, excepting the two cases of 0 used
in large tables, which are also the only integral values
of the form x.0*E0L encountered within these converted
files.

Likewise, -L(x) is transformed into L(-x).

Naturally, the script has a few minor hiccups which are
more clearly remedied via the attached fixup patch.  Such
hiccups include, context-sensitive promotion to a real
type, and munging constants inside harder to detect
comment blocks.
Diffstat (limited to 'sysdeps/ieee754/ldbl-128/s_fmal.c')
-rw-r--r--sysdeps/ieee754/ldbl-128/s_fmal.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/sysdeps/ieee754/ldbl-128/s_fmal.c b/sysdeps/ieee754/ldbl-128/s_fmal.c
index df01ab7b74..eb1e27e041 100644
--- a/sysdeps/ieee754/ldbl-128/s_fmal.c
+++ b/sysdeps/ieee754/ldbl-128/s_fmal.c
@@ -75,7 +75,7 @@ __fmal (_Float128 x, _Float128 y, _Float128 z)
 	  < IEEE854_LONG_DOUBLE_BIAS - LDBL_MANT_DIG - 2)
 	{
 	  int neg = u.ieee.negative ^ v.ieee.negative;
-	  _Float128 tiny = neg ? -0x1p-16494L : 0x1p-16494L;
+	  _Float128 tiny = neg ? L(-0x1p-16494) : L(0x1p-16494);
 	  if (w.ieee.exponent >= 3)
 	    return tiny + z;
 	  /* Scaling up, adding TINY and scaling down produces the
@@ -83,7 +83,7 @@ __fmal (_Float128 x, _Float128 y, _Float128 z)
 	     TINY has no effect and in other modes double rounding is
 	     harmless.  But it may not produce required underflow
 	     exceptions.  */
-	  v.d = z * 0x1p114L + tiny;
+	  v.d = z * L(0x1p114) + tiny;
 	  if (TININESS_AFTER_ROUNDING
 	      ? v.ieee.exponent < 115
 	      : (w.ieee.exponent == 0
@@ -97,7 +97,7 @@ __fmal (_Float128 x, _Float128 y, _Float128 z)
 	      _Float128 force_underflow = x * y;
 	      math_force_eval (force_underflow);
 	    }
-	  return v.d * 0x1p-114L;
+	  return v.d * L(0x1p-114);
 	}
       if (u.ieee.exponent + v.ieee.exponent
 	  >= 0x7fff + IEEE854_LONG_DOUBLE_BIAS - LDBL_MANT_DIG)
@@ -144,7 +144,7 @@ __fmal (_Float128 x, _Float128 y, _Float128 z)
 	  if (v.ieee.exponent)
 	    v.ieee.exponent += LDBL_MANT_DIG;
 	  else
-	    v.d *= 0x1p113L;
+	    v.d *= L(0x1p113);
 	}
       else if (v.ieee.exponent >= 0x7fff - LDBL_MANT_DIG)
 	{
@@ -152,7 +152,7 @@ __fmal (_Float128 x, _Float128 y, _Float128 z)
 	  if (u.ieee.exponent)
 	    u.ieee.exponent += LDBL_MANT_DIG;
 	  else
-	    u.d *= 0x1p113L;
+	    u.d *= L(0x1p113);
 	}
       else /* if (u.ieee.exponent + v.ieee.exponent
 		  <= IEEE854_LONG_DOUBLE_BIAS + LDBL_MANT_DIG) */
@@ -166,7 +166,7 @@ __fmal (_Float128 x, _Float128 y, _Float128 z)
 	      if (w.ieee.exponent)
 		w.ieee.exponent += 2 * LDBL_MANT_DIG + 2;
 	      else
-		w.d *= 0x1p228L;
+		w.d *= L(0x1p228);
 	      adjust = -1;
 	    }
 	  /* Otherwise x * y should just affect inexact
@@ -238,7 +238,7 @@ __fmal (_Float128 x, _Float128 y, _Float128 z)
 	u.ieee.mantissa3 |= fetestexcept (FE_INEXACT) != 0;
       feupdateenv (&env);
       /* Result is a1 + u.d, scaled up.  */
-      return (a1 + u.d) * 0x1p113L;
+      return (a1 + u.d) * L(0x1p113);
     }
   else
     {
@@ -255,11 +255,11 @@ __fmal (_Float128 x, _Float128 y, _Float128 z)
       /* If a1 + u.d is exact, the only rounding happens during
 	 scaling down.  */
       if (j == 0)
-	return v.d * 0x1p-228L;
+	return v.d * L(0x1p-228);
       /* If result rounded to zero is not subnormal, no double
 	 rounding will occur.  */
       if (v.ieee.exponent > 228)
-	return (a1 + u.d) * 0x1p-228L;
+	return (a1 + u.d) * L(0x1p-228);
       /* If v.d * 0x1p-228L with round to zero is a subnormal above
 	 or equal to LDBL_MIN / 2, then v.d * 0x1p-228L shifts mantissa
 	 down just by 1 bit, which means v.ieee.mantissa3 |= j would
@@ -278,21 +278,21 @@ __fmal (_Float128 x, _Float128 y, _Float128 z)
 	    {
 	      w.d = a1 + u.d;
 	      if (w.ieee.exponent == 229)
-		return w.d * 0x1p-228L;
+		return w.d * L(0x1p-228);
 	    }
 	  /* v.ieee.mantissa3 & 2 is LSB bit of the result before rounding,
 	     v.ieee.mantissa3 & 1 is the round bit and j is our sticky
 	     bit.  */
-	  w.d = 0.0L;
+	  w.d = 0;
 	  w.ieee.mantissa3 = ((v.ieee.mantissa3 & 3) << 1) | j;
 	  w.ieee.negative = v.ieee.negative;
 	  v.ieee.mantissa3 &= ~3U;
-	  v.d *= 0x1p-228L;
-	  w.d *= 0x1p-2L;
+	  v.d *= L(0x1p-228);
+	  w.d *= L(0x1p-2);
 	  return v.d + w.d;
 	}
       v.ieee.mantissa3 |= j;
-      return v.d * 0x1p-228L;
+      return v.d * L(0x1p-228);
     }
 }
 weak_alias (__fmal, fmal)