about summary refs log tree commit diff
path: root/sysdeps/ieee754/ldbl-96/s_ceill.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/ieee754/ldbl-96/s_ceill.c')
-rw-r--r--sysdeps/ieee754/ldbl-96/s_ceill.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sysdeps/ieee754/ldbl-96/s_ceill.c b/sysdeps/ieee754/ldbl-96/s_ceill.c
index d53f3954ba..b99097f812 100644
--- a/sysdeps/ieee754/ldbl-96/s_ceill.c
+++ b/sysdeps/ieee754/ldbl-96/s_ceill.c
@@ -59,8 +59,13 @@ static long double huge = 1.0e4930;
 		if(((i0&i)|i1)==0) return x; /* x is integral */
 		if(huge+x>0.0) {	/* raise inexact flag */
 		    if(sx==0) {
-			if (j0>0) i0 += (0x80000000)>>j0;
-			else ++se;
+			if (j0>0 && (i0+(0x80000000>>j0))>i0)
+			  i0+=0x80000000>>j0;
+			else
+			  {
+			    i = 0x7fffffff;
+			    ++se;
+			  }
 		    }
 		    i0 &= (~i); i1=0;
 		}