[PATCH] libm: Fix 'gamma' and 'gammaf' functions. Clean up other gamma code. [v2]

Jon Turney jon.turney@dronecode.org.uk
Mon Sep 7 14:27:39 GMT 2020


On 04/09/2020 17: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.

Does the documentation (embedded in some comments at the start of 
w_gamma.c) for these functions need updating?  I'm not sure if the 
'RETURNS' section is correct now?

There's also a comment about the historical renaming which might be 
better exposed as a part of 'NOTES'?



More information about the Newlib mailing list