public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Corinna Vinschen <vinschen@redhat.com>
To: newlib@sourceware.org
Subject: Re: [PATCH] libm: Fix 'gamma' and 'gammaf' functions. Clean up other gamma code. [v2]
Date: Fri, 4 Sep 2020 21:30:40 +0200	[thread overview]
Message-ID: <20200904193040.GX4127@calimero.vinschen.de> (raw)
In-Reply-To: <20200904162527.2145547-1-keithp@keithp.com>

On Sep  4 09:25, Keith Packard via Newlib wrote:
> The current gamma, gamma_r, gammaf and gammaf_r functions return
> |gamma(x)| instead of ln(|gamma(x)|) due to a change made back in 2002
> to the __ieee754_gamma_r implementation. This patch fixes that, making
> all of these functions map too their lgamma equivalents.
> 
> To fix the underlying bug, the __ieee754_gamma functions have been
> changed to return gamma(x), removing the _r variants as those are no
> longer necessary. Their names have been changed to __ieee754_tgamma to
> avoid potential confusion from users.
> 
> Now that the __ieee754_tgamma functions return the correctly signed
> value, the tgamma functions have been modified to use them.
> 
> libm.a now exposes the following gamma functions:
> 
>     ln(|gamma(x)|):
> 
> 	__ieee754_lgamma_r
> 	__ieee754_lgammaf_r
> 
> 	lgamma
> 	lgamma_r
> 	gamma
> 	gamma_r
> 
> 	lgammaf
> 	lgammaf_r
> 	gammaf
> 	gammaf_r
> 
> 	lgammal	(on machines where long double is double)
> 
>     gamma(x):
> 
> 	__ieee754_tgamma
> 	__ieee754_tgammaf
> 	tgamma
> 	tgammaf
> 	tgammal (on machines where long double is double)
> 
> Additional aliases for any of the above functions can be added if
> necessary; in particular, I'm not sure if we need to include
> __ieee754_gamma*_r functions (which would return ln(|(gamma(x)|).
> 
> Signed-off-by: Keith Packard <keithp@keithp.com>

Pushed.


Thanks,
Corinna


  reply	other threads:[~2020-09-04 19:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-04 16:25 Keith Packard
2020-09-04 19:30 ` Corinna Vinschen [this message]
2020-09-07 14:27 ` Jon Turney
2020-09-07 17:31   ` Keith Packard

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=20200904193040.GX4127@calimero.vinschen.de \
    --to=vinschen@redhat.com \
    --cc=newlib@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).