about summary refs log tree commit diff
path: root/sysdeps/ieee754/ldbl-96
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/ieee754/ldbl-96')
-rw-r--r--sysdeps/ieee754/ldbl-96/s_ceill.c9
-rw-r--r--sysdeps/ieee754/ldbl-96/s_floorl.c9
2 files changed, 14 insertions, 4 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;
 		}
diff --git a/sysdeps/ieee754/ldbl-96/s_floorl.c b/sysdeps/ieee754/ldbl-96/s_floorl.c
index fb0c37e801..7115dbad9b 100644
--- a/sysdeps/ieee754/ldbl-96/s_floorl.c
+++ b/sysdeps/ieee754/ldbl-96/s_floorl.c
@@ -60,8 +60,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) {
-			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;
 		}