acadia-newlib/newlib/libm
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
..
common libm/machine/riscv: Add custom fma/sqrt functions when supported [v2] 2020-08-12 09:52:19 +02:00
complex Remove matherr, and SVID and X/Open math library configurations 2019-01-23 10:46:24 +01:00
fenv Add patch from Joel Sherrill for i386 and x86_64 fenv support 2019-10-08 16:59:04 -04:00
machine libm/riscv: Use common fma code when necessary 2020-09-04 15:11:31 +02:00
math libm: Fix 'gamma' and 'gammaf' functions. Clean up other gamma code. [v2] 2020-09-04 21:27:11 +02:00
mathfp Remove matherr, and SVID and X/Open math library configurations 2019-01-23 10:46:24 +01:00
test Remove matherr, and SVID and X/Open math library configurations 2019-01-23 10:46:24 +01:00
Makefile.am Add default implementation of fenv.h and all methods 2019-08-09 17:49:16 +02:00
Makefile.in Fix some generated files 2019-10-31 14:52:04 -04:00
aclocal.m4 Fix libm regenerated files again. 2016-02-17 17:06:46 -05:00
config.h.in
configure Bump up newlib release to 3.3.0 2020-01-21 15:17:43 -05:00
configure.in Add default implementation of fenv.h and all methods 2019-08-09 17:49:16 +02:00
libm.in.xml fenv: Include documentation in generated .info file 2019-08-15 12:04:50 +02:00
libm.texinfo fenv: Include documentation in generated .info file 2019-08-15 12:04:50 +02:00