about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--NEWS4
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c4
3 files changed, 10 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index fd281993c8..5053bf31d5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2015-09-15  Joseph Myers  <joseph@codesourcery.com>
 
+	[BZ #18857]
+	* sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c (__nearbyintl): Just
+	return non-finite argument without doing ordered comparisons on
+	it.
+
 	[BZ #16296]
 	* math/fenv.h (fegetround): Use __attribute_pure__.
 	* include/fenv.h (__fegetround): Likewise.
diff --git a/NEWS b/NEWS
index b35d5424d3..5db57a2e9a 100644
--- a/NEWS
+++ b/NEWS
@@ -13,8 +13,8 @@ Version 2.23
   16519, 16520, 16521, 16734, 16973, 16985, 17787, 17905, 18084, 18086,
   18240, 18265, 18370, 18421, 18480, 18525, 18595, 18610, 18618, 18647,
   18661, 18674, 18675, 18681, 18757, 18778, 18781, 18787, 18789, 18790,
-  18795, 18796, 18820, 18823, 18824, 18863, 18870, 18873, 18875, 18887,
-  18921, 18952, 18961, 18966.
+  18795, 18796, 18820, 18823, 18824, 18857, 18863, 18870, 18873, 18875,
+  18887, 18921, 18952, 18961, 18966.
 
 * 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-128ibm/s_nearbyintl.c b/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c
index 5f92a5fee8..99f47473b9 100644
--- a/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c
@@ -36,7 +36,9 @@ __nearbyintl (long double x)
   union ibm_extended_long_double u;
   u.ld = x;
 
-  if (fabs (u.d[0].d) < TWO52)
+  if (!isfinite (u.d[0].d))
+    return x;
+  else if (fabs (u.d[0].d) < TWO52)
     {
       double xh = u.d[0].d;
       double high = u.d[0].d;