aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/ieee754/ldbl-128ibm/s_rintl.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/ieee754/ldbl-128ibm/s_rintl.c')
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_rintl.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_rintl.c b/sysdeps/ieee754/ldbl-128ibm/s_rintl.c
index 8c51ded..e4af01c 100644
--- a/sysdeps/ieee754/ldbl-128ibm/s_rintl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/s_rintl.c
@@ -26,6 +26,11 @@
#include <float.h>
#include <ieee754.h>
+#ifdef USE_AS_NEARBYINTL
+# define rintl nearbyintl
+# define __rintl __nearbyintl
+#endif
+
long double
__rintl (long double x)
@@ -44,7 +49,11 @@ __rintl (long double x)
/* Long double arithmetic, including the canonicalisation below,
only works in round-to-nearest mode. */
+#ifdef USE_AS_NEARBYINTL
+ SET_RESTORE_ROUND_NOEX (FE_TONEAREST);
+#else
fesetround (FE_TONEAREST);
+#endif
/* Convert the high double to integer. */
orig_xh = xh;
@@ -103,7 +112,12 @@ __rintl (long double x)
if (orig_xh < 0.0)
xh = -__builtin_fabs (xh);
+#ifdef USE_AS_NEARBYINTL
+ math_force_eval (xh);
+ math_force_eval (xl);
+#else
fesetround (save_round);
+#endif
}
return ldbl_pack (xh, xl);