about summary refs log tree commit diff
path: root/sysdeps/ieee754/ldbl-128/s_nexttoward.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/ieee754/ldbl-128/s_nexttoward.c')
-rw-r--r--sysdeps/ieee754/ldbl-128/s_nexttoward.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sysdeps/ieee754/ldbl-128/s_nexttoward.c b/sysdeps/ieee754/ldbl-128/s_nexttoward.c
index 2ee7a1be5c..4343fe83f8 100644
--- a/sysdeps/ieee754/ldbl-128/s_nexttoward.c
+++ b/sysdeps/ieee754/ldbl-128/s_nexttoward.c
@@ -25,6 +25,7 @@ static char rcsid[] = "$NetBSD: $";
  *   Special cases:
  */
 
+#include <errno.h>
 #include <math.h>
 #include <math_private.h>
 #include <float.h>
@@ -75,10 +76,12 @@ double __nexttoward(double x, long double y)
 	if(hy>=0x7ff00000) {
 	  double u = x+x;			/* overflow  */
 	  math_force_eval (u);
+	  __set_errno (ERANGE);
 	}
 	if(hy<0x00100000) {
 	    double u = x*x;			/* underflow */
 	    math_force_eval (u);		/* raise underflow flag */
+	    __set_errno (ERANGE);
 	}
 	INSERT_WORDS(x,hx,lx);
 	return x;