newlib-cygwin/newlib/libc/sys/linux/cmath
Keith Packard via Newlib 1f8e5847df libm: Fix 'gamma' and 'gammaf' functions. Clean up other gamma code. [v2]
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>

----

v2:
	Switch commit message to ASCII
2020-09-04 21:27:11 +02:00
..
Makefile.am
Makefile.in makedoc: make errors visible 2017-12-07 11:54:11 +00:00
math_private.h libm: Fix 'gamma' and 'gammaf' functions. Clean up other gamma code. [v2] 2020-09-04 21:27:11 +02:00
s_cacos.c
s_cacosf.c
s_cacosh.c
s_cacoshf.c
s_cacoshl.c
s_cacosl.c
s_casin.c
s_casinf.c
s_casinh.c
s_casinhf.c
s_casinhl.c
s_casinl.c
s_catan.c
s_catanf.c
s_catanh.c
s_catanhf.c
s_catanhl.c
s_catanl.c
s_cbrtl.c
s_ccos.c
s_ccosf.c
s_ccosh.c
s_ccoshf.c
s_ccoshl.c
s_ccosl.c
s_cexp.c
s_cexpf.c
s_cexpl.c
s_clog.c
s_clog10.c
s_clog10f.c
s_clog10l.c
s_clogf.c
s_clogl.c
s_cpow.c
s_cpowf.c
s_cpowl.c
s_cproj.c
s_cprojf.c
s_cprojl.c
s_csin.c
s_csinf.c
s_csinh.c
s_csinhf.c
s_csinhl.c
s_csinl.c
s_csqrt.c
s_csqrtf.c
s_csqrtl.c
s_ctan.c
s_ctanf.c
s_ctanh.c
s_ctanhf.c
s_ctanhl.c
s_ctanl.c