From 8020a808870dc6199e584562b3b64f52054359e8 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Fri, 15 May 2015 22:07:57 +0000 Subject: Fix atanhl missing underflows (bug 16352). Similar to various other bugs in this area, some atanh implementations do not raise the underflow exception for subnormal arguments, when the result is tiny and inexact. This patch forces the exception in a similar way to previous fixes. (No change in this regard is needed for the i386 implementation; special handling to force underflows in these cases will only be needed there when the spurious underflows, bug 18049, get fixed.) Tested for x86_64, x86, powerpc and mips64. [BZ #16352] * sysdeps/i386/fpu/e_atanh.S (dbl_min): New object. (__ieee754_atanh): Force underflow exception for results with small absolute value. * sysdeps/i386/fpu/e_atanhf.S (flt_min): New object. (__ieee754_atanhf): Force underflow exception for results with small absolute value. * sysdeps/ieee754/dbl-64/e_atanh.c: Include . (__ieee754_atanh): Force underflow exception for results with small absolute value. * sysdeps/ieee754/flt-32/e_atanhf.c: Include . (__ieee754_atanhf): Force underflow exception for results with small absolute value. * sysdeps/ieee754/ldbl-128/e_atanhl.c: Include . (__ieee754_atanhl): Force underflow exception for results with small absolute value. * sysdeps/ieee754/ldbl-128ibm/e_atanhl.c: Include . (__ieee754_atanhl): Force underflow exception for results with small absolute value. * sysdeps/ieee754/ldbl-96/e_atanhl.c: Include . (__ieee754_atanhl): Force underflow exception for results with small absolute value. * math/auto-libm-test-in: Do not allow missing underflow exceptions from atanh. * math/auto-libm-test-out: Regenerated. --- sysdeps/ieee754/ldbl-128/e_atanhl.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'sysdeps/ieee754/ldbl-128') diff --git a/sysdeps/ieee754/ldbl-128/e_atanhl.c b/sysdeps/ieee754/ldbl-128/e_atanhl.c index c5cceb5224..a5a7ee0712 100644 --- a/sysdeps/ieee754/ldbl-128/e_atanhl.c +++ b/sysdeps/ieee754/ldbl-128/e_atanhl.c @@ -32,6 +32,7 @@ * */ +#include #include #include @@ -57,7 +58,15 @@ __ieee754_atanhl(long double x) else return (x-x)/(x-x); } - if(ix<0x3fc60000 && (huge+x)>zero) return x; /* x < 2^-57 */ + if(ix<0x3fc60000 && (huge+x)>zero) /* x < 2^-57 */ + { + if (fabsl (x) < LDBL_MIN) + { + long double force_underflow = x * x; + math_force_eval (force_underflow); + } + return x; + } if(ix<0x3ffe0000) { /* x < 0.5 */ t = u.value+u.value; -- cgit 1.4.1