diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2018-12-27 18:56:13 +0000 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2018-12-27 18:57:13 +0000 |
commit | 82dd75a7f436a19047325d62182590c9f9e23a78 (patch) | |
tree | 60ca20c8cf2b0d178d84725c0715471f76df97e1 /sysdeps/ieee754/ldbl-128ibm/s_rintl.c | |
parent | 0bbb676a2342367c4e52b35e890f24667dabb348 (diff) | |
parent | 963c37d5c0eb62b38f8764b23931c0dcdd497a13 (diff) |
Merge commit 'refs/top-bases/t/tls' into t/tls
Diffstat (limited to 'sysdeps/ieee754/ldbl-128ibm/s_rintl.c')
-rw-r--r-- | sysdeps/ieee754/ldbl-128ibm/s_rintl.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_rintl.c b/sysdeps/ieee754/ldbl-128ibm/s_rintl.c index 8c51ded1d6..f003609d95 100644 --- a/sysdeps/ieee754/ldbl-128ibm/s_rintl.c +++ b/sysdeps/ieee754/ldbl-128ibm/s_rintl.c @@ -1,6 +1,6 @@ /* Round to int long double floating-point values. IBM extended format long double version. - Copyright (C) 2006-2016 Free Software Foundation, Inc. + Copyright (C) 2006-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -22,10 +22,17 @@ #include <math.h> #include <fenv.h> +#include <math-barriers.h> +#include <math_private.h> #include <math_ldbl_opt.h> #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 +51,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,8 +114,16 @@ __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 } + else + /* Quiet signaling NaN arguments. */ + xh += xh; return ldbl_pack (xh, xl); } |