about summary refs log tree commit diff
path: root/sysdeps/ieee754/ldbl-128/s_llrintl.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/ieee754/ldbl-128/s_llrintl.c')
-rw-r--r--sysdeps/ieee754/ldbl-128/s_llrintl.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sysdeps/ieee754/ldbl-128/s_llrintl.c b/sysdeps/ieee754/ldbl-128/s_llrintl.c
index 445cde5b2e..84fc576ab6 100644
--- a/sysdeps/ieee754/ldbl-128/s_llrintl.c
+++ b/sysdeps/ieee754/ldbl-128/s_llrintl.c
@@ -24,6 +24,7 @@
 #include <math.h>
 
 #include <math_private.h>
+#include <fix-fp-int-convert-overflow.h>
 
 static const long double two112[2] =
 {
@@ -91,6 +92,12 @@ __llrintl (long double x)
 	  feraiseexcept (t == LLONG_MIN ? FE_INEXACT : FE_INVALID);
 	  return LLONG_MIN;
 	}
+      else if (FIX_LDBL_LLONG_CONVERT_OVERFLOW && x != (long double) LLONG_MIN)
+	{
+	  feraiseexcept (FE_INVALID);
+	  return sx == 0 ? LLONG_MAX : LLONG_MIN;
+	}
+
 #endif
       return (long long int) x;
     }