e_lgamma_r.c 1.9
e_lgammaf_r.c 1.10

Don't assume that int == int32_t.  Minor fixes in comments.  Describe
special cases in more detail.
This commit is contained in:
bde 2007-06-14 06:06:12 +00:00
parent da488e0484
commit 12b3ebee26
2 changed files with 11 additions and 8 deletions

View File

@ -76,10 +76,11 @@ static char rcsid[] = "$FreeBSD$";
*
* 5. Special Cases
* lgamma(2+s) ~ s*(1-Euler) for tiny s
* lgamma(1)=lgamma(2)=0
* lgamma(x) ~ -log(x) for tiny x
* lgamma(0) = lgamma(inf) = inf
* lgamma(-integer) = +-inf
* lgamma(1) = lgamma(2) = 0
* lgamma(x) ~ -log(|x|) for tiny x
* lgamma(0) = lgamma(neg.integer) = inf and raise divide-by-zero
* lgamma(inf) = inf
* lgamma(-inf) = inf (bug for bug compatible with C99!?)
*
*/
@ -205,11 +206,12 @@ double
__ieee754_lgamma_r(double x, int *signgamp)
{
double t,y,z,nadj,p,p1,p2,p3,q,r,w;
int i,hx,lx,ix;
int32_t hx;
int i,lx,ix;
EXTRACT_WORDS(hx,lx,x);
/* purge off +-inf, NaN, +-0, and negative arguments */
/* purge off +-inf, NaN, +-0, tiny and negative arguments */
*signgamp = 1;
ix = hx&0x7fffffff;
if(ix>=0x7ff00000) return x*x;

View File

@ -139,11 +139,12 @@ float
__ieee754_lgammaf_r(float x, int *signgamp)
{
float t,y,z,nadj,p,p1,p2,p3,q,r,w;
int i,hx,ix;
int32_t hx;
int i,ix;
GET_FLOAT_WORD(hx,x);
/* purge off +-inf, NaN, +-0, and negative arguments */
/* purge off +-inf, NaN, +-0, tiny and negative arguments */
*signgamp = 1;
ix = hx&0x7fffffff;
if(ix>=0x7f800000) return x*x;