This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Fix ldbl-128 expl missing underflows (bug 18586) [committed]
- From: Joseph Myers <joseph at codesourcery dot com>
- To: <libc-alpha at sourceware dot org>
- Date: Wed, 24 Jun 2015 15:12:54 +0000
- Subject: Fix ldbl-128 expl missing underflows (bug 18586) [committed]
- Authentication-results: sourceware.org; auth=none
Similar to various other bugs in this area, the ldbl-128 expl
implementation does not raise the underflow exception for all
subnormal results, if the scaling down is exact although the actual
result is inexact. This patch fixes this by forcing the exception in
this case (the tests that failed before and pass after the test are
already in the testsuite).
Tested for mips64. Committed.
2015-06-24 Joseph Myers <joseph@codesourcery.com>
[BZ #18586]
* sysdeps/ieee754/ldbl-128/e_expl.c (__ieee754_expl): Force
underflow exception for small results.
diff --git a/sysdeps/ieee754/ldbl-128/e_expl.c b/sysdeps/ieee754/ldbl-128/e_expl.c
index b4b7896..2417e7f 100644
--- a/sysdeps/ieee754/ldbl-128/e_expl.c
+++ b/sysdeps/ieee754/ldbl-128/e_expl.c
@@ -230,7 +230,15 @@ __ieee754_expl (long double x)
if (!unsafe)
return result;
else
- return result * scale_u.d;
+ {
+ result *= scale_u.d;
+ if (result < LDBL_MIN)
+ {
+ long double force_underflow = result * result;
+ math_force_eval (force_underflow);
+ }
+ return result;
+ }
}
/* Exceptional cases: */
else if (isless (x, himark))
--
Joseph S. Myers
joseph@codesourcery.com