aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/ieee754
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/ieee754')
-rw-r--r--sysdeps/ieee754/dbl-64/e_gamma_r.c6
-rw-r--r--sysdeps/ieee754/flt-32/e_gammaf_r.c6
-rw-r--r--sysdeps/ieee754/k_standard.c23
-rw-r--r--sysdeps/ieee754/ldbl-128/e_gammal_r.c6
-rw-r--r--sysdeps/ieee754/ldbl-96/e_gammal_r.c6
5 files changed, 32 insertions, 15 deletions
diff --git a/sysdeps/ieee754/dbl-64/e_gamma_r.c b/sysdeps/ieee754/dbl-64/e_gamma_r.c
index 4614bcf46e..f32309350c 100644
--- a/sysdeps/ieee754/dbl-64/e_gamma_r.c
+++ b/sysdeps/ieee754/dbl-64/e_gamma_r.c
@@ -1,5 +1,5 @@
/* Implementation of gamma function according to ISO C.
- Copyright (C) 1997, 1999, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1999, 2001, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -35,9 +35,9 @@ __ieee754_gamma_r (double x, int *signgamp)
if (((hx & 0x7fffffff) | lx) == 0)
{
- /* Return value for x == 0 is NaN with invalid exception. */
+ /* Return value for x == 0 is Inf with divide by zero exception. */
*signgamp = 0;
- return x / x;
+ return 1.0 / x;
}
if (hx < 0 && (u_int32_t) hx < 0xfff00000 && __rint (x) == x)
{
diff --git a/sysdeps/ieee754/flt-32/e_gammaf_r.c b/sysdeps/ieee754/flt-32/e_gammaf_r.c
index d484e0c288..926c84f368 100644
--- a/sysdeps/ieee754/flt-32/e_gammaf_r.c
+++ b/sysdeps/ieee754/flt-32/e_gammaf_r.c
@@ -1,5 +1,5 @@
/* Implementation of gamma function according to ISO C.
- Copyright (C) 1997, 1999, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1999, 2001, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -34,9 +34,9 @@ __ieee754_gammaf_r (float x, int *signgamp)
if ((hx & 0x7fffffff) == 0)
{
- /* Return value for x == 0 is NaN with invalid exception. */
+ /* Return value for x == 0 is Inf with divide by zero exception. */
*signgamp = 0;
- return x / x;
+ return 1.0 / x;
}
if (hx < 0 && (u_int32_t) hx < 0xff800000 && __rintf (x) == x)
{
diff --git a/sysdeps/ieee754/k_standard.c b/sysdeps/ieee754/k_standard.c
index 6def34bc0c..d8fa2a4493 100644
--- a/sysdeps/ieee754/k_standard.c
+++ b/sysdeps/ieee754/k_standard.c
@@ -90,6 +90,7 @@ static double zero = 0.0; /* used as const */
* 47-- exp10 underflow
* 48-- log2(0)
* 49-- log2(x<0)
+ * 50-- tgamma(+-0)
*/
@@ -832,7 +833,7 @@ static double zero = 0.0; /* used as const */
case 40:
case 140:
case 240:
- /* gamma(finite) overflow */
+ /* tgamma(finite) overflow */
exc.type = OVERFLOW;
exc.name = type < 100 ? "tgamma" : (type < 200
? "tgammaf" : "tgammal");
@@ -846,7 +847,7 @@ static double zero = 0.0; /* used as const */
case 41:
case 141:
case 241:
- /* gamma(-integer) or gamma(0) */
+ /* tgamma(-integer) */
exc.type = SING;
exc.name = type < 100 ? "tgamma" : (type < 200
? "tgammaf" : "tgammal");
@@ -973,8 +974,24 @@ static double zero = 0.0; /* used as const */
__set_errno (EDOM);
}
break;
+ case 50:
+ case 150:
+ case 250:
+ /* tgamma(+-0) */
+ exc.type = SING;
+ exc.name = type < 100 ? "tgamma" : (type < 200
+ ? "tgammaf" : "tgammal");
+ exc.retval = __copysign (HUGE_VAL, x);
+ if (_LIB_VERSION == _POSIX_)
+ __set_errno (ERANGE);
+ else if (!matherr(&exc)) {
+ if (_LIB_VERSION == _SVID_)
+ (void) WRITE2("tgamma: SING error\n", 18);
+ __set_errno (ERANGE);
+ }
+ break;
- /* #### Last used is 49/149/249 ### */
+ /* #### Last used is 50/150/250 ### */
}
return exc.retval;
}
diff --git a/sysdeps/ieee754/ldbl-128/e_gammal_r.c b/sysdeps/ieee754/ldbl-128/e_gammal_r.c
index 123b559d08..36f5d45881 100644
--- a/sysdeps/ieee754/ldbl-128/e_gammal_r.c
+++ b/sysdeps/ieee754/ldbl-128/e_gammal_r.c
@@ -1,5 +1,5 @@
/* Implementation of gamma function according to ISO C.
- Copyright (C) 1997, 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1999, 2002, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997 and
Jakub Jelinek <jj@ultra.linux.cz, 1999.
@@ -36,9 +36,9 @@ __ieee754_gammal_r (long double x, int *signgamp)
if (((hx & 0x7fffffffffffffffLL) | lx) == 0)
{
- /* Return value for x == 0 is NaN with invalid exception. */
+ /* Return value for x == 0 is Inf with divide by zero exception. */
*signgamp = 0;
- return x / x;
+ return 1.0 / x;
}
if (hx < 0 && (u_int64_t) hx < 0xffff000000000000ULL && __rintl (x) == x)
{
diff --git a/sysdeps/ieee754/ldbl-96/e_gammal_r.c b/sysdeps/ieee754/ldbl-96/e_gammal_r.c
index f19a072179..dd956fed95 100644
--- a/sysdeps/ieee754/ldbl-96/e_gammal_r.c
+++ b/sysdeps/ieee754/ldbl-96/e_gammal_r.c
@@ -1,5 +1,5 @@
/* Implementation of gamma function according to ISO C.
- Copyright (C) 1997, 1999, 2001, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1999, 2001, 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -34,9 +34,9 @@ __ieee754_gammal_r (long double x, int *signgamp)
if (((es & 0x7fff) | hx | lx) == 0)
{
- /* Return value for x == 0 is NaN with invalid exception. */
+ /* Return value for x == 0 is Inf with divide by zero exception. */
*signgamp = 0;
- return x / x;
+ return 1.0 / x;
}
if (es == 0xffffffff && ((hx & 0x7fffffff) | lx) == 0)
{