about summary refs log tree commit diff
path: root/sysdeps/libm-ieee754
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/libm-ieee754')
-rw-r--r--sysdeps/libm-ieee754/e_gamma_r.c10
-rw-r--r--sysdeps/libm-ieee754/e_gammaf_r.c10
-rw-r--r--sysdeps/libm-ieee754/e_gammal_r.c10
3 files changed, 21 insertions, 9 deletions
diff --git a/sysdeps/libm-ieee754/e_gamma_r.c b/sysdeps/libm-ieee754/e_gamma_r.c
index 901f1451d2..bd802c24f1 100644
--- a/sysdeps/libm-ieee754/e_gamma_r.c
+++ b/sysdeps/libm-ieee754/e_gamma_r.c
@@ -1,5 +1,5 @@
 /* Implementation of gamma function according to ISO C.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -34,11 +34,15 @@ __ieee754_gamma_r (double x, int *signgamp)
   EXTRACT_WORDS (hx, lx, x);
 
   if (((hx & 0x7fffffff) | lx) == 0)
-    /* Return value for x == 0 is NaN with invalid exception.  */
-    return x / x;
+    {
+      /* Return value for x == 0 is NaN with invalid exception.  */
+      *signgamp = 0;
+      return x / x;
+    }
   if (hx < 0 && (u_int32_t) hx < 0xfff00000 && __rint (x) == x)
     {
       /* Return value for integer x < 0 is NaN with invalid exception.  */
+      *signgamp = 0;
       return (x - x) / (x - x);
     }
 
diff --git a/sysdeps/libm-ieee754/e_gammaf_r.c b/sysdeps/libm-ieee754/e_gammaf_r.c
index bf79ffeb57..926905e7cd 100644
--- a/sysdeps/libm-ieee754/e_gammaf_r.c
+++ b/sysdeps/libm-ieee754/e_gammaf_r.c
@@ -1,5 +1,5 @@
 /* Implementation of gamma function according to ISO C.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -33,11 +33,15 @@ __ieee754_gammaf_r (float x, int *signgamp)
   GET_FLOAT_WORD (hx, x);
 
   if ((hx & 0x7fffffff) == 0)
-    /* Return value for x == 0 is NaN with invalid exception.  */
-    return x / x;
+    {
+      /* Return value for x == 0 is NaN with invalid exception.  */
+      *signgamp = 0;
+      return x / x;
+    }
   if (hx < 0 && (u_int32_t) hx < 0xff800000 && __rintf (x) == x)
     {
       /* Return value for integer x < 0 is NaN with invalid exception.  */
+      *signgamp = 0;
       return (x - x) / (x - x);
     }
 
diff --git a/sysdeps/libm-ieee754/e_gammal_r.c b/sysdeps/libm-ieee754/e_gammal_r.c
index 4fd49886d1..104992450b 100644
--- a/sysdeps/libm-ieee754/e_gammal_r.c
+++ b/sysdeps/libm-ieee754/e_gammal_r.c
@@ -1,5 +1,5 @@
 /* Implementation of gamma function according to ISO C.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -33,11 +33,15 @@ __ieee754_gammal_r (long double x, int *signgamp)
   GET_LDOUBLE_WORDS (es, hx, lx, x);
 
   if (((es & 0x7fff) | hx | lx) == 0)
-    /* Return value for x == 0 is NaN with invalid exception.  */
-    return x / x;
+    {
+      /* Return value for x == 0 is NaN with invalid exception.  */
+      *signgamp = 0;
+      return x / x;
+    }
   if ((hx & 0x8000) != 0 && (hx & 0x7fff) != 0x7fff && __rintl (x) == x)
     {
       /* Return value for integer x < 0 is NaN with invalid exception.  */
+      *signgamp = 0;
       return (x - x) / (x - x);
     }