summaryrefslogtreecommitdiff
path: root/sysdeps/generic/s_nexttowardf.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/generic/s_nexttowardf.c')
-rw-r--r--sysdeps/generic/s_nexttowardf.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sysdeps/generic/s_nexttowardf.c b/sysdeps/generic/s_nexttowardf.c
index 1b3a2536ba..4f502c210e 100644
--- a/sysdeps/generic/s_nexttowardf.c
+++ b/sysdeps/generic/s_nexttowardf.c
@@ -22,6 +22,7 @@
#include "math.h"
#include "math_private.h"
+#include <float.h>
#ifdef __STDC__
float __nexttowardf(float x, long double y)
@@ -65,7 +66,13 @@
hx += 1;
}
hy = hx&0x7f800000;
- if(hy>=0x7f800000) return x+x; /* overflow */
+ if(hy>=0x7f800000) {
+ x = x+x; /* overflow */
+ if (FLT_EVAL_METHOD != 0)
+ /* Force conversion to float. */
+ asm ("" : "=m"(x) : "m"(x));
+ return x;
+ }
if(hy<0x00800000) { /* underflow */
float x2 = x*x;
if(x2!=x) { /* raise underflow flag */