about summary refs log tree commit diff
path: root/sysdeps/ieee754/ldbl-96/s_llroundl.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/ieee754/ldbl-96/s_llroundl.c')
-rw-r--r--sysdeps/ieee754/ldbl-96/s_llroundl.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sysdeps/ieee754/ldbl-96/s_llroundl.c b/sysdeps/ieee754/ldbl-96/s_llroundl.c
index 8381649269..17a3ccac08 100644
--- a/sysdeps/ieee754/ldbl-96/s_llroundl.c
+++ b/sysdeps/ieee754/ldbl-96/s_llroundl.c
@@ -17,6 +17,8 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <fenv.h>
+#include <limits.h>
 #include <math.h>
 
 #include <math_private.h>
@@ -64,7 +66,14 @@ __llroundl (long double x)
 	    ++result;
 
 	  if (j0 > 31)
-	    result = (result << (j0 - 31)) | (j >> (63 - j0));
+	    {
+	      result = (result << (j0 - 31)) | (j >> (63 - j0));
+#ifdef FE_INVALID
+	      if (sign == 1 && result == LLONG_MIN)
+		/* Rounding brought the value out of range.  */
+		feraiseexcept (FE_INVALID);
+#endif
+	    }
 	}
     }
   else