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 c2421fa10d4273d9891323760b021d1221713c53..69dd8fe2d82be7be78715e6d4dbac90e9e6b36b2 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 c17a5573f0deef38623dbe55bbb9ec1fe63da372..94e1260137a55aeeafc461cc2bbfb594f61c6da4 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 74ef15b212e7081fd3b403d14df223896e41294d..21f46469de4b517e85fe63dae02303b76db46bc4 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 00bfb15926df7aec137ad98488aaf8063b436f5d..ce21194cd59487c03f8db6fb0f69f9120c6d5bfa 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 */