This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Fix ldbl-128 lgammal for small negative arguments (bug 16337)
- From: Andreas Jaeger <aj at suse dot com>
- To: "Joseph S. Myers" <joseph at codesourcery dot com>, libc-alpha at sourceware dot org
- Date: Sun, 22 Dec 2013 21:33:10 +0100
- Subject: Re: Fix ldbl-128 lgammal for small negative arguments (bug 16337)
- Authentication-results: sourceware.org; auth=none
- References: <Pine dot LNX dot 4 dot 64 dot 1312220219150 dot 28352 at digraph dot polyomino dot org dot uk>
On 12/22/2013 03:20 AM, Joseph S. Myers wrote:
> This patch fixes bug 16337, ldbl-128 lgammal spurious overflows for
> small negative arguments (the arguments in question are already in the
> testsuite). The implementation uses the reflection formula to compute
> lgamma of negative x from lgamma of -x, effectively resulting in a
> calculation -log(x^2) + log(-x); cancellation isn't problematic in
> this case (bugs for problematic cancellation in lgamma are 2542, 2543,
> 2558), but the x^2 calculation can underflow (in which case there is
> spurious logic to return an overflowing value - lgamma can only ever
> correctly overflow for large positive arguments, though tgamma can
> overflow for small arguments of either sign as well as large positive
> arguments). The fix is simply to calculate the result directly with
> logl when the argument is a small enough negative number.
ok, 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