From: Joseph Myers <joseph@codesourcery.com>
To: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Cc: <libc-alpha@sourceware.org>
Subject: Re: [PATCH] Improve the accuracy of tgamma for negative inputs (BZ 26983)
Date: Fri, 26 Feb 2021 18:22:06 +0000 [thread overview]
Message-ID: <alpine.DEB.2.22.394.2102261815100.154624@digraph.polyomino.org.uk> (raw)
In-Reply-To: <20210226174419.340501-1-Paul.Zimmermann@inria.fr>
On Fri, 26 Feb 2021, Paul Zimmermann wrote:
> ---
> sysdeps/ieee754/dbl-64/e_gamma_r.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
Please include a longer commit message explaining the change made and why
it's an appropriate fix for the issue seen.
> @@ -188,8 +189,15 @@ __ieee754_gamma_r (double x, int *signgamp)
> ? __sin (M_PI * frac)
> : __cos (M_PI * (0.5 - frac)));
> int exp2_adj;
> - double tret = M_PI / (-x * sinpix
> - * gamma_positive (-x, &exp2_adj));
> + double h1, l1, h2, l2;
> + mul_split (&h1, &l1, sinpix, gamma_positive (-x, &exp2_adj));
> + /* sinpix*gamma_positive(.) = h1 + l1 */
> + mul_split (&h2, &l2, h1, x);
> + /* h1*x = h2 + l2 */
> + /* (h1 + l1) * x = h1*x + l1*x = h2 + l2 + l1*x */
> + l2 += l1 * x;
> + h2 += l2;
> + double tret = M_PI / -h2;
Note that glibc uses tabs for the initial multiple-of-8-columns of
indentation; this is inserting code using spaces instead.
I'd expect similar changes for ldbl-96 and ldbl-128 at least, in the
absence of some reason it makes sense for the implementations to diverge.
The test input that justifies this change as being needed should also be
added to auto-libm-test-in by the patch (or XFAILs for that test input
removed if already present), with any corresponding libm-test-ulps updates
also being included for at least one architecture on which the patch was
tested. Likewise the test input you found giving too-large ulps for
binary128, unless the binary128 problem is still present after making a
corresponding fix to the implementation for ldbl-128.
--
Joseph S. Myers
joseph@codesourcery.com
next prev parent reply other threads:[~2021-02-26 18:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-26 17:44 Paul Zimmermann
2021-02-26 18:22 ` Joseph Myers [this message]
2021-02-26 18:31 ` Andreas Schwab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.22.394.2102261815100.154624@digraph.polyomino.org.uk \
--to=joseph@codesourcery.com \
--cc=Paul.Zimmermann@inria.fr \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).