From: Joseph Myers Date: Thu, 10 Oct 2013 19:11:30 +0000 (+0000) Subject: Avoid ordered comparisons of NaNs in ldbl-128ibm acosl and asinl. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4a3abd22ecbda2d7b718b133fae2d2abfdfab614;p=thirdparty%2Fglibc.git Avoid ordered comparisons of NaNs in ldbl-128ibm acosl and asinl. --- diff --git a/ChangeLog b/ChangeLog index 28960dc4a41..3805278d939 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2013-10-10 Joseph Myers + + * sysdeps/ieee754/ldbl-128ibm/e_acosl.c (__ieee754_acosl): Check + for NaNs before doing comparisons on argument. + * sysdeps/ieee754/ldbl-128ibm/e_asinl.c (__ieee754_asinl): + Likewise. + 2013-10-04 Anton Blanchard Alistair Popple Alan Modra diff --git a/sysdeps/ieee754/ldbl-128ibm/e_acosl.c b/sysdeps/ieee754/ldbl-128ibm/e_acosl.c index 5d2af30346b..4b612815f86 100644 --- a/sysdeps/ieee754/ldbl-128ibm/e_acosl.c +++ b/sysdeps/ieee754/ldbl-128ibm/e_acosl.c @@ -151,11 +151,13 @@ static const long double long double __ieee754_acosl (long double x) { - long double z, r, w, p, q, s, t, f2; + long double a, z, r, w, p, q, s, t, f2; ieee854_long_double_shape_type u; - u.value = __builtin_fabsl (x); - if (u.value == 1.0L) + if (__glibc_unlikely (__isnanl (x))) + return x + x; + a = __builtin_fabsl (x); + if (a == 1.0L) { if (x > 0.0L) return 0.0; /* acos(1) = 0 */ diff --git a/sysdeps/ieee754/ldbl-128ibm/e_asinl.c b/sysdeps/ieee754/ldbl-128ibm/e_asinl.c index b395439495e..bb69402fbc1 100644 --- a/sysdeps/ieee754/ldbl-128ibm/e_asinl.c +++ b/sysdeps/ieee754/ldbl-128ibm/e_asinl.c @@ -135,6 +135,8 @@ __ieee754_asinl (long double x) int flag; ieee854_long_double_shape_type u; + if (__glibc_unlikely (__isnanl (x))) + return x + x; flag = 0; u.value = __builtin_fabsl (x); if (u.value == 1.0L) /* |x|>= 1 */