aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/ieee754/ldbl-96/s_nexttoward.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/ieee754/ldbl-96/s_nexttoward.c')
-rw-r--r--sysdeps/ieee754/ldbl-96/s_nexttoward.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sysdeps/ieee754/ldbl-96/s_nexttoward.c b/sysdeps/ieee754/ldbl-96/s_nexttoward.c
index c29bcd146d..8b273af929 100644
--- a/sysdeps/ieee754/ldbl-96/s_nexttoward.c
+++ b/sysdeps/ieee754/ldbl-96/s_nexttoward.c
@@ -27,6 +27,7 @@ static char rcsid[] = "$NetBSD: $";
#include "math.h"
#include "math_private.h"
+#include <float.h>
#ifdef __STDC__
double __nexttoward(double x, long double y)
@@ -80,7 +81,13 @@ static char rcsid[] = "$NetBSD: $";
}
}
hy = hx&0x7ff00000;
- if(hy>=0x7ff00000) return x+x; /* overflow */
+ if(hy>=0x7ff00000) {
+ x = x+x; /* overflow */
+ if (FLT_EVAL_METHOD != 0 && FLT_EVAL_METHOD != 1)
+ /* Force conversion to float. */
+ asm ("" : "=m"(x) : "m"(x));
+ return x;
+ }
if(hy<0x00100000) { /* underflow */
double x2 = x*x;
if(x2!=x) { /* raise underflow flag */