aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2012-11-22 14:57:22 +0000
committerJoseph Myers <joseph@codesourcery.com>2012-11-22 14:57:22 +0000
commit8e27e3cc453849158e069dbed0eea7b8113ab8ff (patch)
tree4f4b8ecd14b90dc0f283fdc002d2cbef94cba7e2
parentc9c0279bcb2bd0871e9a4affbab3244389de1353 (diff)
downloadglibc-8e27e3cc453849158e069dbed0eea7b8113ab8ff.zip
glibc-8e27e3cc453849158e069dbed0eea7b8113ab8ff.tar.gz
glibc-8e27e3cc453849158e069dbed0eea7b8113ab8ff.tar.bz2
Fix ldbl-128ibm hypotl inaccuracy for arguments with large ratio (bug 14868).
-rw-r--r--ChangeLog5
-rw-r--r--NEWS2
-rw-r--r--math/libm-test.inc2
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_hypotl.c2
4 files changed, 9 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index c2421fa..69dd8fe 100644
--- 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
--- 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.
diff --git a/math/libm-test.inc b/math/libm-test.inc
index 74ef15b..21f4646 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -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);
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c b/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c
index 00bfb15..ce21194 100644
--- a/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c
@@ -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 */