From 0f53c1a4266ad4cca28115e2c3bcfdc86337d8ca Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Wed, 12 Dec 2012 01:43:43 +0100 Subject: math: add a non-dummy tgamma implementation uses the lanczos approximation method with the usual tweaks. same parameters were selected as in boost and python. (avoides some extra work and special casing found in boost so the precision is not that good: measured error is <5ulp for positive x and <10ulp for negative) an alternative lgamma_r implementation is also given in the same file which is simpler and smaller than the current one, but less precise so it's ifdefed out for now. --- src/math/tgammaf.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'src/math/tgammaf.c') diff --git a/src/math/tgammaf.c b/src/math/tgammaf.c index 16df8076..b4ca51c9 100644 --- a/src/math/tgammaf.c +++ b/src/math/tgammaf.c @@ -1,16 +1,6 @@ #include -// FIXME: use lanczos approximation - -float __lgammaf_r(float, int *); - float tgammaf(float x) { - int sign; - float y; - - y = exp(__lgammaf_r(x, &sign)); - if (sign < 0) - y = -y; - return y; + return tgamma(x); } -- cgit v1.2.1