diff --git a/ORCACDefs/math.h b/ORCACDefs/math.h index 97008fd..c4c5a54 100644 --- a/ORCACDefs/math.h +++ b/ORCACDefs/math.h @@ -227,6 +227,9 @@ long double tanl(long double); double tanh(double); float tanhf(float); long double tanhl(long double); +double tgamma(double); +float tgammaf(float); +long double tgammal(long double); double trunc(double); float truncf(float); long double truncl(long double); diff --git a/ORCACDefs/tgmath.h b/ORCACDefs/tgmath.h index b1336f7..ad2160b 100644 --- a/ORCACDefs/tgmath.h +++ b/ORCACDefs/tgmath.h @@ -86,6 +86,7 @@ #define sqrt(x) __tg_x(sqrt,(x)) #define tan(x) __tg_x(tan,(x)) #define tanh(x) __tg_x(tanh,(x)) +#define tgamma(x) __tg_real_x(tgamma,(x)) #define trunc(x) __tg_real_x(trunc,(x)) #endif diff --git a/Tests/Conformance/c99math.c b/Tests/Conformance/c99math.c index 369eb0d..0c5f682 100644 --- a/Tests/Conformance/c99math.c +++ b/Tests/Conformance/c99math.c @@ -356,6 +356,22 @@ int main(void) { expect_approx(erfcl(0.95L), 1.791091927267220e-01L); expect_approx(erfcl(9.99L), 2.553157649309533e-45L); expect_approx(erfcl(105.0L), 4.300838032791244e-4791L); + + expect_pole_error(tgamma(+0.0), +INFINITY); + expect_pole_error(tgammaf(-0.0), -INFINITY); + expect_domain_error(tgammal(-2.0)); + expect_domain_error(tgammal(-15.0)); + expect_domain_error(tgammal(-1e4900)); + expect_domain_error(tgammal(-INFINITY)); + expect_exact(tgammal(+INFINITY),+INFINITY); + expect_approx(tgammal(1.0), 1.0); + expect_approx(tgammal(6.0), 120.0); + expect_approx(tgammal(19.5), 2.77243229863337182e+16L); + expect_approx(tgammal(1755.0), 1.979261890105010e+4930L); + expect_approx(tgammal(1e-4932L), 1e4932L); + expect_approx(tgammal(-0.75), -4.83414654429587774L); + expect_approx(tgammal(-50.00001L), -3.2878204666630031e-60L); + expect_approx(tgammal(-1753.75L), 1.452754458037161e-4929L); expect_exact(ceil(+0.0), +0.0); expect_exact(ceilf(-0.0), -0.0); diff --git a/cc.notes b/cc.notes index 92e41ff..eaf0c1c 100644 --- a/cc.notes +++ b/cc.notes @@ -1322,6 +1322,13 @@ long double scalblnl(long double x, long n); These functions return x * FLT_RADIX^n, computed efficiently. In ORCA/C, FLT_RADIX is 2. +#include +double tgamma(double x); +float tgammaf(float x); +long double tgammal(long double x); + +These functions compute the gamma function of x. + #include double trunc(double x); float truncf(float x);