about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/ieee754/dbl-64/e_lgamma_r.c7
-rw-r--r--sysdeps/ieee754/flt-32/e_lgammaf_r.c7
-rw-r--r--sysdeps/ieee754/ldbl-96/e_lgammal_r.c10
3 files changed, 19 insertions, 5 deletions
diff --git a/sysdeps/ieee754/dbl-64/e_lgamma_r.c b/sysdeps/ieee754/dbl-64/e_lgamma_r.c
index cc44b048f4..a298a5a2a4 100644
--- a/sysdeps/ieee754/dbl-64/e_lgamma_r.c
+++ b/sysdeps/ieee754/dbl-64/e_lgamma_r.c
@@ -228,7 +228,12 @@ static double zero=  0.00000000000000000000e+00;
 	*signgamp = 1;
 	ix = hx&0x7fffffff;
 	if(ix>=0x7ff00000) return x*x;
-	if((ix|lx)==0) return one/fabs(x);
+	if((ix|lx)==0)
+	  {
+	    if (hx < 0)
+	      *signgamp = -1;
+	    return one/fabs(x);
+	  }
 	if(ix<0x3b900000) {	/* |x|<2**-70, return -log(|x|) */
 	    if(hx<0) {
 	        *signgamp = -1;
diff --git a/sysdeps/ieee754/flt-32/e_lgammaf_r.c b/sysdeps/ieee754/flt-32/e_lgammaf_r.c
index 5ebebb77af..0ed2610085 100644
--- a/sysdeps/ieee754/flt-32/e_lgammaf_r.c
+++ b/sysdeps/ieee754/flt-32/e_lgammaf_r.c
@@ -164,7 +164,12 @@ static float zero=  0.0000000000e+00;
 	*signgamp = 1;
 	ix = hx&0x7fffffff;
 	if(ix>=0x7f800000) return x*x;
-	if(ix==0) return one/fabsf(x);
+	if(ix==0)
+	  {
+	    if (hx < 0)
+	      *signgamp = -1;
+	    return one/fabsf(x);
+	  }
 	if(ix<0x1c800000) {	/* |x|<2**-70, return -log(|x|) */
 	    if(hx<0) {
 	        *signgamp = -1;
diff --git a/sysdeps/ieee754/ldbl-96/e_lgammal_r.c b/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
index fecbee9b2a..36e336565c 100644
--- a/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
+++ b/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
@@ -11,9 +11,9 @@
 
 /* Long double expansions are
   Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
-  and are incorporated herein by permission of the author.  The author 
+  and are incorporated herein by permission of the author.  The author
   reserves the right to distribute this material elsewhere under different
-  copying permissions.  These modifications are distributed here under 
+  copying permissions.  These modifications are distributed here under
   the following terms:
 
     This library is free software; you can redistribute it and/or
@@ -302,7 +302,11 @@ __ieee754_lgammal_r (x, signgamp)
   ix = se & 0x7fff;
 
   if ((ix | i0 | i1) == 0)
-    return one / fabsl (x);
+    {
+      if (se & 0x8000)
+	*signgamp = -1;
+      return one / fabsl (x);
+    }
 
   ix = (ix << 16) | (i0 >> 16);