]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix ldbl-128 expl missing underflows (bug 18586).
authorJoseph Myers <joseph@codesourcery.com>
Wed, 24 Jun 2015 15:12:03 +0000 (15:12 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Wed, 24 Jun 2015 15:12:03 +0000 (15:12 +0000)
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.

[BZ #18586]
* sysdeps/ieee754/ldbl-128/e_expl.c (__ieee754_expl): Force
underflow exception for small results.

ChangeLog
NEWS
sysdeps/ieee754/ldbl-128/e_expl.c

index b5e19b181780cffb293c4879610c9318c341adc2..b103dcdc2696c37740eb8d4f1ddb817b4a987c2b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+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.
+
 2015-06-24  Andrew Senkevich  <andrew.senkevich@intel.com>
 
        * sysdeps/x86_64/fpu/Makefile (libmvec-support): Fixed files list.
diff --git a/NEWS b/NEWS
index aacd894c82a09e5ec9d16e00982a0c750bbce077..e8c84b88e03a88514a17ae0ff27798e02cfa9bad 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -24,7 +24,7 @@ Version 2.22
   18444, 18468, 18469, 18470, 18479, 18483, 18495, 18496, 18497, 18498,
   18507, 18512, 18513, 18519, 18520, 18522, 18527, 18528, 18529, 18530,
   18532, 18533, 18534, 18536, 18539, 18540, 18542, 18544, 18545, 18546,
-  18547, 18553, 18558, 18569, 18583.
+  18547, 18553, 18558, 18569, 18583, 18586.
 
 * Cache information can be queried via sysconf() function on s390 e.g. with
   _SC_LEVEL1_ICACHE_SIZE as argument.
index b4b789658a81811e087ad0c4d39c7949625df226..1cd095cb7706ee9bdf24dc1a32fa9ca099c2acd2 100644 (file)
@@ -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))