about summary refs log tree commit diff
path: root/sysdeps/ieee754/ldbl-128/s_nexttowardf.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/ieee754/ldbl-128/s_nexttowardf.c')
-rw-r--r--sysdeps/ieee754/ldbl-128/s_nexttowardf.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sysdeps/ieee754/ldbl-128/s_nexttowardf.c b/sysdeps/ieee754/ldbl-128/s_nexttowardf.c
index 9c9c7e5283..8703359d4f 100644
--- a/sysdeps/ieee754/ldbl-128/s_nexttowardf.c
+++ b/sysdeps/ieee754/ldbl-128/s_nexttowardf.c
@@ -18,6 +18,7 @@
 static char rcsid[] = "$NetBSD: $";
 #endif
 
+#include <errno.h>
 #include <math.h>
 #include <math_private.h>
 
@@ -62,10 +63,12 @@ float __nexttowardf(float x, long double y)
 	if(hy>=0x7f800000) {
 	  float u = x+x;		/* overflow  */
 	  math_force_eval (u);
+	  __set_errno (ERANGE);
 	}
 	if(hy<0x00800000) {
 	    float u = x*x;		/* underflow */
 	    math_force_eval (u);	/* raise underflow flag */
+	    __set_errno (ERANGE);
 	}
 	SET_FLOAT_WORD(x,hx);
 	return x;