This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix wordsize-64 cosh regression (bug 14273)


On 06/21/2012 06:27 PM, Joseph S. Myers wrote:
This patch fixes bug 14273, spurious cosh overflows that are a
regression in 2.15 and 2.16 introduced by the dbl-64/wordsize-64
version of cosh.

Tested x86_64 and i386; no ulps updates needed, but it's certainly
possible that some other architecture will need an ulps update, so do
we wish to defer the testcase until after 2.16 branches and apply only
the code change to master before then (and apply only the code change
to 2.15 branch)?

(The input used in the tests is the result of rounding the input given
in the bug report to 53-bit precision.)

As Carlos suggested: Just submit the fix - and I suggest to leave the bugreport open, assign it to you and once 2.17 opens, commit it without further review.


2012-06-21 Joseph Myers <joseph@codesourcery.com>

	[BZ #14273]
	* sysdeps/ieee754/dbl-64/wordsize-64/e_cosh.c: Clear sign bit of
	64-bit integer value before comparing against overflow value.

I think you should add the function name here "( __ieee754_cosh)".


* math/libm-test.inc (cosh_test): Add more tests.

diff --git a/math/libm-test.inc b/math/libm-test.inc
index 8e4d02e..48b05a6 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -2759,6 +2759,11 @@ cosh_test (void)

TEST_f_f (cosh, 0.75L, 1.29468328467684468784170818539018176L);

+#ifndef TEST_FLOAT
+  TEST_f_f (cosh, 709.8893558127259666434838436543941497802734375L, 9.9999998999995070652573675944761818416035e+307L);
+  TEST_f_f (cosh, -709.8893558127259666434838436543941497802734375L, 9.9999998999995070652573675944761818416035e+307L);
+#endif
+
    END (cosh);
  }

diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/e_cosh.c b/sysdeps/ieee754/dbl-64/wordsize-64/e_cosh.c
index b8ab748..8459352 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/e_cosh.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/e_cosh.c
@@ -67,6 +67,7 @@ __ieee754_cosh (double x)
      /* |x| in [log(maxdouble), overflowthresold] */
  	int64_t fix;
  	EXTRACT_WORDS64(fix, x);
+	fix &= UINT64_C(0x7fffffffffffffff);
  	if (fix <= UINT64_C(0x408633ce8fb9f87d)) {
  	    w = __ieee754_exp(half*fabs(x));
  	    t = half*w;


This is fine, thanks, Andreas -- Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg) GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]