diff options
author | bde <bde@FreeBSD.org> | 2007-05-02 16:54:22 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 2007-05-02 16:54:22 +0000 |
commit | 7b4912a3de1bf63af580b26951df4959ff338571 (patch) | |
tree | 34ee8d134aca2b7394ca228c48ad7a404dc1c234 /lib/msun/src | |
parent | 16285a5832a3434f973b571685ec62b7a847982d (diff) | |
download | FreeBSD-src-7b4912a3de1bf63af580b26951df4959ff338571.zip FreeBSD-src-7b4912a3de1bf63af580b26951df4959ff338571.tar.gz |
Don't assume that int is signed 32-bits in one place. Keep assuming
that ints have >= 31 value bits elsewhere. s/int/int32_t/ seems to
have been done too globally for all other files in msun/src before
msun/ was imported into FreeBSD.
Minor fixes in comments.
e_lgamma_r.c:
Describe special cases in more detail:
- exception for lgamma(0) and lgamma(neg.integer)
- lgamma(-Inf) = Inf. This is wrong but is required by C99 Annex F. I
hope to change this.
Diffstat (limited to 'lib/msun/src')
-rw-r--r-- | lib/msun/src/e_lgamma_r.c | 14 | ||||
-rw-r--r-- | lib/msun/src/e_lgammaf_r.c | 5 |
2 files changed, 11 insertions, 8 deletions
diff --git a/lib/msun/src/e_lgamma_r.c b/lib/msun/src/e_lgamma_r.c index 91989d5..7f2767f 100644 --- a/lib/msun/src/e_lgamma_r.c +++ b/lib/msun/src/e_lgamma_r.c @@ -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; diff --git a/lib/msun/src/e_lgammaf_r.c b/lib/msun/src/e_lgammaf_r.c index 16087d3..12bcaa3 100644 --- a/lib/msun/src/e_lgammaf_r.c +++ b/lib/msun/src/e_lgammaf_r.c @@ -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; |