summaryrefslogtreecommitdiff
path: root/libc/sysdeps/ieee754
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/ieee754')
-rw-r--r--libc/sysdeps/ieee754/dbl-64/s_nearbyint.c2
-rw-r--r--libc/sysdeps/ieee754/flt-32/s_nearbyintf.c2
-rw-r--r--libc/sysdeps/ieee754/ldbl-128/s_nearbyintl.c2
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c5
-rw-r--r--libc/sysdeps/ieee754/ldbl-96/e_hypotl.c2
-rw-r--r--libc/sysdeps/ieee754/ldbl-96/s_nearbyintl.c2
6 files changed, 14 insertions, 1 deletions
diff --git a/libc/sysdeps/ieee754/dbl-64/s_nearbyint.c b/libc/sysdeps/ieee754/dbl-64/s_nearbyint.c
index eb40c298b..5017f471d 100644
--- a/libc/sysdeps/ieee754/dbl-64/s_nearbyint.c
+++ b/libc/sysdeps/ieee754/dbl-64/s_nearbyint.c
@@ -47,6 +47,7 @@ double __nearbyint(double x)
libc_feholdexcept (&env);
w = TWO52[sx]+x;
t = w-TWO52[sx];
+ math_force_eval (t);
libc_fesetenv (&env);
GET_HIGH_WORD(i0,t);
SET_HIGH_WORD(t,(i0&0x7fffffff)|(sx<<31));
@@ -59,6 +60,7 @@ double __nearbyint(double x)
libc_feholdexcept (&env);
w = TWO52[sx]+x;
t = w-TWO52[sx];
+ math_force_eval (t);
libc_fesetenv (&env);
return t;
}
diff --git a/libc/sysdeps/ieee754/flt-32/s_nearbyintf.c b/libc/sysdeps/ieee754/flt-32/s_nearbyintf.c
index 48debadde..5aebefafc 100644
--- a/libc/sysdeps/ieee754/flt-32/s_nearbyintf.c
+++ b/libc/sysdeps/ieee754/flt-32/s_nearbyintf.c
@@ -39,6 +39,7 @@ __nearbyintf(float x)
libc_feholdexceptf (&env);
w = TWO23[sx]+x;
t = w-TWO23[sx];
+ math_force_eval (t);
libc_fesetenvf (&env);
GET_FLOAT_WORD(i0,t);
SET_FLOAT_WORD(t,(i0&0x7fffffff)|(sx<<31));
@@ -51,6 +52,7 @@ __nearbyintf(float x)
libc_feholdexceptf (&env);
w = TWO23[sx]+x;
t = w-TWO23[sx];
+ math_force_eval (t);
libc_fesetenvf (&env);
return t;
}
diff --git a/libc/sysdeps/ieee754/ldbl-128/s_nearbyintl.c b/libc/sysdeps/ieee754/ldbl-128/s_nearbyintl.c
index d2afc10a5..2017c0420 100644
--- a/libc/sysdeps/ieee754/ldbl-128/s_nearbyintl.c
+++ b/libc/sysdeps/ieee754/ldbl-128/s_nearbyintl.c
@@ -47,6 +47,7 @@ long double __nearbyintl(long double x)
feholdexcept (&env);
w = TWO112[sx]+x;
t = w-TWO112[sx];
+ math_force_eval (t);
fesetenv (&env);
GET_LDOUBLE_MSW64(i0,t);
SET_LDOUBLE_MSW64(t,(i0&0x7fffffffffffffffLL)|(sx<<63));
@@ -59,6 +60,7 @@ long double __nearbyintl(long double x)
feholdexcept (&env);
w = TWO112[sx]+x;
t = w-TWO112[sx];
+ math_force_eval (t);
fesetenv (&env);
return t;
}
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c b/libc/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c
index b654bf586..bfcd11044 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c
@@ -21,6 +21,7 @@
when it's coded in C. */
#include <math.h>
+#include <math_private.h>
#include <fenv.h>
#include <math_ldbl_opt.h>
#include <float.h>
@@ -53,6 +54,8 @@ __nearbyintl (long double x)
}
u.dd[0] = high;
u.dd[1] = 0.0;
+ math_force_eval (u.dd[0]);
+ math_force_eval (u.dd[1]);
fesetenv (&env);
}
else if (fabs (u.dd[1]) < TWO52 && u.dd[1] != 0.0)
@@ -109,6 +112,8 @@ __nearbyintl (long double x)
}
u.dd[0] = high + low;
u.dd[1] = high - u.dd[0] + low;
+ math_force_eval (u.dd[0]);
+ math_force_eval (u.dd[1]);
fesetenv (&env);
}
diff --git a/libc/sysdeps/ieee754/ldbl-96/e_hypotl.c b/libc/sysdeps/ieee754/ldbl-96/e_hypotl.c
index 306f92924..789548884 100644
--- a/libc/sysdeps/ieee754/ldbl-96/e_hypotl.c
+++ b/libc/sysdeps/ieee754/ldbl-96/e_hypotl.c
@@ -85,7 +85,7 @@ long double __ieee754_hypotl(long double x, long double y)
u_int32_t high,low;
GET_LDOUBLE_WORDS(exp,high,low,b);
if((high|low)==0) return a;
- SET_LDOUBLE_WORDS(t1, 0x7ffd, 0, 0); /* t1=2^16382 */
+ SET_LDOUBLE_WORDS(t1, 0x7ffd, 0x80000000, 0); /* t1=2^16382 */
b *= t1;
a *= t1;
k -= 16382;
diff --git a/libc/sysdeps/ieee754/ldbl-96/s_nearbyintl.c b/libc/sysdeps/ieee754/ldbl-96/s_nearbyintl.c
index ed9836c87..c1d77f0c0 100644
--- a/libc/sysdeps/ieee754/ldbl-96/s_nearbyintl.c
+++ b/libc/sysdeps/ieee754/ldbl-96/s_nearbyintl.c
@@ -54,6 +54,7 @@ long double __nearbyintl(long double x)
feholdexcept (&env);
w = TWO63[sx]+x;
t = w-TWO63[sx];
+ math_force_eval (t);
fesetenv (&env);
GET_LDOUBLE_EXP(i0,t);
SET_LDOUBLE_EXP(t,(i0&0x7fff)|(sx<<15));
@@ -80,6 +81,7 @@ long double __nearbyintl(long double x)
feholdexcept (&env);
w = TWO63[sx]+x;
t = w-TWO63[sx];
+ math_force_eval (t);
fesetenv (&env);
return t;
}