Fix ldbl-128ibm hypotl inaccuracy for arguments with large ratio (bug 14868).

This commit is contained in:
Joseph Myers 2012-11-22 14:57:22 +00:00
parent c9c0279bcb
commit 8e27e3cc45
4 changed files with 9 additions and 2 deletions

View File

@ -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.

2
NEWS
View File

@ -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.

View 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);

View 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 */