Add headers, documentation, and tests for tgamma().

This commit is contained in:
Stephen Heumann 2022-12-24 20:21:31 -06:00
parent a87aeef25b
commit 7d3f1c8dd7
4 changed files with 27 additions and 0 deletions

View File

@ -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);

View File

@ -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

View File

@ -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);

View File

@ -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 <math.h>
double tgamma(double x);
float tgammaf(float x);
long double tgammal(long double x);
These functions compute the gamma function of x.
#include <math.h>
double trunc(double x);
float truncf(float x);