From d7826aa149d2e85128a7ecf8fadc950ab9fe7a22 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 25 Oct 2011 10:52:45 -0400 Subject: Use math_force_eval in more places --- sysdeps/ieee754/ldbl-96/e_atanhl.c | 5 +++- sysdeps/ieee754/ldbl-96/e_j0l.c | 13 +++++---- sysdeps/ieee754/ldbl-96/s_roundl.c | 55 +++++++++++++++++--------------------- 3 files changed, 35 insertions(+), 38 deletions(-) (limited to 'sysdeps/ieee754/ldbl-96') diff --git a/sysdeps/ieee754/ldbl-96/e_atanhl.c b/sysdeps/ieee754/ldbl-96/e_atanhl.c index 5a2aebef3e..0f3c7fb596 100644 --- a/sysdeps/ieee754/ldbl-96/e_atanhl.c +++ b/sysdeps/ieee754/ldbl-96/e_atanhl.c @@ -52,7 +52,10 @@ __ieee754_atanhl(long double x) return (x-x)/(x-x); if(ix==0x3fff) return x/zero; - if(ix<0x3fe3&&(huge+x)>zero) return x; /* x<2**-28 */ + if(ix<0x3fe3) { + math_force_eval(huge+x); + return x; /* x<2**-28 */ + } SET_LDOUBLE_EXP(x,ix); if(ix<0x3ffe) { /* x < 0.5 */ t = x+x; diff --git a/sysdeps/ieee754/ldbl-96/e_j0l.c b/sysdeps/ieee754/ldbl-96/e_j0l.c index ce1f0f7563..abf4f109f8 100644 --- a/sysdeps/ieee754/ldbl-96/e_j0l.c +++ b/sysdeps/ieee754/ldbl-96/e_j0l.c @@ -144,13 +144,12 @@ __ieee754_j0l (long double x) } if (__builtin_expect (ix < 0x3fef, 0)) /* |x| < 2**-16 */ { - if (huge + x > one) - { /* raise inexact if x != 0 */ - if (ix < 0x3fde) /* |x| < 2^-33 */ - return one; - else - return one - 0.25 * x * x; - } + /* raise inexact if x != 0 */ + math_force_eval (huge + x); + if (ix < 0x3fde) /* |x| < 2^-33 */ + return one; + else + return one - 0.25 * x * x; } z = x * x; r = z * (R[0] + z * (R[1] + z * (R[2] + z * (R[3] + z * R[4])))); diff --git a/sysdeps/ieee754/ldbl-96/s_roundl.c b/sysdeps/ieee754/ldbl-96/s_roundl.c index f1399cc209..833ae0d786 100644 --- a/sysdeps/ieee754/ldbl-96/s_roundl.c +++ b/sysdeps/ieee754/ldbl-96/s_roundl.c @@ -1,5 +1,5 @@ /* Round long double to integer away from zero. - Copyright (C) 1997, 2007 Free Software Foundation, Inc. + Copyright (C) 1997, 2007, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -38,15 +38,13 @@ __roundl (long double x) { if (j0 < 0) { - if (huge + x > 0.0) + math_force_eval (huge + x); + se &= 0x8000; + i0 = i1 = 0; + if (j0 == -1) { - se &= 0x8000; - i0 = i1 = 0; - if (j0 == -1) - { - se |= 0x3fff; - i0 = 0x80000000; - } + se |= 0x3fff; + i0 = 0x80000000; } } else @@ -55,15 +53,14 @@ __roundl (long double x) if (((i0 & i) | i1) == 0) /* X is integral. */ return x; - if (huge + x > 0.0) - { - /* Raise inexact if x != 0. */ - u_int32_t j = i0 + (0x40000000 >> j0); - if (j < i0) - se += 1; - i0 = (j & ~i) | 0x80000000; - i1 = 0; - } + + /* Raise inexact if x != 0. */ + math_force_eval (huge + x); + u_int32_t j = i0 + (0x40000000 >> j0); + if (j < i0) + se += 1; + i0 = (j & ~i) | 0x80000000; + i1 = 0; } } else if (j0 > 62) @@ -81,22 +78,20 @@ __roundl (long double x) /* X is integral. */ return x; - if (huge + x > 0.0) + math_force_eval (huge + x); + /* Raise inexact if x != 0. */ + u_int32_t j = i1 + (1 << (62 - j0)); + if (j < i1) { - /* Raise inexact if x != 0. */ - u_int32_t j = i1 + (1 << (62 - j0)); - if (j < i1) + u_int32_t k = i0 + 1; + if (k < i0) { - u_int32_t k = i0 + 1; - if (k < i0) - { - se += 1; - k |= 0x80000000; - } - i0 = k; + se += 1; + k |= 0x80000000; } - i1 = j; + i0 = k; } + i1 = j; i1 &= ~i; } -- cgit 1.4.1