Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard via Newlib <newlib@sourceware.org>2020-09-04 19:25:27 +0300
committerCorinna Vinschen <corinna@vinschen.de>2020-09-04 22:27:11 +0300
commit1f8e5847dff27e504949cd21bfeadb987d36ad19 (patch)
treeadbbd24f728478115a1953c57c8dfb35f60ae74f /newlib/libc/sys
parenta0d7982ff486292540078c0121a435013c5ee1ea (diff)
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
Diffstat (limited to 'newlib/libc/sys')
-rw-r--r--newlib/libc/sys/linux/cmath/math_private.h12
1 files changed, 3 insertions, 9 deletions
diff --git a/newlib/libc/sys/linux/cmath/math_private.h b/newlib/libc/sys/linux/cmath/math_private.h
index 3e32b29ba..f7d38a3c5 100644
--- a/newlib/libc/sys/linux/cmath/math_private.h
+++ b/newlib/libc/sys/linux/cmath/math_private.h
@@ -178,9 +178,7 @@ extern double __ieee754_cosh (double);
extern double __ieee754_fmod (double,double);
extern double __ieee754_pow (double,double);
extern double __ieee754_lgamma_r (double,int *);
-extern double __ieee754_gamma_r (double,int *);
-extern double __ieee754_lgamma (double);
-extern double __ieee754_gamma (double);
+extern double __ieee754_tgamma (double);
extern double __ieee754_log10 (double);
extern double __ieee754_log2 (double);
extern double __ieee754_sinh (double);
@@ -241,9 +239,7 @@ extern float __ieee754_coshf (float);
extern float __ieee754_fmodf (float,float);
extern float __ieee754_powf (float,float);
extern float __ieee754_lgammaf_r (float,int *);
-extern float __ieee754_gammaf_r (float,int *);
-extern float __ieee754_lgammaf (float);
-extern float __ieee754_gammaf (float);
+extern float __ieee754_tgammaf (float);
extern float __ieee754_log10f (float);
extern float __ieee754_log2f (float);
extern float __ieee754_sinhf (float);
@@ -281,9 +277,7 @@ extern long double __ieee754_coshl (long double);
extern long double __ieee754_fmodl (long double,long double);
extern long double __ieee754_powl (long double,long double);
extern long double __ieee754_lgammal_r (long double,int *);
-extern long double __ieee754_gammal_r (long double,int *);
-extern long double __ieee754_lgammal (long double);
-extern long double __ieee754_gammal (long double);
+extern long double __ieee754_tgammal (long double);
extern long double __ieee754_log10l (long double);
extern long double __ieee754_log2l (long double);
extern long double __ieee754_sinhl (long double);