Fix ldbl-128ibm hypotl inaccuracy for arguments with large ratio (bug 14868).
authorJoseph Myers <joseph@codesourcery.com>
Thu, 22 Nov 2012 14:57:22 +0000 (14:57 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Thu, 22 Nov 2012 14:57:22 +0000 (14:57 +0000)
ChangeLog
NEWS
math/libm-test.inc
sysdeps/ieee754/ldbl-128ibm/e_hypotl.c

index c2421fa..69dd8fe 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2012-11-22  Joseph Myers  <joseph@codesourcery.com>
 
+       [BZ #14868]
+       * sysdeps/ieee754/ldbl-128ibm/e_hypotl.c (__ieee754_hypotl):
+       Return a+b for ratio over 2**120, not 2**60.
+       * math/libm-test.inc (hypot_test): Add another test.
+
        * math/libm-test.inc (clog_test): Use
        UNDERFLOW_EXCEPTION_LDOUBLE_IBM on two tests.
        (clog10_test): Likewise.
diff --git a/NEWS b/NEWS
index c17a557..94e1260 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -21,7 +21,7 @@ Version 2.17
   14638, 14645, 14648, 14652, 14660, 14661, 14669, 14672, 14683, 14694,
   14716, 14719, 14743, 14767, 14783, 14784, 14785, 14793, 14796, 14797,
   14801, 14805, 14807, 14809, 14811, 14815, 14821, 14822, 14824, 14828,
-  14831, 14835, 14838, 14856, 14863, 14865, 14866.
+  14831, 14835, 14838, 14856, 14863, 14865, 14866, 14868.
 
 * Port to ARM AArch64 contributed by Linaro.
 
index 74ef15b..21f4646 100644 (file)
@@ -5730,6 +5730,8 @@ hypot_test (void)
 
   TEST_ff_f (hypot, 0.75L, 1.25L, 1.45773797371132511771853821938639577L);
 
+  TEST_ff_f (hypot, 1.0L, 0x1p-61L, 1.0L);
+
 #if !(defined TEST_FLOAT && defined TEST_INLINE)
   TEST_ff_f (hypot, 0x3p125L, 0x4p125L, 0x5p125L);
   TEST_ff_f (hypot, 0x1.234566p-126L, 0x1.234566p-126L, 1.891441686191081936598531534017449451173e-38L);
index 00bfb15..ce21194 100644 (file)
@@ -61,7 +61,7 @@ __ieee754_hypotl(long double x, long double y)
        if(hb > ha) {a=y;b=x;j=ha; ha=hb;hb=j;} else {a=x;b=y;}
        a = fabsl(a);   /* a <- |a| */
        b = fabsl(b);   /* b <- |b| */
-       if((ha-hb)>0x3c0000000000000LL) {return a+b;} /* x/y > 2**60 */
+       if((ha-hb)>0x780000000000000LL) {return a+b;} /* x/y > 2**120 */
        k=0;
        kld = 1.0L;
        if(ha > 0x5f30000000000000LL) { /* a>2**500 */