diff options
author | Szabolcs Nagy <nsz@port70.net> | 2012-12-12 01:43:43 +0100 |
---|---|---|
committer | Szabolcs Nagy <nsz@port70.net> | 2012-12-12 01:43:43 +0100 |
commit | 0f53c1a4266ad4cca28115e2c3bcfdc86337d8ca (patch) | |
tree | 4dbe18341f662914d8fd916f1f38549444478589 /src/math/tgammaf.c | |
parent | 14cc9c7f38c80094c05353fcb11fe9e441340583 (diff) | |
download | musl-0f53c1a4266ad4cca28115e2c3bcfdc86337d8ca.tar.gz musl-0f53c1a4266ad4cca28115e2c3bcfdc86337d8ca.tar.bz2 musl-0f53c1a4266ad4cca28115e2c3bcfdc86337d8ca.tar.xz musl-0f53c1a4266ad4cca28115e2c3bcfdc86337d8ca.zip |
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.
Diffstat (limited to 'src/math/tgammaf.c')
-rw-r--r-- | src/math/tgammaf.c | 12 |
1 files changed, 1 insertions, 11 deletions
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 <math.h> -// 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); } |