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)
This commit is contained in:
Steve Kargl 2014-09-17 19:01:22 +00:00
parent 21cffce593
commit f382031d34
4 changed files with 20 additions and 4 deletions

View File

@ -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) {

View File

@ -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();

View File

@ -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;

View File

@ -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;