diff options
author | kargl <kargl@FreeBSD.org> | 2014-09-17 19:01:22 +0000 |
---|---|---|
committer | kargl <kargl@FreeBSD.org> | 2014-09-17 19:01:22 +0000 |
commit | 4044c8d29de600d2b94a48da1b111a18c3f0c0f8 (patch) | |
tree | cd812f7cced5f8cea889659130d00da95eac7fcd /lib | |
parent | a8c488eae39be7e44747f0f236ce341c19853437 (diff) | |
download | FreeBSD-src-4044c8d29de600d2b94a48da1b111a18c3f0c0f8.zip FreeBSD-src-4044c8d29de600d2b94a48da1b111a18c3f0c0f8.tar.gz |
For targets that have a signed zero, lgamma_r(-0, &signgamp) should
set signgamp = -1.
Submitted by: enh at google dot com (e_lgamma[f]_r.c)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/msun/ld128/e_lgammal_r.c | 6 | ||||
-rw-r--r-- | lib/msun/ld80/e_lgammal_r.c | 6 | ||||
-rw-r--r-- | lib/msun/src/e_lgamma_r.c | 6 | ||||
-rw-r--r-- | lib/msun/src/e_lgammaf_r.c | 6 |
4 files changed, 20 insertions, 4 deletions
diff --git a/lib/msun/ld128/e_lgammal_r.c b/lib/msun/ld128/e_lgammal_r.c index a612681..13f8f75 100644 --- a/lib/msun/ld128/e_lgammal_r.c +++ b/lib/msun/ld128/e_lgammal_r.c @@ -241,7 +241,11 @@ lgammal_r(long double x, int *signgamp) *signgamp = 1; if((hx & 0x7fff) == 0x7fff) /* x is +-Inf or NaN */ return x*x; - if((hx==0||hx==0x8000)&&lx==0) return one/vzero; + if((hx==0||hx==0x8000)&&lx==0) { + if (hx&0x8000) + *signgamp = -1; + return one/vzero; + } /* purge off tiny and negative arguments */ if(fabsl(x)<0x1p-119L) { diff --git a/lib/msun/ld80/e_lgammal_r.c b/lib/msun/ld80/e_lgammal_r.c index bafa9a3..621b04e 100644 --- a/lib/msun/ld80/e_lgammal_r.c +++ b/lib/msun/ld80/e_lgammal_r.c @@ -261,7 +261,11 @@ lgammal_r(long double x, int *signgamp) *signgamp = 1; if((hx & 0x7fff) == 0x7fff) /* x is +-Inf or NaN */ return x*x; - if((hx==0||hx==0x8000)&&lx==0) return one/vzero; + if((hx==0||hx==0x8000)&&lx==0) { + if (hx&0x8000) + *signgamp = -1; + return one/vzero; + } ENTERI(); diff --git a/lib/msun/src/e_lgamma_r.c b/lib/msun/src/e_lgamma_r.c index ce2af94..a6fd691 100644 --- a/lib/msun/src/e_lgamma_r.c +++ b/lib/msun/src/e_lgamma_r.c @@ -214,7 +214,11 @@ __ieee754_lgamma_r(double x, int *signgamp) *signgamp = 1; ix = hx&0x7fffffff; if(ix>=0x7ff00000) return x*x; - if((ix|lx)==0) return one/vzero; + if((ix|lx)==0) { + if(hx<0) + *signgamp = -1; + return one/vzero; + } if(ix<0x3b900000) { /* |x|<2**-70, return -log(|x|) */ if(hx<0) { *signgamp = -1; diff --git a/lib/msun/src/e_lgammaf_r.c b/lib/msun/src/e_lgammaf_r.c index f940845..9d23053 100644 --- a/lib/msun/src/e_lgammaf_r.c +++ b/lib/msun/src/e_lgammaf_r.c @@ -132,7 +132,11 @@ __ieee754_lgammaf_r(float x, int *signgamp) *signgamp = 1; ix = hx&0x7fffffff; if(ix>=0x7f800000) return x*x; - if(ix==0) return one/vzero; + if(ix==0) { + if(hx<0) + *signgamp = -1; + return one/vzero; + } if(ix<0x35000000) { /* |x|<2**-21, return -log(|x|) */ if(hx<0) { *signgamp = -1; |