This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Fix cosh spurious underflows from expm1 (bug 16354), inaccurate results near 0 (bug 17061)
- From: Andreas Jaeger <aj at suse dot com>
- To: "Joseph S. Myers" <joseph at codesourcery dot com>, libc-alpha at sourceware dot org
- Date: Mon, 23 Jun 2014 20:25:29 +0200
- Subject: Re: Fix cosh spurious underflows from expm1 (bug 16354), inaccurate results near 0 (bug 17061)
- Authentication-results: sourceware.org; auth=none
- References: <Pine dot LNX dot 4 dot 64 dot 1406162136430 dot 14606 at digraph dot polyomino dot org dot uk>
On 06/16/2014 11:38 PM, Joseph S. Myers wrote:
> This patch fixes bug 16354, spurious underflows from cosh when a tiny
> argument is passed to expm1 and expm1 correctly underflows although
> the final result of cosh should be 1. As noted in that bug, some
> cases are latent because of expm1 implementations not raising
> underflow (bug 16353), but all the implementations are fixed
> similarly. They already contained checks for tiny arguments, but the
> checks were too late to avoid underflow from expm1 (although they
> would avoid underflow from subsequent squaring of the result of
> expm1); they are moved before the expm1 calls.
>
> The thresholds used for considering arguments tiny are not
> particularly consistent in how they relate to the precision of the
> floating-point format in question. They are, however, all sufficient
> to ensure that the round-to-nearest result of cosh is indeed 1 below
> the threshold (although sometimes they are smaller than necessary).
> But the previous logic did not return 1, but the previously computed 1
> + expm1(abs(x)) value. And the thresholds in the ldbl-128 and
> ldbl-128ibm code (0x1p-71L - I suspect 0x3f8b was intended in the code
> instead of 0x3fb8 - and (roughly) 0x1p-55L) are not sufficient for
> that value to be 1. So by moving the test for tiny arguments, and
> consequently returning 1 directly now the expm1 value hasn't been
> computed by that point, this patch also fixes bug 17061, the (large
> number of ulps) inaccuracy for small arguments in those
> implementations. Tests for that bug are duly added.
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