about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--NEWS2
-rw-r--r--sysdeps/ieee754/ldbl-128/s_lrintl.c24
-rw-r--r--sysdeps/ieee754/ldbl-128/s_lroundl.c20
4 files changed, 30 insertions, 23 deletions
diff --git a/ChangeLog b/ChangeLog
index e1761b946b..1f461c3392 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2015-10-07  Joseph Myers  <joseph@codesourcery.com>
+
+	[BZ #19085]
+	* sysdeps/ieee754/ldbl-128/s_lrintl.c (__lrintl): Move test for
+	exponent below 48 inside case for non-overflowing exponent.
+	* sysdeps/ieee754/ldbl-128/s_lroundl.c (__lroundl): Likewise.
+
 2015-10-07  Florian Weimer  <fweimer@redhat.com>
 
 	* iconvdata/cp737.h (from_idx): Add const.
diff --git a/NEWS b/NEWS
index a0a91b5cd9..30284ba6a3 100644
--- a/NEWS
+++ b/NEWS
@@ -18,7 +18,7 @@ Version 2.23
   18820, 18823, 18824, 18825, 18857, 18863, 18870, 18872, 18873, 18875,
   18887, 18921, 18951, 18952, 18956, 18961, 18966, 18967, 18969, 18970,
   18977, 18980, 18981, 18985, 19003, 19012, 19016, 19018, 19032, 19046,
-  19049, 19050, 19059, 19071, 19076, 19077, 19078, 19079.
+  19049, 19050, 19059, 19071, 19076, 19077, 19078, 19079, 19085.
 
 * The obsolete header <regexp.h> has been removed.  Programs that require
   this header must be updated to use <regex.h> instead.
diff --git a/sysdeps/ieee754/ldbl-128/s_lrintl.c b/sysdeps/ieee754/ldbl-128/s_lrintl.c
index b0e0cfc16b..d0b0aeb5c9 100644
--- a/sysdeps/ieee754/ldbl-128/s_lrintl.c
+++ b/sysdeps/ieee754/ldbl-128/s_lrintl.c
@@ -45,20 +45,20 @@ __lrintl (long double x)
   i0 &= 0x0000ffffffffffffLL;
   i0 |= 0x0001000000000000LL;
 
-  if (j0 < 48)
+  if (j0 < (int32_t) (8 * sizeof (long int)) - 1)
     {
-      w = two112[sx] + x;
-      t = w - two112[sx];
-      GET_LDOUBLE_WORDS64 (i0, i1, t);
-      j0 = ((i0 >> 48) & 0x7fff) - 0x3fff;
-      i0 &= 0x0000ffffffffffffLL;
-      i0 |= 0x0001000000000000LL;
+      if (j0 < 48)
+	{
+	  w = two112[sx] + x;
+	  t = w - two112[sx];
+	  GET_LDOUBLE_WORDS64 (i0, i1, t);
+	  j0 = ((i0 >> 48) & 0x7fff) - 0x3fff;
+	  i0 &= 0x0000ffffffffffffLL;
+	  i0 |= 0x0001000000000000LL;
 
-      result = (j0 < 0 ? 0 : i0 >> (48 - j0));
-    }
-  else if (j0 < (int32_t) (8 * sizeof (long int)) - 1)
-    {
-      if (j0 >= 112)
+	  result = (j0 < 0 ? 0 : i0 >> (48 - j0));
+	}
+      else if (j0 >= 112)
 	result = ((long int) i0 << (j0 - 48)) | (i1 << (j0 - 112));
       else
 	{
diff --git a/sysdeps/ieee754/ldbl-128/s_lroundl.c b/sysdeps/ieee754/ldbl-128/s_lroundl.c
index 8421609676..64b285e291 100644
--- a/sysdeps/ieee754/ldbl-128/s_lroundl.c
+++ b/sysdeps/ieee754/ldbl-128/s_lroundl.c
@@ -37,19 +37,19 @@ __lroundl (long double x)
   i0 &= 0x0000ffffffffffffLL;
   i0 |= 0x0001000000000000LL;
 
-  if (j0 < 48)
+  if (j0 < (int32_t) (8 * sizeof (long int)) - 1)
     {
-      if (j0 < 0)
-	return j0 < -1 ? 0 : sign;
-      else
+      if (j0 < 48)
 	{
-	  i0 += 0x0000800000000000LL >> j0;
-	  result = i0 >> (48 - j0);
+	  if (j0 < 0)
+	    return j0 < -1 ? 0 : sign;
+	  else
+	    {
+	      i0 += 0x0000800000000000LL >> j0;
+	      result = i0 >> (48 - j0);
+	    }
 	}
-    }
-  else if (j0 < (int32_t) (8 * sizeof (long int)) - 1)
-    {
-      if (j0 >= 112)
+      else if (j0 >= 112)
 	result = ((long int) i0 << (j0 - 48)) | (i1 << (j0 - 112));
       else
 	{